Commit d9038c85 authored by jyx's avatar jyx

代码优化

parent bc4f39b7
...@@ -40,10 +40,10 @@ class AccountMergeActivity : BaseActivity(), View.OnClickListener, AccountMergeV ...@@ -40,10 +40,10 @@ class AccountMergeActivity : BaseActivity(), View.OnClickListener, AccountMergeV
tv_title.text = "账号绑定" tv_title.text = "账号绑定"
iv_left_icon.visibility = View.VISIBLE iv_left_icon.visibility = View.VISIBLE
iv_left_icon.setImageResource(R.mipmap.ic_arrow_back) iv_left_icon.setImageResource(R.mipmap.ic_arrow_back)
accountMergePresenter.attachView(this) accountMergePresenter.attachView(this)
initListener() initListener()
accountMergePresenter.getKeepAccountMsg(keepOneAccountKey)
} }
override fun onDestroy() { override fun onDestroy() {
......
...@@ -8,12 +8,7 @@ import android.os.Bundle ...@@ -8,12 +8,7 @@ import android.os.Bundle
import android.text.TextUtils import android.text.TextUtils
import android.view.View import android.view.View
import android.widget.AdapterView import android.widget.AdapterView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.DividerItemDecoration
import cn.sharesdk.framework.Platform
import cn.sharesdk.framework.Platform.ShareParams
import cn.sharesdk.framework.ShareSDK
import cn.sharesdk.wechat.friends.Wechat
import com.component.dly.xzzq_ywsdk.YwSDK_WebActivity.Companion.open import com.component.dly.xzzq_ywsdk.YwSDK_WebActivity.Companion.open
import com.mints.goodmoney.BuildConfig import com.mints.goodmoney.BuildConfig
import com.mints.goodmoney.R import com.mints.goodmoney.R
...@@ -33,7 +28,6 @@ import com.mints.goodmoney.ui.fragment.base.BaseFragment ...@@ -33,7 +28,6 @@ import com.mints.goodmoney.ui.fragment.base.BaseFragment
import com.mints.goodmoney.ui.widgets.CustomDialogAsApple import com.mints.goodmoney.ui.widgets.CustomDialogAsApple
import com.mints.goodmoney.ui.widgets.DialogListener import com.mints.goodmoney.ui.widgets.DialogListener
import com.mints.goodmoney.ui.widgets.ShareDialog import com.mints.goodmoney.ui.widgets.ShareDialog
import com.mints.goodmoney.utils.ImageUtil
import com.mints.goodmoney.utils.QQJumpUtil import com.mints.goodmoney.utils.QQJumpUtil
import com.mints.goodmoney.utils.SpanUtils import com.mints.goodmoney.utils.SpanUtils
import com.mints.library.net.netstatus.NetUtils import com.mints.library.net.netstatus.NetUtils
...@@ -482,30 +476,6 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi ...@@ -482,30 +476,6 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
} else { } else {
shareImgDialog() shareImgDialog()
} }
// if (!userManager.userIsLogin()) {
// readyGo(WxLoginActivity::class.java)
// }
//
// if (!ps.getBoolean(Constant.FIRST_SHARE_MY, false)) {
// // 第一次邀请提示弹框
// firstWeChatInvite()
// } else {
// val wechatSp = ShareParams()
// wechatSp.shareType = Platform.SHARE_WEBPAGE
// wechatSp.title = Constant.SHARE_TITLE
// wechatSp.text = Constant.SHARE_CONTENT
// wechatSp.imageData = ImageUtil.drawableToBitmap(ContextCompat.getDrawable(requireContext(), R.mipmap.ic_launcher))
// wechatSp.url = Constant.SHARE_URL
// val wechat = ShareSDK.getPlatform(Wechat.NAME)
// if (wechat.isClientValid) {
// myPresenter.cmtShareStatus()
// // 执行图文分享
// wechat.share(wechatSp)
// } else {
// showToast("请先安装微信")
// }
// }
} }
} }
} }
...@@ -822,8 +792,9 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi ...@@ -822,8 +792,9 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
} }
R.id.dialog_btn_right -> { R.id.dialog_btn_right -> {
ps.put(Constant.FIRST_SHARE_MY, true) ps.put(Constant.FIRST_SHARE_MY, true)
cdaa!!.dismiss()
shareImgDialog() shareImgDialog()
} }
} }
} }
...@@ -840,6 +811,12 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi ...@@ -840,6 +811,12 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
*/ */
private fun shareImgDialog() { private fun shareImgDialog() {
val shareDialog = ShareDialog(requireActivity()) val shareDialog = ShareDialog(requireActivity())
shareDialog.setOnShareOKListener(object : ShareDialog.OnShareOKListener {
override fun onShareOk() {
myPresenter.cmtShareStatus()
}
})
shareDialog.show() shareDialog.show()
} }
} }
\ No newline at end of file
...@@ -30,6 +30,8 @@ class ShareDialog(context: Context) : Dialog(context, R.style.dialog) { ...@@ -30,6 +30,8 @@ class ShareDialog(context: Context) : Dialog(context, R.style.dialog) {
private val llDialogShareQq: LinearLayout private val llDialogShareQq: LinearLayout
private val tvDialogShareNext: TextView private val tvDialogShareNext: TextView
private var mOnShareOKListener: OnShareOKListener? = null
private val viewPager: ViewPager private val viewPager: ViewPager
private val pagerAdapter: SharePagerAdapter private val pagerAdapter: SharePagerAdapter
...@@ -135,7 +137,14 @@ class ShareDialog(context: Context) : Dialog(context, R.style.dialog) { ...@@ -135,7 +137,14 @@ class ShareDialog(context: Context) : Dialog(context, R.style.dialog) {
tvDialogShareNext.setOnClickListener { tvDialogShareNext.setOnClickListener {
dismiss() dismiss()
} }
}
fun setOnShareOKListener(onShareOKListener: OnShareOKListener) {
mOnShareOKListener = onShareOKListener
}
interface OnShareOKListener {
fun onShareOk()
} }
private fun shareWechat() { private fun shareWechat() {
...@@ -151,6 +160,7 @@ class ShareDialog(context: Context) : Dialog(context, R.style.dialog) { ...@@ -151,6 +160,7 @@ class ShareDialog(context: Context) : Dialog(context, R.style.dialog) {
wechatSp.imageData = bitmap wechatSp.imageData = bitmap
if (wechat.isClientValid) { if (wechat.isClientValid) {
mOnShareOKListener?.onShareOk()
wechat.share(wechatSp) wechat.share(wechatSp)
} else { } else {
ToastUtil.show(MintsApplication.getContext(), "请先安装微信") ToastUtil.show(MintsApplication.getContext(), "请先安装微信")
...@@ -170,6 +180,7 @@ class ShareDialog(context: Context) : Dialog(context, R.style.dialog) { ...@@ -170,6 +180,7 @@ class ShareDialog(context: Context) : Dialog(context, R.style.dialog) {
wechatSp.imageData = bitmap wechatSp.imageData = bitmap
if (wechatMoments.isClientValid) { if (wechatMoments.isClientValid) {
mOnShareOKListener?.onShareOk()
wechatMoments.share(wechatSp) wechatMoments.share(wechatSp)
} else { } else {
ToastUtil.show(MintsApplication.getContext(), "请先安装微信") ToastUtil.show(MintsApplication.getContext(), "请先安装微信")
......
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