Commit a050a661 by 霍志良

Merge branch 'medical_zl_diagnose' into 'dev_medical'

【C】复诊续方及处方优化

See merge request app_android_lib/YDL-Component!366
parents 0af98d7e cf8c73a7
...@@ -10,7 +10,7 @@ ext { ...@@ -10,7 +10,7 @@ ext {
"m-fm" : "0.0.30.03", "m-fm" : "0.0.30.03",
"m-user-medical" : "0.0.62.14", "m-user-medical" : "0.0.62.14",
"m-home" : "0.0.22.70", "m-home" : "0.0.22.70",
"m-im-medical" : "0.0.21.47", "m-im-medical" : "0.0.21.55",
"m-dynamic" : "0.0.7.28", "m-dynamic" : "0.0.7.28",
"m-article" : "0.0.0.10", "m-article" : "0.0.0.10",
...@@ -33,7 +33,7 @@ ext { ...@@ -33,7 +33,7 @@ ext {
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
//第一步 //第一步
"ydl-platform" : "0.0.41.61", "ydl-platform" : "0.0.41.63",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.38.57", "ydl-webview" : "0.0.38.57",
...@@ -94,7 +94,7 @@ ext { ...@@ -94,7 +94,7 @@ ext {
"m-fm" : "0.0.30.01", "m-fm" : "0.0.30.01",
"m-user-medical" : "0.0.62.14", "m-user-medical" : "0.0.62.14",
"m-home" : "0.0.22.70", "m-home" : "0.0.22.70",
"m-im-medical" : "0.0.21.47", "m-im-medical" : "0.0.21.55",
"m-dynamic" : "0.0.7.28", "m-dynamic" : "0.0.7.28",
"m-article" : "0.0.0.8", "m-article" : "0.0.0.8",
...@@ -116,7 +116,7 @@ ext { ...@@ -116,7 +116,7 @@ ext {
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
//第一步 //第一步
"ydl-platform" : "0.0.41.61", "ydl-platform" : "0.0.41.63",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.38.57", "ydl-webview" : "0.0.38.57",
...@@ -234,13 +234,13 @@ ext { ...@@ -234,13 +234,13 @@ ext {
"umeng-common" : "com.umeng.umsdk:common:9.5.1", "umeng-common" : "com.umeng.umsdk:common:9.5.1",
"umeng-asms" : "com.umeng.umsdk:asms:1.4.1", "umeng-asms" : "com.umeng.umsdk:asms:1.4.1",
// //友盟社会化分享 // //友盟社会化分享
// "umeng-share-core" : "com.umeng.umsdk:share-core:7.1.4", "umeng-share-core" : "com.umeng.umsdk:share-core:7.1.4",
// "umeng-share-qq" : "com.umeng.umsdk:share-qq:7.1.4", "umeng-share-qq" : "com.umeng.umsdk:share-qq:7.1.4",
"umeng-share-wechat" : "com.umeng.umsdk:share-wx:7.1.4", "umeng-share-wechat" : "com.umeng.umsdk:share-wx:7.1.4",
// //分享面板 // //分享面板
// "umeng-shareboard" : "com.umeng.umsdk:share-board:7.1.4", "umeng-shareboard" : "com.umeng.umsdk:share-board:7.1.4",
"umeng-wx-guanfang" : "com.tencent.mm.opensdk:wechat-sdk-android-without-mta:6.6.5", "umeng-wx-guanfang" : "com.tencent.mm.opensdk:wechat-sdk-android-without-mta:6.6.5",
// "umeng-qq-guanfang" : "com.tencent.tauth:qqopensdk:3.51.2", "umeng-qq-guanfang" : "com.tencent.tauth:qqopensdk:3.51.2",
"tablayout" : "com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar", "tablayout" : "com.flyco.tablayout:FlycoTabLayout_Lib:2.1.2@aar",
"stetho" : "com.facebook.stetho:stetho:1.5.0", "stetho" : "com.facebook.stetho:stetho:1.5.0",
"stetho-okhttp3" : "com.facebook.stetho:stetho-okhttp3:1.4.1", "stetho-okhttp3" : "com.facebook.stetho:stetho-okhttp3:1.4.1",
......
package com.yidianling.im.bean
class MedicineItemBean {
var medicineApplyNumber: Int? = 0
var medicineName: String = ""
var medicineSpec: String = ""
}
\ No newline at end of file
...@@ -55,6 +55,7 @@ import com.yidianling.im.session.extension.CustomAttachmentOrderAlreadyDone; ...@@ -55,6 +55,7 @@ import com.yidianling.im.session.extension.CustomAttachmentOrderAlreadyDone;
import com.yidianling.im.session.extension.CustomAttachmentOrderStatus; import com.yidianling.im.session.extension.CustomAttachmentOrderStatus;
import com.yidianling.im.session.extension.CustomAttachmentPatientCheckIn; import com.yidianling.im.session.extension.CustomAttachmentPatientCheckIn;
import com.yidianling.im.session.extension.CustomAttachmentPatientFullInfo; import com.yidianling.im.session.extension.CustomAttachmentPatientFullInfo;
import com.yidianling.im.session.extension.CustomAttachmentPatientMedicineApply;
import com.yidianling.im.session.extension.CustomAttachmentPhoneCallSystemNotice; import com.yidianling.im.session.extension.CustomAttachmentPhoneCallSystemNotice;
import com.yidianling.im.session.extension.CustomAttachmentRecipel; import com.yidianling.im.session.extension.CustomAttachmentRecipel;
import com.yidianling.im.session.extension.CustomAttachmentRecommendAssistant; import com.yidianling.im.session.extension.CustomAttachmentRecommendAssistant;
...@@ -87,6 +88,7 @@ import com.yidianling.im.session.viewholder.MsgViewHolderOrderAlreadyDone; ...@@ -87,6 +88,7 @@ import com.yidianling.im.session.viewholder.MsgViewHolderOrderAlreadyDone;
import com.yidianling.im.session.viewholder.MsgViewHolderOrderStatus; import com.yidianling.im.session.viewholder.MsgViewHolderOrderStatus;
import com.yidianling.im.session.viewholder.MsgViewHolderPatientCheckIn; import com.yidianling.im.session.viewholder.MsgViewHolderPatientCheckIn;
import com.yidianling.im.session.viewholder.MsgViewHolderPatientFullInfo; import com.yidianling.im.session.viewholder.MsgViewHolderPatientFullInfo;
import com.yidianling.im.session.viewholder.MsgViewHolderPatientMedicineApply;
import com.yidianling.im.session.viewholder.MsgViewHolderPerfectConsultData; import com.yidianling.im.session.viewholder.MsgViewHolderPerfectConsultData;
import com.yidianling.im.session.viewholder.MsgViewHolderPhoneCallSystemNotice; import com.yidianling.im.session.viewholder.MsgViewHolderPhoneCallSystemNotice;
import com.yidianling.im.session.viewholder.MsgViewHolderRecipel; import com.yidianling.im.session.viewholder.MsgViewHolderRecipel;
...@@ -458,6 +460,7 @@ public class SessionHelper { ...@@ -458,6 +460,7 @@ public class SessionHelper {
NimUIKit.registerMsgItemViewHolder(CustomAttachmentRecipel.class, MsgViewHolderRecipel.class);//处方单创建消息类型 NimUIKit.registerMsgItemViewHolder(CustomAttachmentRecipel.class, MsgViewHolderRecipel.class);//处方单创建消息类型
NimUIKit.registerMsgItemViewHolder(CustomAttachmentPatientCheckIn.class, MsgViewHolderPatientCheckIn.class);//患者报到 NimUIKit.registerMsgItemViewHolder(CustomAttachmentPatientCheckIn.class, MsgViewHolderPatientCheckIn.class);//患者报到
NimUIKit.registerMsgItemViewHolder(CustomAttachmentPatientFullInfo.class, MsgViewHolderPatientFullInfo.class);//就诊者完善信息 NimUIKit.registerMsgItemViewHolder(CustomAttachmentPatientFullInfo.class, MsgViewHolderPatientFullInfo.class);//就诊者完善信息
NimUIKit.registerMsgItemViewHolder(CustomAttachmentPatientMedicineApply.class, MsgViewHolderPatientMedicineApply.class);//开药申请
} }
......
...@@ -42,6 +42,9 @@ public class CustomAttachParser implements MsgAttachmentParser { ...@@ -42,6 +42,9 @@ public class CustomAttachParser implements MsgAttachmentParser {
case CustomAttachmentType.TYPE_PATIENT_CHECK_IN: case CustomAttachmentType.TYPE_PATIENT_CHECK_IN:
attachment = new CustomAttachmentPatientCheckIn(); attachment = new CustomAttachmentPatientCheckIn();
break; break;
case CustomAttachmentType.TYPE_PATIENT_MEDICINE_APPLY:
attachment = new CustomAttachmentPatientMedicineApply();
break;
default: default:
// attachment = new CustomAttachmentFilter(); // attachment = new CustomAttachmentFilter();
break; break;
......
package com.yidianling.im.session.extension
import com.alibaba.fastjson.JSON
import com.alibaba.fastjson.JSONObject
import com.yidianling.im.bean.MedicineItemBean
/**
* Created by Ykai on 2021/11/12.
*
* 患者报道消息解析器
*/
class CustomAttachmentPatientMedicineApply :
CustomAttachment(CustomAttachmentType.TYPE_PATIENT_MEDICINE_APPLY) {
private val TITLE = "title"
private val VISITAPPLYNO = "visitApplyNo"
private val MEDICINELIST = "medicineList"
var title: String? = null
var visitApplyNo: String? = null
var medicinelist = mutableListOf<MedicineItemBean>()
override fun parseData(data: JSONObject) {
title = data.getString(TITLE)
visitApplyNo = data.getString(VISITAPPLYNO)
medicinelist = JSON.parseArray(
data.getString(MEDICINELIST),
MedicineItemBean::class.java
) as MutableList<MedicineItemBean>
}
override fun packData(): JSONObject {
val data = JSONObject()
data[TITLE] = title
data[VISITAPPLYNO] = visitApplyNo
data[MEDICINELIST] = medicinelist
return data
}
}
\ No newline at end of file
...@@ -63,4 +63,5 @@ public interface CustomAttachmentType { ...@@ -63,4 +63,5 @@ public interface CustomAttachmentType {
int TYPE_RECIPE = 86;//处方单创建消息类型 int TYPE_RECIPE = 86;//处方单创建消息类型
int TYPE_PATIENT_FULL_INFO = 87; // 就诊患者完善信息 int TYPE_PATIENT_FULL_INFO = 87; // 就诊患者完善信息
int TYPE_PATIENT_CHECK_IN = 88; // 患者报到 int TYPE_PATIENT_CHECK_IN = 88; // 患者报到
int TYPE_PATIENT_MEDICINE_APPLY = 89; // 开药申请
} }
package com.yidianling.im.session.viewholder
import android.widget.TextView
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.base.config.HttpConfig.Companion.MEDICAL_H5URL
import com.yidianling.im.R
import com.yidianling.im.session.extension.CustomAttachmentPatientMedicineApply
import com.yidianling.im.session.viewholder.adapter.AdapterMedicineApply
import com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter
import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase
/**
* 就诊人提示补充信息ui
*/
class MsgViewHolderPatientMedicineApply(adapter: BaseMultiItemFetchLoadAdapter<*, *>?) :
MsgViewHolderBase(adapter) {
private lateinit var medicine_title: TextView
private lateinit var medicine_list: RecyclerView
private lateinit var itemBean: CustomAttachmentPatientMedicineApply
private lateinit var adapterMedicine: AdapterMedicineApply
override fun getContentResId(): Int {
return R.layout.im_nim_patient_medicine_apply_layout
}
override fun inflateContentView() {
medicine_title = findViewById(R.id.medicine_title)
medicine_list = findViewById(R.id.medicine_list)
}
override fun bindContentView() {
itemBean = message.attachment as CustomAttachmentPatientMedicineApply
medicine_title.text = itemBean.title
adapterMedicine = AdapterMedicineApply()
medicine_list.layoutManager = LinearLayoutManager(context)
medicine_list.adapter = adapterMedicine
if (itemBean.medicinelist.size > 2) {
itemBean.medicinelist?.let {
val subList = it.subList(0, 2)
adapterMedicine.setTagData(subList)
}
} else {
itemBean.medicinelist?.let { adapterMedicine.setTagData(it) }
}
}
override fun onItemClick() {
//跳转开药详情页面
val h5Params3 = H5Params(
MEDICAL_H5URL + "\n" +
"ct/drug/apply/details?visitApplyNo=${itemBean.visitApplyNo}&hideNavBar=1", null
)
NewH5Activity.start(context, h5Params3)
}
}
\ No newline at end of file
package com.yidianling.im.session.viewholder.adapter
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.yidianling.im.R
import com.yidianling.im.bean.MedicineItemBean
/**
* @author huozhiliang
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2020/9/7
*/
class AdapterMedicineApply : RecyclerView.Adapter<AdapterMedicineApply.ViewHolder>() {
private var medicineList: MutableList<MedicineItemBean>? = mutableListOf()
class ViewHolder(itemView: View) :
RecyclerView.ViewHolder(itemView) {
val medicine_name: TextView = itemView.findViewById(R.id.medicine_name)
val medicine_count: TextView = itemView.findViewById(R.id.medicine_count)
val medicine_spec: TextView = itemView.findViewById(R.id.medicine_spec)
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(
LayoutInflater.from(parent.context).inflate(
R.layout.im_message_item_medicine_apply,
parent,
false
)
)
}
override fun getItemCount(): Int {
return medicineList?.size ?: 0
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.medicine_name.text = medicineList?.get(position)?.medicineName
holder.medicine_spec.text = "规格:" + medicineList?.get(position)?.medicineSpec
holder.medicine_count.text = "x" + medicineList?.get(position)?.medicineApplyNumber
}
fun setTagData(data: MutableList<MedicineItemBean>) {
medicineList = data
notifyDataSetChanged()
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/white" />
<stroke
android:width="0.5dp"
android:color="#e7ecf0" />
<corners
android:bottomLeftRadius="8dp"
android:bottomRightRadius="8dp"
android:topLeftRadius="8dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/white" />
<stroke
android:width="0.5dp"
android:color="#e7ecf0" />
<corners android:topLeftRadius="8dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/platform_dp_12">
<TextView
android:id="@+id/medicine_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:textColor="@color/medical_color_0c1d31"
android:textSize="@dimen/platform_sp_16"
app:layout_constraintEnd_toStartOf="@id/medicine_count"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="复方醋酸地塞米松乳膏30g" />
<TextView
android:id="@+id/medicine_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#65758a"
android:textSize="@dimen/platform_sp_16"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="x3" />
<TextView
android:id="@+id/medicine_spec"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/platform_dp_6"
android:textColor="#65758a"
android:textSize="@dimen/im_text_size_13"
app:layout_constraintStart_toStartOf="@id/medicine_name"
app:layout_constraintTop_toBottomOf="@id/medicine_name"
tools:text="规格:0.5g*12片*3板/盒">
</TextView>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="255dp"
android:layout_height="wrap_content"
android:background="@drawable/shape_solid_white_stroke_e7ecf0_top">
<View
android:id="@+id/back_top"
android:layout_width="match_parent"
android:layout_height="45dp"
android:background="@drawable/shape_solid_white_stroke_e7ecf0_top2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/medicine_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/platform_dp_16"
android:textColor="@color/medical_color_007aef"
android:textSize="@dimen/im_text_size_17"
app:layout_constraintBottom_toBottomOf="@id/back_top"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:text="开wwwww药申请" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/medicine_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/platform_dp_16"
android:layout_marginTop="@dimen/platform_dp_16"
android:paddingEnd="@dimen/platform_dp_16"
app:layout_constraintTop_toBottomOf="@id/back_top"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:itemCount="2" />
<View
android:id="@+id/line_center"
android:layout_width="0dp"
android:layout_height="1px"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="12dp"
android:background="@color/medical_color_e7ecf0"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/medicine_list" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:layout_marginBottom="14dp"
android:background="@drawable/medical_bg_3464ec_14dp"
android:text="申请详情"
android:textColor="@color/medical_color_007aef"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="@id/line_center"
app:layout_constraintTop_toBottomOf="@id/line_center" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -71,4 +71,5 @@ ...@@ -71,4 +71,5 @@
<color name="medical_color_c0c9d4">#C0C9D4</color> <color name="medical_color_c0c9d4">#C0C9D4</color>
<color name="medical_color_e7ecf0">#E7ECF0</color> <color name="medical_color_e7ecf0">#E7ECF0</color>
<color name="medical_color_ff7766">#FF7766</color> <color name="medical_color_ff7766">#FF7766</color>
<color name="medical_color_007aef">#007aef</color>
</resources> </resources>
...@@ -143,12 +143,12 @@ dependencies { ...@@ -143,12 +143,12 @@ dependencies {
api rootProject.ext.dependencies["eventbus"] api rootProject.ext.dependencies["eventbus"]
api rootProject.ext.dependencies["umeng-common"] api rootProject.ext.dependencies["umeng-common"]
api rootProject.ext.dependencies["umeng-asms"] api rootProject.ext.dependencies["umeng-asms"]
// api rootProject.ext.dependencies["umeng-share-core"] api rootProject.ext.dependencies["umeng-share-core"]
// api rootProject.ext.dependencies["umeng-share-qq"] api rootProject.ext.dependencies["umeng-share-qq"]
api rootProject.ext.dependencies["umeng-share-wechat"] api rootProject.ext.dependencies["umeng-share-wechat"]
// api rootProject.ext.dependencies["umeng-shareboard"] api rootProject.ext.dependencies["umeng-shareboard"]
api rootProject.ext.dependencies["umeng-wx-guanfang"] api rootProject.ext.dependencies["umeng-wx-guanfang"]
// api rootProject.ext.dependencies["umeng-qq-guanfang"] api rootProject.ext.dependencies["umeng-qq-guanfang"]
api rootProject.ext.dependencies["stetho"] api rootProject.ext.dependencies["stetho"]
api rootProject.ext.dependencies["stetho-okhttp3"] api rootProject.ext.dependencies["stetho-okhttp3"]
api rootProject.ext.dependencies["bugly-crashreport"] api rootProject.ext.dependencies["bugly-crashreport"]
......
//package com.ydl.ydlcommon.actions.share package com.ydl.ydlcommon.actions.share
import android.app.Activity
import android.graphics.Bitmap
import android.text.TextUtils
import com.umeng.socialize.ShareAction
import com.umeng.socialize.UMShareListener
import com.umeng.socialize.bean.SHARE_MEDIA
import com.umeng.socialize.media.UMImage
import com.umeng.socialize.media.UMMin
import com.umeng.socialize.media.UMWeb
import com.umeng.socialize.shareboard.ShareBoardConfig
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.ydl.ydlcommon.view.dialog.CustomShareDialog
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.ToastUtil
/**
* 分享工具类
*/
object ShareUtils {
var platform: SHARE_MEDIA? = null
var callBack: ShareActionCallBack? = null
/**
* 直接分享到指定平台
* @param platform
*/
fun shareTo(
platform: SHARE_MEDIA?,
context: Activity,
share_title: String,
share_url: String,
share_context: String?,
share_head: String?
) {
LogUtil.d("shareTo")
val web = UMWeb(share_url)
web.title = share_title //标题
if (platform == SHARE_MEDIA.WEIXIN_CIRCLE) {
web.title = "$share_title\n$share_context"
}
web.setThumb(
UMImage(
context, share_head
?: "http://static.ydlcdn.com/v1/images/logo320.png"
)
) //缩略图
web.description = share_context//描述
ShareAction(context)
.setPlatform(platform)
.setCallback(object : UMShareListener {
override fun onStart(share_media: SHARE_MEDIA) {
LogUtil.e("ydl", "开始分享------")
}
override fun onResult(share_media: SHARE_MEDIA) {
LogUtil.e("ydl", "分享结束------")
callBack?.onShareSuccessed(share_media)
callBack = null
}
override fun onError(share_media: SHARE_MEDIA, throwable: Throwable) {
LogUtil.e("ydl", "分享出错------" + throwable.message)
try {
var message = handleMessage(throwable.message!!)
ToastUtil.toastShort("分享失败," + message)
} catch (e: Exception) {
ToastUtil.toastShort("分享错误")
}
callBack?.onShareFailed(share_media, throwable)
callBack = null
}
override fun onCancel(share_media: SHARE_MEDIA) {
LogUtil.e("ydl", "分享取消------")
}
})
.withMedia(web)
.share()
}
/**
* 分享纯图片到微信
*/
fun sharePicToWeiXin(context: Activity, bitmap: Bitmap?) {
if (bitmap == null) {
ToastUtil.toastShort("数据异常,请重试")
return
}
if (platform == null) {
ToastUtil.toastShort("分享异常,请重试")
return
}
val image = UMImage(context, bitmap)//bitmap文件
val thumb = UMImage(context, bitmap)
image.setThumb(thumb)
image.compressStyle = UMImage.CompressStyle.SCALE//大小压缩,默认为大小压缩,适合普通很大的图
image.compressStyle = UMImage.CompressStyle.QUALITY//质量压缩,适合长图的分享
ShareAction(context)
.setPlatform(platform)
.setCallback(object : UMShareListener {
override fun onStart(share_media: SHARE_MEDIA) {
LogUtil.e("ydl", "开始分享------")
}
override fun onResult(share_media: SHARE_MEDIA) {
LogUtil.e("ydl", "分享结束------")
callBack?.onShareSuccessed(share_media)
callBack = null
}
override fun onError(share_media: SHARE_MEDIA, throwable: Throwable) {
LogUtil.e("ydl", "分享出错------" + throwable.message)
try {
var message = handleMessage(throwable.message!!)
ToastUtil.toastShort("分享失败," + message)
} catch (e: Exception) {
ToastUtil.toastShort("分享错误")
}
callBack?.onShareFailed(share_media, throwable)
callBack = null
}
override fun onCancel(share_media: SHARE_MEDIA) {
LogUtil.e("ydl", "分享取消------")
}
})
.withMedia(image)
.share()
}
/**
* 分享小程序类型
*/
fun shareSmailWeixin(
context: Activity,
share_title: String,
share_url: String,
share_context: String?,
image: String?,
path: String?,
id: String?,
shareListener: UMShareListener?
) {
val umMin = UMMin(share_url) //兼容低版本的网页链接
val img = UMImage(context, image)
img.compressStyle = UMImage.CompressStyle.SCALE
umMin.setThumb(img) // 小程序消息封面图片
umMin.title = share_title // 小程序消息title
umMin.description = share_context // 小程序消息描述
umMin.path = path //小程序页面路径
umMin.userName = id // 小程序原始id,在微信平台查询
ShareAction(context)
.withMedia(umMin)
.setPlatform(SHARE_MEDIA.WEIXIN)
.setCallback(shareListener)
.share()
}
/**
* 自定义分享弹出框
* author harvie
* @param activity
* @param actions 扩展按钮
* @param share_title
* @param share_url
* @param share_context
* @param share_head
*/
fun share(
activity: Activity,
share_title: String?,
share_url: String?,
share_context: String?,
share_head: String?,
actions: List<ShareMoreBean>
) {
var content = share_context
var image = share_head
if (share_title == null || share_url == null) {
ToastHelper.show("缺少分享参数")
return
}
if (TextUtils.isEmpty(share_head)) {
image = "http://static.ydlcdn.com/v1/images/logo320.png"
}
if (TextUtils.isEmpty(content)) content = share_title
val dialog = CustomShareDialog(activity)
dialog.setShareBody(share_title, share_url, content ?: "", image!!)
dialog.addActions(actions)
dialog.show()
}
/**
* 友盟自带分享弹框
*/
fun share(
activity: Activity,
share_title: String?,
share_url: String?,
share_context: String?,
share_head: String?
) {
LogUtil.d("share")
var content = share_context
var image = share_head
if (share_title == null || share_url == null) {
ToastHelper.show("缺少分享参数")
return
}
if (share_head == null || share_head == "") {
image = "http://static.ydlcdn.com/v1/images/logo320.png"
}
if (TextUtils.isEmpty(content)) content = share_title
val web = UMWeb(share_url)
web.title = share_title//标题
web.setThumb(UMImage(activity, image)) //缩略图
web.description = content//描述
val config = ShareBoardConfig()
config.setIndicatorVisibility(false)
if (activity.packageName.endsWith("yidianling_atk9")) {
ShareAction(activity).withMedia(web)
.setDisplayList(SHARE_MEDIA.QQ, SHARE_MEDIA.QZONE)
.setCallback(object : UMShareListener {
override fun onStart(share_media: SHARE_MEDIA) {
LogUtil.e("ydl", "开始分享------")
}
override fun onResult(share_media: SHARE_MEDIA) {
LogUtil.e("ydl", "分享结束------")
}
override fun onError(share_media: SHARE_MEDIA, throwable: Throwable) {
LogUtil.e("ydl", "分享出错------" + throwable.message)
try {
var message = handleMessage(throwable.message!!)
ToastUtil.toastShort("分享失败," + message)
} catch (e: Exception) {
ToastUtil.toastShort("分享错误")
}
}
override fun onCancel(share_media: SHARE_MEDIA) {
LogUtil.e("ydl", "分享取消------")
}
})
.open(config)
} else {
ShareAction(activity).withMedia(web)
.setDisplayList(
SHARE_MEDIA.WEIXIN,
SHARE_MEDIA.WEIXIN_CIRCLE,
SHARE_MEDIA.QQ,
SHARE_MEDIA.QZONE
)
.setCallback(object : UMShareListener {
override fun onStart(share_media: SHARE_MEDIA) {
LogUtil.e("ydl", "开始分享------")
}
override fun onResult(share_media: SHARE_MEDIA) {
LogUtil.e("ydl", "分享结束------")
callBack?.onShareSuccessed(share_media)
callBack = null
}
override fun onError(share_media: SHARE_MEDIA, throwable: Throwable) {
LogUtil.e("ydl", "分享出错------" + throwable.message)
try {
var message = handleMessage(throwable.message!!)
ToastUtil.toastShort("分享失败," + message)
} catch (e: Exception) {
ToastUtil.toastShort("分享错误")
}
callBack?.onShareFailed(share_media, throwable)
callBack = null
}
override fun onCancel(share_media: SHARE_MEDIA) {
LogUtil.e("ydl", "分享取消------")
}
})
.open(config)
}
}
/**
* 强制处理分享失败消息
*/
fun handleMessage(msg: String): String {
var index = msg.indexOf("错误信息")
var message = msg.substring(index, msg!!.length)
var lastIndex = message.indexOf(" ")
message = message.substring(0, lastIndex)
return message
}
}
// //
//import android.app.Activity /**
//import android.graphics.Bitmap *
//import android.text.TextUtils */
//import com.umeng.socialize.ShareAction class ShareMoreBean(
//import com.umeng.socialize.UMShareListener var imageResId: Int, var actionName: String, //扩展按钮动作
//import com.umeng.socialize.bean.SHARE_MEDIA var shareMoreAction: ShareMoreAction?
//import com.umeng.socialize.media.UMImage )
//import com.umeng.socialize.media.UMMin
//import com.umeng.socialize.media.UMWeb //分享动作
//import com.umeng.socialize.shareboard.ShareBoardConfig interface ShareMoreAction {
//import com.ydl.ydlcommon.utils.remind.ToastHelper fun onClick()
//import com.ydl.ydlcommon.view.dialog.CustomShareDialog }
//import com.yidianling.common.tools.LogUtil
//import com.yidianling.common.tools.ToastUtil interface ShareActionCallBack {
///** fun onShareSuccessed(share_media: SHARE_MEDIA)
// * 分享工具类 fun onShareFailed(share_media: SHARE_MEDIA, throwable: Throwable)
// */ }
//
//object ShareUtils {
//
// var platform: SHARE_MEDIA? = null
//
// var callBack: ShareActionCallBack? = null
//
// /**
// * 直接分享到指定平台
// * @param platform
// */
// fun shareTo(platform: SHARE_MEDIA?, context: Activity, share_title: String, share_url: String, share_context: String?, share_head: String?) {
// LogUtil.d("shareTo")
// val web = UMWeb(share_url)
// web.title = share_title //标题
// if (platform == SHARE_MEDIA.WEIXIN_CIRCLE) {
// web.title = "$share_title\n$share_context"
// }
// web.setThumb(UMImage(context, share_head
// ?: "http://static.ydlcdn.com/v1/images/logo320.png")) //缩略图
// web.description = share_context//描述
// ShareAction(context)
// .setPlatform(platform)
// .setCallback(object : UMShareListener {
// override fun onStart(share_media: SHARE_MEDIA) {
// LogUtil.e("ydl", "开始分享------")
// }
//
// override fun onResult(share_media: SHARE_MEDIA) {
// LogUtil.e("ydl", "分享结束------")
// callBack?.onShareSuccessed(share_media)
// callBack = null
// }
//
// override fun onError(share_media: SHARE_MEDIA, throwable: Throwable) {
// LogUtil.e("ydl", "分享出错------" + throwable.message)
// try {
// var message = handleMessage(throwable.message!!)
// ToastUtil.toastShort("分享失败," + message)
// } catch (e: Exception) {
// ToastUtil.toastShort("分享错误")
// }
// callBack?.onShareFailed(share_media, throwable)
// callBack = null
// }
//
// override fun onCancel(share_media: SHARE_MEDIA) {
// LogUtil.e("ydl", "分享取消------")
// }
// })
// .withMedia(web)
// .share()
// }
//
// /**
// * 分享纯图片到微信
// */
// fun sharePicToWeiXin(context: Activity, bitmap: Bitmap?) {
// if (bitmap == null) {
// ToastUtil.toastShort("数据异常,请重试")
// return
// }
// if (platform == null) {
// ToastUtil.toastShort("分享异常,请重试")
// return
// }
// val image = UMImage(context, bitmap)//bitmap文件
//
// val thumb = UMImage(context, bitmap)
// image.setThumb(thumb)
//
// image.compressStyle = UMImage.CompressStyle.SCALE//大小压缩,默认为大小压缩,适合普通很大的图
// image.compressStyle = UMImage.CompressStyle.QUALITY//质量压缩,适合长图的分享
// ShareAction(context)
// .setPlatform(platform)
// .setCallback(object : UMShareListener {
// override fun onStart(share_media: SHARE_MEDIA) {
// LogUtil.e("ydl", "开始分享------")
// }
//
// override fun onResult(share_media: SHARE_MEDIA) {
// LogUtil.e("ydl", "分享结束------")
// callBack?.onShareSuccessed(share_media)
// callBack = null
// }
//
// override fun onError(share_media: SHARE_MEDIA, throwable: Throwable) {
// LogUtil.e("ydl", "分享出错------" + throwable.message)
// try {
// var message = handleMessage(throwable.message!!)
// ToastUtil.toastShort("分享失败," + message)
// } catch (e: Exception) {
// ToastUtil.toastShort("分享错误")
// }
// callBack?.onShareFailed(share_media, throwable)
// callBack = null
// }
//
// override fun onCancel(share_media: SHARE_MEDIA) {
// LogUtil.e("ydl", "分享取消------")
// }
// })
// .withMedia(image)
// .share()
// }
//
// /**
// * 分享小程序类型
// */
// fun shareSmailWeixin(context: Activity, share_title: String, share_url: String, share_context: String?, image: String?, path: String?, id: String?, shareListener: UMShareListener?) {
// val umMin = UMMin(share_url) //兼容低版本的网页链接
// val img = UMImage(context, image)
// img.compressStyle = UMImage.CompressStyle.SCALE
// umMin.setThumb(img) // 小程序消息封面图片
// umMin.title = share_title // 小程序消息title
// umMin.description = share_context // 小程序消息描述
// umMin.path = path //小程序页面路径
// umMin.userName = id // 小程序原始id,在微信平台查询
// ShareAction(context)
// .withMedia(umMin)
// .setPlatform(SHARE_MEDIA.WEIXIN)
// .setCallback(shareListener)
// .share()
// }
//
// /**
// * 自定义分享弹出框
// * author harvie
// * @param activity
// * @param actions 扩展按钮
// * @param share_title
// * @param share_url
// * @param share_context
// * @param share_head
// */
// fun share(activity: Activity, share_title: String?, share_url: String?, share_context: String?, share_head: String?, actions: List<ShareMoreBean>) {
// var content = share_context
// var image = share_head
// if (share_title == null || share_url == null) {
// ToastHelper.show("缺少分享参数")
// return
// }
// if (TextUtils.isEmpty(share_head)) {
// image = "http://static.ydlcdn.com/v1/images/logo320.png"
// }
// if (TextUtils.isEmpty(content)) content = share_title
// val dialog = CustomShareDialog(activity)
// dialog.setShareBody(share_title, share_url, content ?: "", image!!)
// dialog.addActions(actions)
// dialog.show()
//
// }
//
// /**
// * 友盟自带分享弹框
// */
// fun share(activity: Activity, share_title: String?, share_url: String?, share_context: String?, share_head: String?) {
// LogUtil.d("share")
// var content = share_context
// var image = share_head
// if (share_title == null || share_url == null) {
// ToastHelper.show("缺少分享参数")
// return
// }
// if (share_head == null || share_head == "") {
// image = "http://static.ydlcdn.com/v1/images/logo320.png"
// }
// if (TextUtils.isEmpty(content)) content = share_title
//
// val web = UMWeb(share_url)
// web.title = share_title//标题
// web.setThumb(UMImage(activity, image)) //缩略图
// web.description = content//描述
// val config = ShareBoardConfig()
// config.setIndicatorVisibility(false)
// if (activity.packageName.endsWith("yidianling_atk9")) {
// ShareAction(activity).withMedia(web)
// .setDisplayList(SHARE_MEDIA.QQ, SHARE_MEDIA.QZONE)
// .setCallback(object : UMShareListener {
// override fun onStart(share_media: SHARE_MEDIA) {
// LogUtil.e("ydl", "开始分享------")
// }
//
// override fun onResult(share_media: SHARE_MEDIA) {
// LogUtil.e("ydl", "分享结束------")
// }
//
// override fun onError(share_media: SHARE_MEDIA, throwable: Throwable) {
// LogUtil.e("ydl", "分享出错------" + throwable.message)
// try {
// var message = handleMessage(throwable.message!!)
// ToastUtil.toastShort("分享失败," + message)
// } catch (e: Exception) {
// ToastUtil.toastShort("分享错误")
// }
// }
//
// override fun onCancel(share_media: SHARE_MEDIA) {
// LogUtil.e("ydl", "分享取消------")
// }
// })
// .open(config)
// } else {
// ShareAction(activity).withMedia(web)
// .setDisplayList(SHARE_MEDIA.WEIXIN, SHARE_MEDIA.WEIXIN_CIRCLE, SHARE_MEDIA.QQ, SHARE_MEDIA.QZONE)
// .setCallback(object : UMShareListener {
// override fun onStart(share_media: SHARE_MEDIA) {
// LogUtil.e("ydl", "开始分享------")
// }
//
// override fun onResult(share_media: SHARE_MEDIA) {
// LogUtil.e("ydl", "分享结束------")
// callBack?.onShareSuccessed(share_media)
// callBack = null
// }
//
// override fun onError(share_media: SHARE_MEDIA, throwable: Throwable) {
// LogUtil.e("ydl", "分享出错------" + throwable.message)
// try {
// var message = handleMessage(throwable.message!!)
// ToastUtil.toastShort("分享失败," + message)
// } catch (e: Exception) {
// ToastUtil.toastShort("分享错误")
// }
// callBack?.onShareFailed(share_media, throwable)
// callBack = null
// }
//
// override fun onCancel(share_media: SHARE_MEDIA) {
// LogUtil.e("ydl", "分享取消------")
// }
// })
// .open(config)
// }
//
// }
//
//
// /**
// * 强制处理分享失败消息
// */
// fun handleMessage(msg: String): String {
// var index = msg.indexOf("错误信息")
// var message = msg.substring(index, msg!!.length)
// var lastIndex = message.indexOf(" ")
// message = message.substring(0, lastIndex)
// return message
// }
//}
//
////
///**
// *
// */
//class ShareMoreBean(var imageResId: Int, var actionName: String, //扩展按钮动作
// var shareMoreAction: ShareMoreAction?)
//
////分享动作
//interface ShareMoreAction {
// fun onClick()
//}
//
//interface ShareActionCallBack {
// fun onShareSuccessed(share_media: SHARE_MEDIA)
// fun onShareFailed(share_media: SHARE_MEDIA, throwable: Throwable)
//}
...@@ -50,7 +50,7 @@ class ActionCountUtils { ...@@ -50,7 +50,7 @@ class ActionCountUtils {
appName = name appName = name
// 获取oaid // 获取oaid
UMConfigure.getOaid(BaseApp.instance) { UMConfigure.getOaid(BaseApp.instance) {
oaId = it it?.let { oaId = it }
} }
} }
......
//package com.ydl.ydlcommon.view.dialog package com.ydl.ydlcommon.view.dialog
//
//import android.app.Activity import android.app.Activity
//import android.app.Dialog import android.app.Dialog
//import android.os.Bundle import android.os.Bundle
//import android.view.View import android.view.View
//import android.view.ViewGroup import android.view.ViewGroup
//import android.widget.AdapterView import android.widget.AdapterView
//import android.widget.ImageView import android.widget.ImageView
//import com.umeng.socialize.bean.SHARE_MEDIA import com.umeng.socialize.bean.SHARE_MEDIA
//import com.ydl.ydlcommon.R import com.ydl.ydlcommon.R
//import com.ydl.ydlcommon.actions.share.ShareMoreBean import com.ydl.ydlcommon.actions.share.ShareMoreBean
//import com.ydl.ydlcommon.actions.share.ShareUtils import com.ydl.ydlcommon.actions.share.ShareUtils
//import com.ydl.ydlcommon.adapter.CommonAdapter import com.ydl.ydlcommon.adapter.CommonAdapter
//import com.ydl.ydlcommon.view.BaseViewHolder import com.ydl.ydlcommon.view.BaseViewHolder
//import kotlinx.android.synthetic.main.platform_share_custom_ui.* import kotlinx.android.synthetic.main.platform_share_custom_ui.*
//
///** /**
// * 自定义分享Dialog * 自定义分享Dialog
// * Created by hgw on 2017/3/22. * Created by hgw on 2017/3/22.
// */ */
//
//class CustomShareDialog(private val context: Activity) : Dialog(context, R.style.platform_transparentFrameWindowStyle), View.OnClickListener { class CustomShareDialog(private val context: Activity) :
// Dialog(context, R.style.platform_transparentFrameWindowStyle), View.OnClickListener {
//
// private var share_title: String? = null
// private var share_url: String? = null private var share_title: String? = null
// private var share_context: String? = null private var share_url: String? = null
// private var share_head: String? = null private var share_context: String? = null
// private var list: List<ShareMoreBean>? = null private var share_head: String? = null
// private var list: List<ShareMoreBean>? = null
// private var adapter: CommonAdapter<ShareMoreBean>? = null
// private var adapter: CommonAdapter<ShareMoreBean>? = null
// override fun onCreate(savedInstanceState: Bundle?) {
// super.onCreate(savedInstanceState) override fun onCreate(savedInstanceState: Bundle?) {
// setContentView(R.layout.platform_share_custom_ui) super.onCreate(savedInstanceState)
// setContentView(R.layout.platform_share_custom_ui)
// initView()
// initView()
// val window = window
// // 设置显示动画 val window = window
// window!!.setWindowAnimations(R.style.platform_main_menu_animstyle) // 设置显示动画
// val wl = window.attributes window!!.setWindowAnimations(R.style.platform_main_menu_animstyle)
// wl.x = 0 val wl = window.attributes
// wl.y = context.windowManager.defaultDisplay.height wl.x = 0
// // 以下这两句是为了保证按钮可以水平满屏 wl.y = context.windowManager.defaultDisplay.height
// wl.width = ViewGroup.LayoutParams.MATCH_PARENT // 以下这两句是为了保证按钮可以水平满屏
// wl.height = ViewGroup.LayoutParams.WRAP_CONTENT wl.width = ViewGroup.LayoutParams.MATCH_PARENT
// wl.height = ViewGroup.LayoutParams.WRAP_CONTENT
// // 设置显示位置
// onWindowAttributesChanged(wl) // 设置显示位置
// // 设置点击外围解散 onWindowAttributesChanged(wl)
// setCanceledOnTouchOutside(true) // 设置点击外围解散
// } setCanceledOnTouchOutside(true)
// }
// private fun initView() {
// private fun initView() {
// share_weichat.setOnClickListener(this)
// share_pyq.setOnClickListener(this) share_weichat.setOnClickListener(this)
// share_qqzone.setOnClickListener(this) share_pyq.setOnClickListener(this)
// share_qq.setOnClickListener(this) share_qqzone.setOnClickListener(this)
// share_qq.setOnClickListener(this)
//
// if (list == null || list!!.isEmpty()) {
// grid_view!!.visibility = View.GONE if (list == null || list!!.isEmpty()) {
// return grid_view!!.visibility = View.GONE
// } else { return
// grid_view!!.visibility = View.VISIBLE } else {
// } grid_view!!.visibility = View.VISIBLE
// adapter = object : CommonAdapter<ShareMoreBean>() { }
// override fun getView(position: Int, convertView1: View?, parent: ViewGroup): View { adapter = object : CommonAdapter<ShareMoreBean>() {
// var convertView = convertView1 override fun getView(position: Int, convertView1: View?, parent: ViewGroup): View {
// val holder: BaseViewHolder var convertView = convertView1
// if (convertView == null) { val holder: BaseViewHolder
// convertView = layoutInflater.inflate(R.layout.platform_item_custom_share_ui, null) if (convertView == null) {
// holder = BaseViewHolder(convertView) convertView =
// convertView!!.tag = holder layoutInflater.inflate(R.layout.platform_item_custom_share_ui, null)
// } else { holder = BaseViewHolder(convertView)
// holder = convertView.tag as BaseViewHolder convertView!!.tag = holder
// } } else {
// val imageView = holder.getView<ImageView>(R.id.share_img) holder = convertView.tag as BaseViewHolder
// //加载图标 }
// imageView.setImageResource(mDataList[position].imageResId) val imageView = holder.getView<ImageView>(R.id.share_img)
// //设置title //加载图标
// holder.setText(R.id.text_title, mDataList[position].actionName) imageView.setImageResource(mDataList[position].imageResId)
// return convertView //设置title
// } holder.setText(R.id.text_title, mDataList[position].actionName)
// } return convertView
// grid_view!!.adapter = adapter }
// grid_view!!.onItemClickListener = AdapterView.OnItemClickListener { _, _, position, _ -> }
// val action = adapter!!.dataList[position].shareMoreAction grid_view!!.adapter = adapter
// action?.onClick() grid_view!!.onItemClickListener = AdapterView.OnItemClickListener { _, _, position, _ ->
// dismiss() val action = adapter!!.dataList[position].shareMoreAction
// } action?.onClick()
// adapter!!.update(list) dismiss()
// } }
// adapter!!.update(list)
// //设置分享内容 }
// fun setShareBody(share_title: String, share_url: String, share_context: String, share_head: String) {
// this.share_title = share_title //设置分享内容
// this.share_url = share_url fun setShareBody(
// this.share_context = share_context share_title: String,
// this.share_head = share_head share_url: String,
// } share_context: String,
// share_head: String
// //添加扩展按钮 ) {
// fun addActions(list1: List<ShareMoreBean>) { this.share_title = share_title
// this.list = list1 this.share_url = share_url
// } this.share_context = share_context
// this.share_head = share_head
// override fun onClick(v: View) { }
// when (v.id) {
// R.id.share_weichat -> { //添加扩展按钮
// ShareUtils.shareTo(SHARE_MEDIA.WEIXIN, context, share_title!!, share_url!!, share_context!!, share_head) fun addActions(list1: List<ShareMoreBean>) {
// dismiss() this.list = list1
// } }
// R.id.share_pyq -> {
// ShareUtils.shareTo(SHARE_MEDIA.WEIXIN_CIRCLE, context, share_title!!, share_url!!, share_context!!, share_head) override fun onClick(v: View) {
// dismiss() when (v.id) {
// } R.id.share_weichat -> {
// R.id.share_qq -> { ShareUtils.shareTo(
// ShareUtils.shareTo(SHARE_MEDIA.QQ, context, share_title!!, share_url!!, share_context!!, share_head) SHARE_MEDIA.WEIXIN,
// dismiss() context,
// } share_title!!,
// R.id.share_qqzone -> { share_url!!,
// ShareUtils.shareTo(SHARE_MEDIA.QZONE, context, share_title!!, share_url!!, share_context!!, share_head) share_context!!,
// dismiss() share_head
// } )
// } dismiss()
// } }
// R.id.share_pyq -> {
// override fun show() { ShareUtils.shareTo(
// if (null == context) { SHARE_MEDIA.WEIXIN_CIRCLE,
// return context,
// } share_title!!,
// if (context is Activity) { share_url!!,
// if (context.isFinishing) { share_context!!,
// return share_head
// } )
// } dismiss()
// super.show() }
// } R.id.share_qq -> {
//} ShareUtils.shareTo(
// SHARE_MEDIA.QQ,
context,
share_title!!,
share_url!!,
share_context!!,
share_head
)
dismiss()
}
R.id.share_qqzone -> {
ShareUtils.shareTo(
SHARE_MEDIA.QZONE,
context,
share_title!!,
share_url!!,
share_context!!,
share_head
)
dismiss()
}
}
}
override fun show() {
if (null == context) {
return
}
if (context is Activity) {
if (context.isFinishing) {
return
}
}
super.show()
}
}
//package com.ydl.ydlcommon.view.dialog package com.ydl.ydlcommon.view.dialog
//
//import android.annotation.SuppressLint import android.annotation.SuppressLint
//import android.app.Activity import android.app.Activity
//import android.app.DialogFragment import android.app.DialogFragment
//import android.graphics.drawable.ColorDrawable import android.graphics.drawable.ColorDrawable
//import android.os.Bundle import android.os.Bundle
//import android.text.TextUtils import android.text.TextUtils
//import android.util.Base64 import android.util.Base64
//import android.view.* import android.view.*
//import android.widget.LinearLayout import android.widget.LinearLayout
//import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
//import com.umeng.socialize.bean.SHARE_MEDIA import com.umeng.socialize.bean.SHARE_MEDIA
//import com.ydl.ydl_image.module.GlideApp import com.ydl.ydl_image.module.GlideApp
//import com.ydl.ydlcommon.R import com.ydl.ydlcommon.R
//import com.ydl.ydlcommon.actions.share.ShareActionCallBack import com.ydl.ydlcommon.actions.share.ShareActionCallBack
//import com.ydl.ydlcommon.actions.share.ShareUtils import com.ydl.ydlcommon.actions.share.ShareUtils
//import com.ydl.ydlcommon.utils.ImageUtil import com.ydl.ydlcommon.utils.ImageUtil
//import com.ydl.ydlcommon.utils.ScreenUtil import com.ydl.ydlcommon.utils.ScreenUtil
//import com.yidianling.common.tools.RxImageTool import com.yidianling.common.tools.RxImageTool
//import kotlinx.android.synthetic.main.platform_dialog_share.* import kotlinx.android.synthetic.main.platform_dialog_share.*
//import java.util.concurrent.Executors import java.util.concurrent.Executors
//
//
///** /**
// * @author yuanWai * @author yuanWai
// * @描述:分享弹窗 * @描述:分享弹窗
// * @Copyright Copyright (c) 2018 * @Copyright Copyright (c) 2018
// * @Company 壹点灵 * @Company 壹点灵
// * @date 2019/2/19 * @date 2019/2/19
// */ */
//class YDLShareDialog : DialogFragment { class YDLShareDialog : DialogFragment {
//
// private var mActivity: Activity? = null private var mActivity: Activity? = null
// private var shareTitle: String? = null private var shareTitle: String? = null
// private var shareUrl: String? = null private var shareUrl: String? = null
// private var shareContent: String? = null private var shareContent: String? = null
// private var base64DataStr: String? = null private var base64DataStr: String? = null
// private var shareHead: String? = null private var shareHead: String? = null
// private var mCallback: ICallBack? = null private var mCallback: ICallBack? = null
// private var mShareCallBack: IShareCallBack? = null private var mShareCallBack: IShareCallBack? = null
//
// //小程序页面地址 //小程序页面地址
// private var path: String? = null private var path: String? = null
// //小程序id
// private var minProgramId: String? = null //小程序id
// private var minProgramId: String? = null
// private var dp55 = 0
// private var dp7 = 0 private var dp55 = 0
// private var llmargin = 0 private var dp7 = 0
// private var llmargin = 0
// @SuppressLint("ValidFragment")
// constructor(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?) : super() { @SuppressLint("ValidFragment")
// this.mActivity = activity constructor(
// this.shareTitle = shareTitle activity: Activity,
// this.shareUrl = shareUrl shareTitle: String?,
// this.shareContent = shareContent shareUrl: String?,
// this.shareHead = shareHead shareContent: String?,
// } shareHead: String?
// ) : super() {
// //传递小程序参数 this.mActivity = activity
// @SuppressLint("ValidFragment") this.shareTitle = shareTitle
// constructor(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?, path: String?, minProgramId: String?) : super() { this.shareUrl = shareUrl
// this.mActivity = activity this.shareContent = shareContent
// this.shareTitle = shareTitle this.shareHead = shareHead
// this.shareUrl = shareUrl }
// this.shareContent = shareContent
// this.shareHead = shareHead //传递小程序参数
// this.path = path @SuppressLint("ValidFragment")
// this.minProgramId = minProgramId constructor(
// } activity: Activity,
// shareTitle: String?,
// constructor() : super() {} shareUrl: String?,
// shareContent: String?,
// init { shareHead: String?,
// dp55 = RxImageTool.dip2px(55f) path: String?,
// llmargin = (ScreenUtil.screenWidth - RxImageTool.dip2px(260f)) / 3 minProgramId: String?
// dp7 = RxImageTool.dip2px(7.5f) ) : super() {
// } this.mActivity = activity
// this.shareTitle = shareTitle
// companion object { this.shareUrl = shareUrl
// var typeStyle: Int = 0 this.shareContent = shareContent
// /** this.shareHead = shareHead
// * 1.为显示1排(5个) 2.为显示2排(隐藏动态和举报)3.为显示2排(隐藏动态和删除) 4.为显示1排(4个)隐藏动态按钮 5:生成海报按钮、隐藏动态 6:保存海报按钮、隐藏动态 7.为显示1排(4个)隐藏动态按钮 this.path = path
// */ this.minProgramId = minProgramId
// const val TYPE1 = 1 }
// const val TYPE2 = 2
// const val TYPE3 = 3 constructor() : super() {}
// const val TYPE4 = 4
// const val TYPE5 = 5 init {
// const val TYPE6 = 6 dp55 = RxImageTool.dip2px(55f)
// const val TYPE7 = 7 llmargin = (ScreenUtil.screenWidth - RxImageTool.dip2px(260f)) / 3
// /** dp7 = RxImageTool.dip2px(7.5f)
// * 点击事件类型 1.动态 2.删除 3.举报 4.返回首页 5:生成海报 6:保存本地 7:分享纯图片 }
// */
// const val CLICK_DYNAMIC = 1 companion object {
// const val CLICK_DELETE = 2 var typeStyle: Int = 0
// const val CLICK_REPORT = 3
// const val CLICK_BACKHOME = 4 /**
// const val CLICK_POSTER = 5 * 1.为显示1排(5个) 2.为显示2排(隐藏动态和举报)3.为显示2排(隐藏动态和删除) 4.为显示1排(4个)隐藏动态按钮 5:生成海报按钮、隐藏动态 6:保存海报按钮、隐藏动态 7.为显示1排(4个)隐藏动态按钮
// const val CLICK_SAVE = 6 */
// const val CLICK_SHARE_IMAGE = 7 const val TYPE1 = 1
// const val TYPE2 = 2
// fun style1(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?): YDLShareDialog { const val TYPE3 = 3
// typeStyle = TYPE1 const val TYPE4 = 4
// return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead) const val TYPE5 = 5
// } const val TYPE6 = 6
// const val TYPE7 = 7
// //支持分享小程序
// fun style1(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?, minProgramPath: String? = "", minProgramId: String? = ""): YDLShareDialog { /**
// typeStyle = TYPE1 * 点击事件类型 1.动态 2.删除 3.举报 4.返回首页 5:生成海报 6:保存本地 7:分享纯图片
// return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead, minProgramPath, minProgramId) */
// } const val CLICK_DYNAMIC = 1
// const val CLICK_DELETE = 2
// fun style2(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?): YDLShareDialog { const val CLICK_REPORT = 3
// typeStyle = TYPE2 const val CLICK_BACKHOME = 4
// return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead) const val CLICK_POSTER = 5
// } const val CLICK_SAVE = 6
// const val CLICK_SHARE_IMAGE = 7
// fun style3(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?): YDLShareDialog {
// typeStyle = TYPE3 fun style1(
// return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead) activity: Activity,
// } shareTitle: String?,
// shareUrl: String?,
// fun style4(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?): YDLShareDialog { shareContent: String?,
// typeStyle = TYPE4 shareHead: String?
// return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead) ): YDLShareDialog {
// } typeStyle = TYPE1
// return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
// fun style5(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?): YDLShareDialog { }
// typeStyle = TYPE5
// return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead) //支持分享小程序
// } fun style1(
// activity: Activity,
// fun style6(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?): YDLShareDialog { shareTitle: String?,
// typeStyle = TYPE6 shareUrl: String?,
// return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead) shareContent: String?,
// } shareHead: String?,
// minProgramPath: String? = "",
// //支持分享小程序 minProgramId: String? = ""
// fun style7(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?, minProgramPath: String? = "", minProgramId: String? = ""): YDLShareDialog { ): YDLShareDialog {
// typeStyle = TYPE7 typeStyle = TYPE1
// return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead, minProgramPath, minProgramId) return YDLShareDialog(
// } activity,
// } shareTitle,
// shareUrl,
// override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View { shareContent,
// //去掉dialog的标题,需要在setContentView()之前 shareHead,
// this.dialog.requestWindowFeature(Window.FEATURE_NO_TITLE) minProgramPath,
// val window = this.dialog.window minProgramId
// //去掉dialog默认的padding )
// window!!.decorView.setPadding(0, 0, 0, 0) }
// val lp = window.attributes
// lp.width = WindowManager.LayoutParams.MATCH_PARENT fun style2(
// lp.height = WindowManager.LayoutParams.WRAP_CONTENT activity: Activity,
// //设置dialog的位置在底部 shareTitle: String?,
// lp.gravity = Gravity.BOTTOM shareUrl: String?,
// //设置dialog的动画 shareContent: String?,
// lp.windowAnimations = R.style.platform_BottomDialogAnimation shareHead: String?
// window.attributes = lp ): YDLShareDialog {
// window.setBackgroundDrawable(ColorDrawable()) typeStyle = TYPE2
// return inflater!!.inflate(R.layout.platform_dialog_share, null) return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
// } }
//
// fun style3(
// /** activity: Activity,
// * 设置咨询师海报的图片 shareTitle: String?,
// * @param base64DataStr base64数据 shareUrl: String?,
// */ shareContent: String?,
// fun setPosterPicture(base64DataStr: String) { shareHead: String?
// this.base64DataStr = base64DataStr ): YDLShareDialog {
// } typeStyle = TYPE3
// return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
// override fun onResume() { }
// super.onResume()
// initView() fun style4(
// initParams() activity: Activity,
// } shareTitle: String?,
// shareUrl: String?,
// /** shareContent: String?,
// * 初始化样式 shareHead: String?
// */ ): YDLShareDialog {
// private fun initParams() { typeStyle = TYPE4
// when (typeStyle) { return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
// TYPE1 -> { }
// //样式1
// ll_layout2.visibility = View.GONE fun style5(
// } activity: Activity,
// TYPE2 -> { shareTitle: String?,
// //样式2 shareUrl: String?,
// ll_dynamic.visibility = View.GONE shareContent: String?,
// ll_report.visibility = View.GONE shareHead: String?
// setStyle() ): YDLShareDialog {
// val deleteParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT) typeStyle = TYPE5
// deleteParams.setMargins(dp7, 0, llmargin, 0) return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
// deleteParams.weight = 0f }
// ll_delete.layoutParams = deleteParams
// } fun style6(
// TYPE3 -> { activity: Activity,
// //样式3 shareTitle: String?,
// ll_dynamic.visibility = View.GONE shareUrl: String?,
// ll_delete.visibility = View.GONE shareContent: String?,
// setStyle() shareHead: String?
// val reportParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT) ): YDLShareDialog {
// reportParams.setMargins(dp7, 0, llmargin, 0) typeStyle = TYPE6
// reportParams.weight = 0f return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
// ll_report.layoutParams = reportParams }
// }
// TYPE4 -> { //支持分享小程序
// //样式4 fun style7(
// ll_dynamic.visibility = View.GONE activity: Activity,
// ll_layout2.visibility = View.GONE shareTitle: String?,
// setStyle() shareUrl: String?,
// } shareContent: String?,
// TYPE5 -> { shareHead: String?,
// //样式5 minProgramPath: String? = "",
// ll_dynamic.visibility = View.GONE minProgramId: String? = ""
// ll_poster.visibility = View.VISIBLE ): YDLShareDialog {
// ll_layout2.visibility = View.GONE typeStyle = TYPE7
// } return YDLShareDialog(
// TYPE6 -> { activity,
// //样式6 shareTitle,
// ll_dynamic.visibility = View.GONE shareUrl,
// ll_save.visibility = View.VISIBLE shareContent,
// ll_layout2.visibility = View.GONE shareHead,
// } minProgramPath,
// TYPE7 -> { minProgramId
// //样式7 )
// ll_layout2.visibility = View.GONE }
// ll_dynamic.visibility = View.GONE }
// }
// } override fun onCreateView(
// inflater: LayoutInflater?,
// showPictureView() container: ViewGroup?,
// } savedInstanceState: Bundle?
// ): View {
// //去掉dialog的标题,需要在setContentView()之前
// private fun showPictureView() { this.dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
// if (TextUtils.isEmpty(base64DataStr)) { val window = this.dialog.window
// return //去掉dialog默认的padding
// } window!!.decorView.setPadding(0, 0, 0, 0)
// cv_pic.visibility = View.VISIBLE val lp = window.attributes
// lp.width = WindowManager.LayoutParams.MATCH_PARENT
// Executors.newCachedThreadPool().execute { lp.height = WindowManager.LayoutParams.WRAP_CONTENT
// var imageByte = Base64.decode(base64DataStr, Base64.DEFAULT) //设置dialog的位置在底部
// mActivity!!.runOnUiThread { lp.gravity = Gravity.BOTTOM
// GlideApp.with(this) //设置dialog的动画
// .load(imageByte) lp.windowAnimations = R.style.platform_BottomDialogAnimation
// .diskCacheStrategy(DiskCacheStrategy.NONE) window.attributes = lp
// .into(img_pic) window.setBackgroundDrawable(ColorDrawable())
// } return inflater!!.inflate(R.layout.platform_dialog_share, null)
// } }
//
// tv_save_pic.setOnClickListener {
// ImageUtil.savePicture(mActivity, base64DataStr) /**
// } * 设置咨询师海报的图片
// } * @param base64DataStr base64数据
// */
// private fun setStyle() { fun setPosterPicture(base64DataStr: String) {
// val weixinParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT) this.base64DataStr = base64DataStr
// weixinParams.setMargins(dp7, 0, 0, 0) }
// weixinParams.weight = 0f
// ll_weixin.layoutParams = weixinParams override fun onResume() {
// super.onResume()
// val friendsParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT) initView()
// friendsParams.setMargins(llmargin, 0, 0, 0) initParams()
// friendsParams.weight = 0f }
// ll_friends.layoutParams = friendsParams
// /**
// val qqzoneParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT) * 初始化样式
// qqzoneParams.setMargins(llmargin, 0, 0, 0) */
// qqzoneParams.weight = 0f private fun initParams() {
// ll_qqzone.layoutParams = qqzoneParams when (typeStyle) {
// TYPE1 -> {
// val qqParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT) //样式1
// qqParams.setMargins(llmargin, 0, dp7, 0) ll_layout2.visibility = View.GONE
// qqParams.weight = 0f }
// ll_qq.layoutParams = qqParams TYPE2 -> {
// ll_layout.invalidate() //样式2
// ll_dynamic.visibility = View.GONE
// val backhomeParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT) ll_report.visibility = View.GONE
// backhomeParams.setMargins(0, 0, 0, 0) setStyle()
// backhomeParams.weight = 0f val deleteParams =
// ll_backhome.layoutParams = backhomeParams LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
// } deleteParams.setMargins(dp7, 0, llmargin, 0)
// deleteParams.weight = 0f
// fun setCallBack(callback: ICallBack) { ll_delete.layoutParams = deleteParams
// this.mCallback = callback }
// } TYPE3 -> {
// //样式3
// fun setShareCallBack(callBack: IShareCallBack) { ll_dynamic.visibility = View.GONE
// this.mShareCallBack = callBack ll_delete.visibility = View.GONE
// } setStyle()
// val reportParams =
// private fun initView() { LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
// ll_poster.setOnClickListener { reportParams.setMargins(dp7, 0, llmargin, 0)
// //生成海报 reportParams.weight = 0f
// mCallback?.callBack(CLICK_POSTER) ll_report.layoutParams = reportParams
// dismiss() }
// } TYPE4 -> {
// //样式4
// ll_save.setOnClickListener { ll_dynamic.visibility = View.GONE
// //保存本地 ll_layout2.visibility = View.GONE
// mCallback?.callBack(CLICK_SAVE) setStyle()
// dismiss() }
// } TYPE5 -> {
// ll_dynamic.setOnClickListener { //样式5
// //动态 ll_dynamic.visibility = View.GONE
// mCallback?.callBack(CLICK_DYNAMIC) ll_poster.visibility = View.VISIBLE
// dismiss() ll_layout2.visibility = View.GONE
// } }
// ll_weixin.setOnClickListener { TYPE6 -> {
// //分享海报到微信:直接分享图片到微信 //样式6
// if (typeStyle == TYPE6) { ll_dynamic.visibility = View.GONE
// ShareUtils.platform = SHARE_MEDIA.WEIXIN ll_save.visibility = View.VISIBLE
// mCallback?.callBack(CLICK_SHARE_IMAGE) ll_layout2.visibility = View.GONE
// } else { }
// //微信 TYPE7 -> {
// if (TextUtils.isEmpty(minProgramId)) { //样式7
// share(SHARE_MEDIA.WEIXIN) ll_layout2.visibility = View.GONE
// } else { ll_dynamic.visibility = View.GONE
// shareMinWeixin() }
// } }
// }
// } showPictureView()
// ll_friends.setOnClickListener { }
// //分享海报到微信朋友圈:直接分享图片到微信朋友圈
// if (typeStyle == TYPE6) {
// ShareUtils.platform = SHARE_MEDIA.WEIXIN_CIRCLE private fun showPictureView() {
// mCallback?.callBack(CLICK_SHARE_IMAGE) if (TextUtils.isEmpty(base64DataStr)) {
// } else { return
// //微信朋友圈 }
// share(SHARE_MEDIA.WEIXIN_CIRCLE) cv_pic.visibility = View.VISIBLE
// }
// } Executors.newCachedThreadPool().execute {
// ll_qqzone.setOnClickListener { var imageByte = Base64.decode(base64DataStr, Base64.DEFAULT)
// //分享海报到qq空间:直接分享图片到qq空间 mActivity!!.runOnUiThread {
// if (typeStyle == TYPE6) { GlideApp.with(this)
// ShareUtils.platform = SHARE_MEDIA.QZONE .load(imageByte)
// mCallback?.callBack(CLICK_SHARE_IMAGE) .diskCacheStrategy(DiskCacheStrategy.NONE)
// } else { .into(img_pic)
// //qq空间 }
// share(SHARE_MEDIA.QZONE) }
// }
// } tv_save_pic.setOnClickListener {
// ll_qq.setOnClickListener { ImageUtil.savePicture(mActivity, base64DataStr)
// //分享海报到qq:直接分享图片到qq }
// if (typeStyle == TYPE6) { }
// ShareUtils.platform = SHARE_MEDIA.QQ
// mCallback?.callBack(CLICK_SHARE_IMAGE) private fun setStyle() {
// } else { val weixinParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
// //qq weixinParams.setMargins(dp7, 0, 0, 0)
// share(SHARE_MEDIA.QQ) weixinParams.weight = 0f
// } ll_weixin.layoutParams = weixinParams
// }
// if (TYPE2 == typeStyle || TYPE3 == typeStyle) { val friendsParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
// ll_delete.setOnClickListener { friendsParams.setMargins(llmargin, 0, 0, 0)
// //删除 friendsParams.weight = 0f
// mCallback?.callBack(CLICK_DELETE) ll_friends.layoutParams = friendsParams
// dismiss()
// } val qqzoneParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
// ll_report.setOnClickListener { qqzoneParams.setMargins(llmargin, 0, 0, 0)
// //举报 qqzoneParams.weight = 0f
// mCallback?.callBack(CLICK_REPORT) ll_qqzone.layoutParams = qqzoneParams
// dismiss()
// } val qqParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
// ll_backhome.setOnClickListener { qqParams.setMargins(llmargin, 0, dp7, 0)
// //返回首页 qqParams.weight = 0f
// mCallback?.callBack(CLICK_BACKHOME) ll_qq.layoutParams = qqParams
// dismiss() ll_layout.invalidate()
// }
// } val backhomeParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
// tv_cancel.setOnClickListener { backhomeParams.setMargins(0, 0, 0, 0)
// //取消 backhomeParams.weight = 0f
// dismiss() ll_backhome.layoutParams = backhomeParams
// } }
// rl_root.setOnClickListener {
// //取消 fun setCallBack(callback: ICallBack) {
// dismiss() this.mCallback = callback
// } }
// }
// fun setShareCallBack(callBack: IShareCallBack) {
// private fun share(platform: SHARE_MEDIA) { this.mShareCallBack = callBack
// ShareUtils.shareTo(platform, mActivity!!, shareTitle!!, shareUrl!!, shareContent, shareHead) }
// ShareUtils.callBack = object : ShareActionCallBack {
// override fun onShareSuccessed(share_media: SHARE_MEDIA) { private fun initView() {
// mShareCallBack?.onShareSuccessed(share_media) ll_poster.setOnClickListener {
// } //生成海报
// mCallback?.callBack(CLICK_POSTER)
// override fun onShareFailed(share_media: SHARE_MEDIA, throwable: Throwable) { dismiss()
// mShareCallBack?.onShareFailed(share_media, throwable) }
// }
// } ll_save.setOnClickListener {
// dismiss() //保存本地
// } mCallback?.callBack(CLICK_SAVE)
// dismiss()
// /** }
// * 分享小程序 ll_dynamic.setOnClickListener {
// */ //动态
// private fun shareMinWeixin() { mCallback?.callBack(CLICK_DYNAMIC)
// //分享小程序到微信 dismiss()
// ShareUtils.shareSmailWeixin(mActivity!!, shareTitle!!, shareUrl!!, shareContent, shareHead, path, minProgramId, null) }
// dismiss() ll_weixin.setOnClickListener {
// } //分享海报到微信:直接分享图片到微信
// if (typeStyle == TYPE6) {
// interface ICallBack { ShareUtils.platform = SHARE_MEDIA.WEIXIN
// fun callBack(type: Int) mCallback?.callBack(CLICK_SHARE_IMAGE)
// } } else {
// //微信
// interface IShareCallBack { if (TextUtils.isEmpty(minProgramId)) {
// fun onShareSuccessed(share_media: SHARE_MEDIA) share(SHARE_MEDIA.WEIXIN)
// fun onShareFailed(share_media: SHARE_MEDIA, throwable: Throwable) } else {
// } shareMinWeixin()
//} }
\ No newline at end of file }
}
ll_friends.setOnClickListener {
//分享海报到微信朋友圈:直接分享图片到微信朋友圈
if (typeStyle == TYPE6) {
ShareUtils.platform = SHARE_MEDIA.WEIXIN_CIRCLE
mCallback?.callBack(CLICK_SHARE_IMAGE)
} else {
//微信朋友圈
share(SHARE_MEDIA.WEIXIN_CIRCLE)
}
}
ll_qqzone.setOnClickListener {
//分享海报到qq空间:直接分享图片到qq空间
if (typeStyle == TYPE6) {
ShareUtils.platform = SHARE_MEDIA.QZONE
mCallback?.callBack(CLICK_SHARE_IMAGE)
} else {
//qq空间
share(SHARE_MEDIA.QZONE)
}
}
ll_qq.setOnClickListener {
//分享海报到qq:直接分享图片到qq
if (typeStyle == TYPE6) {
ShareUtils.platform = SHARE_MEDIA.QQ
mCallback?.callBack(CLICK_SHARE_IMAGE)
} else {
//qq
share(SHARE_MEDIA.QQ)
}
}
if (TYPE2 == typeStyle || TYPE3 == typeStyle) {
ll_delete.setOnClickListener {
//删除
mCallback?.callBack(CLICK_DELETE)
dismiss()
}
ll_report.setOnClickListener {
//举报
mCallback?.callBack(CLICK_REPORT)
dismiss()
}
ll_backhome.setOnClickListener {
//返回首页
mCallback?.callBack(CLICK_BACKHOME)
dismiss()
}
}
tv_cancel.setOnClickListener {
//取消
dismiss()
}
rl_root.setOnClickListener {
//取消
dismiss()
}
}
private fun share(platform: SHARE_MEDIA) {
ShareUtils.shareTo(platform, mActivity!!, shareTitle!!, shareUrl!!, shareContent, shareHead)
ShareUtils.callBack = object : ShareActionCallBack {
override fun onShareSuccessed(share_media: SHARE_MEDIA) {
mShareCallBack?.onShareSuccessed(share_media)
}
override fun onShareFailed(share_media: SHARE_MEDIA, throwable: Throwable) {
mShareCallBack?.onShareFailed(share_media, throwable)
}
}
dismiss()
}
/**
* 分享小程序
*/
private fun shareMinWeixin() {
//分享小程序到微信
ShareUtils.shareSmailWeixin(
mActivity!!,
shareTitle!!,
shareUrl!!,
shareContent,
shareHead,
path,
minProgramId,
null
)
dismiss()
}
interface ICallBack {
fun callBack(type: Int)
}
interface IShareCallBack {
fun onShareSuccessed(share_media: SHARE_MEDIA)
fun onShareFailed(share_media: SHARE_MEDIA, throwable: Throwable)
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment