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 {
"m-fm" : "0.0.30.03",
"m-user-medical" : "0.0.62.14",
"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-article" : "0.0.0.10",
......@@ -33,7 +33,7 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.41.61",
"ydl-platform" : "0.0.41.63",
//第二步 若干
"ydl-webview" : "0.0.38.57",
......@@ -94,7 +94,7 @@ ext {
"m-fm" : "0.0.30.01",
"m-user-medical" : "0.0.62.14",
"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-article" : "0.0.0.8",
......@@ -116,7 +116,7 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.41.61",
"ydl-platform" : "0.0.41.63",
//第二步 若干
"ydl-webview" : "0.0.38.57",
......@@ -234,13 +234,13 @@ ext {
"umeng-common" : "com.umeng.umsdk:common:9.5.1",
"umeng-asms" : "com.umeng.umsdk:asms:1.4.1",
// //友盟社会化分享
// "umeng-share-core" : "com.umeng.umsdk:share-core:7.1.4",
// "umeng-share-qq" : "com.umeng.umsdk:share-qq: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-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-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",
"stetho" : "com.facebook.stetho:stetho:1.5.0",
"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;
import com.yidianling.im.session.extension.CustomAttachmentOrderStatus;
import com.yidianling.im.session.extension.CustomAttachmentPatientCheckIn;
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.CustomAttachmentRecipel;
import com.yidianling.im.session.extension.CustomAttachmentRecommendAssistant;
......@@ -87,6 +88,7 @@ import com.yidianling.im.session.viewholder.MsgViewHolderOrderAlreadyDone;
import com.yidianling.im.session.viewholder.MsgViewHolderOrderStatus;
import com.yidianling.im.session.viewholder.MsgViewHolderPatientCheckIn;
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.MsgViewHolderPhoneCallSystemNotice;
import com.yidianling.im.session.viewholder.MsgViewHolderRecipel;
......@@ -458,6 +460,7 @@ public class SessionHelper {
NimUIKit.registerMsgItemViewHolder(CustomAttachmentRecipel.class, MsgViewHolderRecipel.class);//处方单创建消息类型
NimUIKit.registerMsgItemViewHolder(CustomAttachmentPatientCheckIn.class, MsgViewHolderPatientCheckIn.class);//患者报到
NimUIKit.registerMsgItemViewHolder(CustomAttachmentPatientFullInfo.class, MsgViewHolderPatientFullInfo.class);//就诊者完善信息
NimUIKit.registerMsgItemViewHolder(CustomAttachmentPatientMedicineApply.class, MsgViewHolderPatientMedicineApply.class);//开药申请
}
......
......@@ -42,6 +42,9 @@ public class CustomAttachParser implements MsgAttachmentParser {
case CustomAttachmentType.TYPE_PATIENT_CHECK_IN:
attachment = new CustomAttachmentPatientCheckIn();
break;
case CustomAttachmentType.TYPE_PATIENT_MEDICINE_APPLY:
attachment = new CustomAttachmentPatientMedicineApply();
break;
default:
// attachment = new CustomAttachmentFilter();
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 {
int TYPE_RECIPE = 86;//处方单创建消息类型
int TYPE_PATIENT_FULL_INFO = 87; // 就诊患者完善信息
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 @@
<color name="medical_color_c0c9d4">#C0C9D4</color>
<color name="medical_color_e7ecf0">#E7ECF0</color>
<color name="medical_color_ff7766">#FF7766</color>
<color name="medical_color_007aef">#007aef</color>
</resources>
......@@ -143,12 +143,12 @@ dependencies {
api rootProject.ext.dependencies["eventbus"]
api rootProject.ext.dependencies["umeng-common"]
api rootProject.ext.dependencies["umeng-asms"]
// api rootProject.ext.dependencies["umeng-share-core"]
// api rootProject.ext.dependencies["umeng-share-qq"]
api rootProject.ext.dependencies["umeng-share-core"]
api rootProject.ext.dependencies["umeng-share-qq"]
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-qq-guanfang"]
api rootProject.ext.dependencies["umeng-qq-guanfang"]
api rootProject.ext.dependencies["stetho"]
api rootProject.ext.dependencies["stetho-okhttp3"]
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
//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
// }
//}
//
////
///**
// *
// */
//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)
//}
/**
*
*/
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 {
appName = name
// 获取oaid
UMConfigure.getOaid(BaseApp.instance) {
oaId = it
it?.let { oaId = it }
}
}
......
//package com.ydl.ydlcommon.view.dialog
//
//import android.app.Activity
//import android.app.Dialog
//import android.os.Bundle
//import android.view.View
//import android.view.ViewGroup
//import android.widget.AdapterView
//import android.widget.ImageView
//import com.umeng.socialize.bean.SHARE_MEDIA
//import com.ydl.ydlcommon.R
//import com.ydl.ydlcommon.actions.share.ShareMoreBean
//import com.ydl.ydlcommon.actions.share.ShareUtils
//import com.ydl.ydlcommon.adapter.CommonAdapter
//import com.ydl.ydlcommon.view.BaseViewHolder
//import kotlinx.android.synthetic.main.platform_share_custom_ui.*
//
///**
// * 自定义分享Dialog
// * Created by hgw on 2017/3/22.
// */
//
//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_context: String? = null
// private var share_head: String? = null
// private var list: List<ShareMoreBean>? = null
//
// private var adapter: CommonAdapter<ShareMoreBean>? = null
//
// override fun onCreate(savedInstanceState: Bundle?) {
// super.onCreate(savedInstanceState)
// setContentView(R.layout.platform_share_custom_ui)
//
// initView()
//
// val window = window
// // 设置显示动画
// window!!.setWindowAnimations(R.style.platform_main_menu_animstyle)
// val wl = window.attributes
// wl.x = 0
// wl.y = context.windowManager.defaultDisplay.height
// // 以下这两句是为了保证按钮可以水平满屏
// wl.width = ViewGroup.LayoutParams.MATCH_PARENT
// wl.height = ViewGroup.LayoutParams.WRAP_CONTENT
//
// // 设置显示位置
// onWindowAttributesChanged(wl)
// // 设置点击外围解散
// setCanceledOnTouchOutside(true)
// }
//
// private fun initView() {
//
// share_weichat.setOnClickListener(this)
// share_pyq.setOnClickListener(this)
// share_qqzone.setOnClickListener(this)
// share_qq.setOnClickListener(this)
//
//
// if (list == null || list!!.isEmpty()) {
// grid_view!!.visibility = View.GONE
// return
// } else {
// grid_view!!.visibility = View.VISIBLE
// }
// adapter = object : CommonAdapter<ShareMoreBean>() {
// override fun getView(position: Int, convertView1: View?, parent: ViewGroup): View {
// var convertView = convertView1
// val holder: BaseViewHolder
// if (convertView == null) {
// convertView = layoutInflater.inflate(R.layout.platform_item_custom_share_ui, null)
// holder = BaseViewHolder(convertView)
// convertView!!.tag = holder
// } else {
// holder = convertView.tag as BaseViewHolder
// }
// val imageView = holder.getView<ImageView>(R.id.share_img)
// //加载图标
// imageView.setImageResource(mDataList[position].imageResId)
// //设置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
// action?.onClick()
// 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
// this.share_context = share_context
// this.share_head = share_head
// }
//
// //添加扩展按钮
// fun addActions(list1: List<ShareMoreBean>) {
// this.list = list1
// }
//
// 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)
// dismiss()
// }
// R.id.share_pyq -> {
// ShareUtils.shareTo(SHARE_MEDIA.WEIXIN_CIRCLE, context, share_title!!, share_url!!, share_context!!, share_head)
// dismiss()
// }
// 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
import android.app.Activity
import android.app.Dialog
import android.os.Bundle
import android.view.View
import android.view.ViewGroup
import android.widget.AdapterView
import android.widget.ImageView
import com.umeng.socialize.bean.SHARE_MEDIA
import com.ydl.ydlcommon.R
import com.ydl.ydlcommon.actions.share.ShareMoreBean
import com.ydl.ydlcommon.actions.share.ShareUtils
import com.ydl.ydlcommon.adapter.CommonAdapter
import com.ydl.ydlcommon.view.BaseViewHolder
import kotlinx.android.synthetic.main.platform_share_custom_ui.*
/**
* 自定义分享Dialog
* Created by hgw on 2017/3/22.
*/
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_context: String? = null
private var share_head: String? = null
private var list: List<ShareMoreBean>? = null
private var adapter: CommonAdapter<ShareMoreBean>? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.platform_share_custom_ui)
initView()
val window = window
// 设置显示动画
window!!.setWindowAnimations(R.style.platform_main_menu_animstyle)
val wl = window.attributes
wl.x = 0
wl.y = context.windowManager.defaultDisplay.height
// 以下这两句是为了保证按钮可以水平满屏
wl.width = ViewGroup.LayoutParams.MATCH_PARENT
wl.height = ViewGroup.LayoutParams.WRAP_CONTENT
// 设置显示位置
onWindowAttributesChanged(wl)
// 设置点击外围解散
setCanceledOnTouchOutside(true)
}
private fun initView() {
share_weichat.setOnClickListener(this)
share_pyq.setOnClickListener(this)
share_qqzone.setOnClickListener(this)
share_qq.setOnClickListener(this)
if (list == null || list!!.isEmpty()) {
grid_view!!.visibility = View.GONE
return
} else {
grid_view!!.visibility = View.VISIBLE
}
adapter = object : CommonAdapter<ShareMoreBean>() {
override fun getView(position: Int, convertView1: View?, parent: ViewGroup): View {
var convertView = convertView1
val holder: BaseViewHolder
if (convertView == null) {
convertView =
layoutInflater.inflate(R.layout.platform_item_custom_share_ui, null)
holder = BaseViewHolder(convertView)
convertView!!.tag = holder
} else {
holder = convertView.tag as BaseViewHolder
}
val imageView = holder.getView<ImageView>(R.id.share_img)
//加载图标
imageView.setImageResource(mDataList[position].imageResId)
//设置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
action?.onClick()
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
this.share_context = share_context
this.share_head = share_head
}
//添加扩展按钮
fun addActions(list1: List<ShareMoreBean>) {
this.list = list1
}
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
)
dismiss()
}
R.id.share_pyq -> {
ShareUtils.shareTo(
SHARE_MEDIA.WEIXIN_CIRCLE,
context,
share_title!!,
share_url!!,
share_context!!,
share_head
)
dismiss()
}
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
//
//import android.annotation.SuppressLint
//import android.app.Activity
//import android.app.DialogFragment
//import android.graphics.drawable.ColorDrawable
//import android.os.Bundle
//import android.text.TextUtils
//import android.util.Base64
//import android.view.*
//import android.widget.LinearLayout
//import com.bumptech.glide.load.engine.DiskCacheStrategy
//import com.umeng.socialize.bean.SHARE_MEDIA
//import com.ydl.ydl_image.module.GlideApp
//import com.ydl.ydlcommon.R
//import com.ydl.ydlcommon.actions.share.ShareActionCallBack
//import com.ydl.ydlcommon.actions.share.ShareUtils
//import com.ydl.ydlcommon.utils.ImageUtil
//import com.ydl.ydlcommon.utils.ScreenUtil
//import com.yidianling.common.tools.RxImageTool
//import kotlinx.android.synthetic.main.platform_dialog_share.*
//import java.util.concurrent.Executors
//
//
///**
// * @author yuanWai
// * @描述:分享弹窗
// * @Copyright Copyright (c) 2018
// * @Company 壹点灵
// * @date 2019/2/19
// */
//class YDLShareDialog : DialogFragment {
//
// private var mActivity: Activity? = null
// private var shareTitle: String? = null
// private var shareUrl: String? = null
// private var shareContent: String? = null
// private var base64DataStr: String? = null
// private var shareHead: String? = null
// private var mCallback: ICallBack? = null
// private var mShareCallBack: IShareCallBack? = null
//
// //小程序页面地址
// private var path: String? = null
// //小程序id
// private var minProgramId: String? = null
//
// private var dp55 = 0
// private var dp7 = 0
// private var llmargin = 0
//
// @SuppressLint("ValidFragment")
// constructor(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?) : super() {
// this.mActivity = activity
// this.shareTitle = shareTitle
// this.shareUrl = shareUrl
// this.shareContent = shareContent
// this.shareHead = shareHead
// }
//
// //传递小程序参数
// @SuppressLint("ValidFragment")
// constructor(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?, path: String?, minProgramId: String?) : super() {
// this.mActivity = activity
// this.shareTitle = shareTitle
// this.shareUrl = shareUrl
// this.shareContent = shareContent
// this.shareHead = shareHead
// this.path = path
// this.minProgramId = minProgramId
// }
//
// constructor() : super() {}
//
// init {
// dp55 = RxImageTool.dip2px(55f)
// llmargin = (ScreenUtil.screenWidth - RxImageTool.dip2px(260f)) / 3
// dp7 = RxImageTool.dip2px(7.5f)
// }
//
// companion object {
// var typeStyle: Int = 0
// /**
// * 1.为显示1排(5个) 2.为显示2排(隐藏动态和举报)3.为显示2排(隐藏动态和删除) 4.为显示1排(4个)隐藏动态按钮 5:生成海报按钮、隐藏动态 6:保存海报按钮、隐藏动态 7.为显示1排(4个)隐藏动态按钮
// */
// const val TYPE1 = 1
// const val TYPE2 = 2
// const val TYPE3 = 3
// const val TYPE4 = 4
// const val TYPE5 = 5
// const val TYPE6 = 6
// const val TYPE7 = 7
// /**
// * 点击事件类型 1.动态 2.删除 3.举报 4.返回首页 5:生成海报 6:保存本地 7:分享纯图片
// */
// const val CLICK_DYNAMIC = 1
// const val CLICK_DELETE = 2
// const val CLICK_REPORT = 3
// const val CLICK_BACKHOME = 4
// const val CLICK_POSTER = 5
// const val CLICK_SAVE = 6
// const val CLICK_SHARE_IMAGE = 7
//
// fun style1(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?): YDLShareDialog {
// typeStyle = TYPE1
// return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
// }
//
// //支持分享小程序
// fun style1(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?, minProgramPath: String? = "", minProgramId: String? = ""): YDLShareDialog {
// typeStyle = TYPE1
// return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead, minProgramPath, minProgramId)
// }
//
// fun style2(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?): YDLShareDialog {
// typeStyle = TYPE2
// return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
// }
//
// fun style3(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?): YDLShareDialog {
// typeStyle = TYPE3
// return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
// }
//
// fun style4(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?): YDLShareDialog {
// typeStyle = TYPE4
// 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 style6(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?): YDLShareDialog {
// typeStyle = TYPE6
// return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
// }
//
// //支持分享小程序
// fun style7(activity: Activity, shareTitle: String?, shareUrl: String?, shareContent: String?, shareHead: String?, minProgramPath: String? = "", minProgramId: String? = ""): YDLShareDialog {
// typeStyle = TYPE7
// return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead, minProgramPath, minProgramId)
// }
// }
//
// override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View {
// //去掉dialog的标题,需要在setContentView()之前
// this.dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
// val window = this.dialog.window
// //去掉dialog默认的padding
// window!!.decorView.setPadding(0, 0, 0, 0)
// val lp = window.attributes
// lp.width = WindowManager.LayoutParams.MATCH_PARENT
// lp.height = WindowManager.LayoutParams.WRAP_CONTENT
// //设置dialog的位置在底部
// lp.gravity = Gravity.BOTTOM
// //设置dialog的动画
// lp.windowAnimations = R.style.platform_BottomDialogAnimation
// window.attributes = lp
// window.setBackgroundDrawable(ColorDrawable())
// return inflater!!.inflate(R.layout.platform_dialog_share, null)
// }
//
//
// /**
// * 设置咨询师海报的图片
// * @param base64DataStr base64数据
// */
// fun setPosterPicture(base64DataStr: String) {
// this.base64DataStr = base64DataStr
// }
//
// override fun onResume() {
// super.onResume()
// initView()
// initParams()
// }
//
// /**
// * 初始化样式
// */
// private fun initParams() {
// when (typeStyle) {
// TYPE1 -> {
// //样式1
// ll_layout2.visibility = View.GONE
// }
// TYPE2 -> {
// //样式2
// ll_dynamic.visibility = View.GONE
// ll_report.visibility = View.GONE
// setStyle()
// val deleteParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
// deleteParams.setMargins(dp7, 0, llmargin, 0)
// deleteParams.weight = 0f
// ll_delete.layoutParams = deleteParams
// }
// TYPE3 -> {
// //样式3
// ll_dynamic.visibility = View.GONE
// ll_delete.visibility = View.GONE
// setStyle()
// val reportParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
// reportParams.setMargins(dp7, 0, llmargin, 0)
// reportParams.weight = 0f
// ll_report.layoutParams = reportParams
// }
// TYPE4 -> {
// //样式4
// ll_dynamic.visibility = View.GONE
// ll_layout2.visibility = View.GONE
// setStyle()
// }
// TYPE5 -> {
// //样式5
// ll_dynamic.visibility = View.GONE
// ll_poster.visibility = View.VISIBLE
// ll_layout2.visibility = View.GONE
// }
// TYPE6 -> {
// //样式6
// ll_dynamic.visibility = View.GONE
// ll_save.visibility = View.VISIBLE
// ll_layout2.visibility = View.GONE
// }
// TYPE7 -> {
// //样式7
// ll_layout2.visibility = View.GONE
// ll_dynamic.visibility = View.GONE
// }
// }
//
// showPictureView()
// }
//
//
// private fun showPictureView() {
// if (TextUtils.isEmpty(base64DataStr)) {
// return
// }
// cv_pic.visibility = View.VISIBLE
//
// Executors.newCachedThreadPool().execute {
// var imageByte = Base64.decode(base64DataStr, Base64.DEFAULT)
// mActivity!!.runOnUiThread {
// GlideApp.with(this)
// .load(imageByte)
// .diskCacheStrategy(DiskCacheStrategy.NONE)
// .into(img_pic)
// }
// }
//
// tv_save_pic.setOnClickListener {
// ImageUtil.savePicture(mActivity, base64DataStr)
// }
// }
//
// private fun setStyle() {
// val weixinParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
// weixinParams.setMargins(dp7, 0, 0, 0)
// weixinParams.weight = 0f
// ll_weixin.layoutParams = weixinParams
//
// val friendsParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
// friendsParams.setMargins(llmargin, 0, 0, 0)
// 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
// ll_qqzone.layoutParams = qqzoneParams
//
// val qqParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
// qqParams.setMargins(llmargin, 0, dp7, 0)
// qqParams.weight = 0f
// ll_qq.layoutParams = qqParams
// ll_layout.invalidate()
//
// val backhomeParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
// backhomeParams.setMargins(0, 0, 0, 0)
// backhomeParams.weight = 0f
// ll_backhome.layoutParams = backhomeParams
// }
//
// fun setCallBack(callback: ICallBack) {
// this.mCallback = callback
// }
//
// fun setShareCallBack(callBack: IShareCallBack) {
// this.mShareCallBack = callBack
// }
//
// private fun initView() {
// ll_poster.setOnClickListener {
// //生成海报
// mCallback?.callBack(CLICK_POSTER)
// dismiss()
// }
//
// ll_save.setOnClickListener {
// //保存本地
// mCallback?.callBack(CLICK_SAVE)
// dismiss()
// }
// ll_dynamic.setOnClickListener {
// //动态
// mCallback?.callBack(CLICK_DYNAMIC)
// dismiss()
// }
// ll_weixin.setOnClickListener {
// //分享海报到微信:直接分享图片到微信
// if (typeStyle == TYPE6) {
// ShareUtils.platform = SHARE_MEDIA.WEIXIN
// mCallback?.callBack(CLICK_SHARE_IMAGE)
// } else {
// //微信
// if (TextUtils.isEmpty(minProgramId)) {
// share(SHARE_MEDIA.WEIXIN)
// } else {
// shareMinWeixin()
// }
// }
// }
// 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
package com.ydl.ydlcommon.view.dialog
import android.annotation.SuppressLint
import android.app.Activity
import android.app.DialogFragment
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.text.TextUtils
import android.util.Base64
import android.view.*
import android.widget.LinearLayout
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.umeng.socialize.bean.SHARE_MEDIA
import com.ydl.ydl_image.module.GlideApp
import com.ydl.ydlcommon.R
import com.ydl.ydlcommon.actions.share.ShareActionCallBack
import com.ydl.ydlcommon.actions.share.ShareUtils
import com.ydl.ydlcommon.utils.ImageUtil
import com.ydl.ydlcommon.utils.ScreenUtil
import com.yidianling.common.tools.RxImageTool
import kotlinx.android.synthetic.main.platform_dialog_share.*
import java.util.concurrent.Executors
/**
* @author yuanWai
* @描述:分享弹窗
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/2/19
*/
class YDLShareDialog : DialogFragment {
private var mActivity: Activity? = null
private var shareTitle: String? = null
private var shareUrl: String? = null
private var shareContent: String? = null
private var base64DataStr: String? = null
private var shareHead: String? = null
private var mCallback: ICallBack? = null
private var mShareCallBack: IShareCallBack? = null
//小程序页面地址
private var path: String? = null
//小程序id
private var minProgramId: String? = null
private var dp55 = 0
private var dp7 = 0
private var llmargin = 0
@SuppressLint("ValidFragment")
constructor(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?
) : super() {
this.mActivity = activity
this.shareTitle = shareTitle
this.shareUrl = shareUrl
this.shareContent = shareContent
this.shareHead = shareHead
}
//传递小程序参数
@SuppressLint("ValidFragment")
constructor(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?,
path: String?,
minProgramId: String?
) : super() {
this.mActivity = activity
this.shareTitle = shareTitle
this.shareUrl = shareUrl
this.shareContent = shareContent
this.shareHead = shareHead
this.path = path
this.minProgramId = minProgramId
}
constructor() : super() {}
init {
dp55 = RxImageTool.dip2px(55f)
llmargin = (ScreenUtil.screenWidth - RxImageTool.dip2px(260f)) / 3
dp7 = RxImageTool.dip2px(7.5f)
}
companion object {
var typeStyle: Int = 0
/**
* 1.为显示1排(5个) 2.为显示2排(隐藏动态和举报)3.为显示2排(隐藏动态和删除) 4.为显示1排(4个)隐藏动态按钮 5:生成海报按钮、隐藏动态 6:保存海报按钮、隐藏动态 7.为显示1排(4个)隐藏动态按钮
*/
const val TYPE1 = 1
const val TYPE2 = 2
const val TYPE3 = 3
const val TYPE4 = 4
const val TYPE5 = 5
const val TYPE6 = 6
const val TYPE7 = 7
/**
* 点击事件类型 1.动态 2.删除 3.举报 4.返回首页 5:生成海报 6:保存本地 7:分享纯图片
*/
const val CLICK_DYNAMIC = 1
const val CLICK_DELETE = 2
const val CLICK_REPORT = 3
const val CLICK_BACKHOME = 4
const val CLICK_POSTER = 5
const val CLICK_SAVE = 6
const val CLICK_SHARE_IMAGE = 7
fun style1(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?
): YDLShareDialog {
typeStyle = TYPE1
return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
}
//支持分享小程序
fun style1(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?,
minProgramPath: String? = "",
minProgramId: String? = ""
): YDLShareDialog {
typeStyle = TYPE1
return YDLShareDialog(
activity,
shareTitle,
shareUrl,
shareContent,
shareHead,
minProgramPath,
minProgramId
)
}
fun style2(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?
): YDLShareDialog {
typeStyle = TYPE2
return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
}
fun style3(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?
): YDLShareDialog {
typeStyle = TYPE3
return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
}
fun style4(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?
): YDLShareDialog {
typeStyle = TYPE4
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 style6(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?
): YDLShareDialog {
typeStyle = TYPE6
return YDLShareDialog(activity, shareTitle, shareUrl, shareContent, shareHead)
}
//支持分享小程序
fun style7(
activity: Activity,
shareTitle: String?,
shareUrl: String?,
shareContent: String?,
shareHead: String?,
minProgramPath: String? = "",
minProgramId: String? = ""
): YDLShareDialog {
typeStyle = TYPE7
return YDLShareDialog(
activity,
shareTitle,
shareUrl,
shareContent,
shareHead,
minProgramPath,
minProgramId
)
}
}
override fun onCreateView(
inflater: LayoutInflater?,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
//去掉dialog的标题,需要在setContentView()之前
this.dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
val window = this.dialog.window
//去掉dialog默认的padding
window!!.decorView.setPadding(0, 0, 0, 0)
val lp = window.attributes
lp.width = WindowManager.LayoutParams.MATCH_PARENT
lp.height = WindowManager.LayoutParams.WRAP_CONTENT
//设置dialog的位置在底部
lp.gravity = Gravity.BOTTOM
//设置dialog的动画
lp.windowAnimations = R.style.platform_BottomDialogAnimation
window.attributes = lp
window.setBackgroundDrawable(ColorDrawable())
return inflater!!.inflate(R.layout.platform_dialog_share, null)
}
/**
* 设置咨询师海报的图片
* @param base64DataStr base64数据
*/
fun setPosterPicture(base64DataStr: String) {
this.base64DataStr = base64DataStr
}
override fun onResume() {
super.onResume()
initView()
initParams()
}
/**
* 初始化样式
*/
private fun initParams() {
when (typeStyle) {
TYPE1 -> {
//样式1
ll_layout2.visibility = View.GONE
}
TYPE2 -> {
//样式2
ll_dynamic.visibility = View.GONE
ll_report.visibility = View.GONE
setStyle()
val deleteParams =
LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
deleteParams.setMargins(dp7, 0, llmargin, 0)
deleteParams.weight = 0f
ll_delete.layoutParams = deleteParams
}
TYPE3 -> {
//样式3
ll_dynamic.visibility = View.GONE
ll_delete.visibility = View.GONE
setStyle()
val reportParams =
LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
reportParams.setMargins(dp7, 0, llmargin, 0)
reportParams.weight = 0f
ll_report.layoutParams = reportParams
}
TYPE4 -> {
//样式4
ll_dynamic.visibility = View.GONE
ll_layout2.visibility = View.GONE
setStyle()
}
TYPE5 -> {
//样式5
ll_dynamic.visibility = View.GONE
ll_poster.visibility = View.VISIBLE
ll_layout2.visibility = View.GONE
}
TYPE6 -> {
//样式6
ll_dynamic.visibility = View.GONE
ll_save.visibility = View.VISIBLE
ll_layout2.visibility = View.GONE
}
TYPE7 -> {
//样式7
ll_layout2.visibility = View.GONE
ll_dynamic.visibility = View.GONE
}
}
showPictureView()
}
private fun showPictureView() {
if (TextUtils.isEmpty(base64DataStr)) {
return
}
cv_pic.visibility = View.VISIBLE
Executors.newCachedThreadPool().execute {
var imageByte = Base64.decode(base64DataStr, Base64.DEFAULT)
mActivity!!.runOnUiThread {
GlideApp.with(this)
.load(imageByte)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.into(img_pic)
}
}
tv_save_pic.setOnClickListener {
ImageUtil.savePicture(mActivity, base64DataStr)
}
}
private fun setStyle() {
val weixinParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
weixinParams.setMargins(dp7, 0, 0, 0)
weixinParams.weight = 0f
ll_weixin.layoutParams = weixinParams
val friendsParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
friendsParams.setMargins(llmargin, 0, 0, 0)
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
ll_qqzone.layoutParams = qqzoneParams
val qqParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
qqParams.setMargins(llmargin, 0, dp7, 0)
qqParams.weight = 0f
ll_qq.layoutParams = qqParams
ll_layout.invalidate()
val backhomeParams = LinearLayout.LayoutParams(dp55, ViewGroup.LayoutParams.WRAP_CONTENT)
backhomeParams.setMargins(0, 0, 0, 0)
backhomeParams.weight = 0f
ll_backhome.layoutParams = backhomeParams
}
fun setCallBack(callback: ICallBack) {
this.mCallback = callback
}
fun setShareCallBack(callBack: IShareCallBack) {
this.mShareCallBack = callBack
}
private fun initView() {
ll_poster.setOnClickListener {
//生成海报
mCallback?.callBack(CLICK_POSTER)
dismiss()
}
ll_save.setOnClickListener {
//保存本地
mCallback?.callBack(CLICK_SAVE)
dismiss()
}
ll_dynamic.setOnClickListener {
//动态
mCallback?.callBack(CLICK_DYNAMIC)
dismiss()
}
ll_weixin.setOnClickListener {
//分享海报到微信:直接分享图片到微信
if (typeStyle == TYPE6) {
ShareUtils.platform = SHARE_MEDIA.WEIXIN
mCallback?.callBack(CLICK_SHARE_IMAGE)
} else {
//微信
if (TextUtils.isEmpty(minProgramId)) {
share(SHARE_MEDIA.WEIXIN)
} else {
shareMinWeixin()
}
}
}
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