|
@@ -26,6 +26,7 @@ import com.tencent.mm.opensdk.openapi.WXAPIFactory
|
|
|
import com.umeng.commonsdk.UMConfigure
|
|
import com.umeng.commonsdk.UMConfigure
|
|
|
import com.xueyu.kotlinextlibrary.launchActivity
|
|
import com.xueyu.kotlinextlibrary.launchActivity
|
|
|
import com.yc.baselibrary.adapter.viewHolder.MutableAdapter
|
|
import com.yc.baselibrary.adapter.viewHolder.MutableAdapter
|
|
|
|
|
+import com.yc.baselibrary.cache.Cache
|
|
|
import com.yc.baselibrary.ext.bind
|
|
import com.yc.baselibrary.ext.bind
|
|
|
import com.yc.baselibrary.ext.setSafeListener
|
|
import com.yc.baselibrary.ext.setSafeListener
|
|
|
import com.yc.baselibrary.ext.toast
|
|
import com.yc.baselibrary.ext.toast
|
|
@@ -34,12 +35,14 @@ import com.yc.baselibrary.view.webview.WebViewActivity
|
|
|
import com.yc.baselibrary.view.webview.WebViewVm
|
|
import com.yc.baselibrary.view.webview.WebViewVm
|
|
|
import com.yc.commonlibrary.RECHARGE
|
|
import com.yc.commonlibrary.RECHARGE
|
|
|
import com.yc.commonlibrary.SERVICE
|
|
import com.yc.commonlibrary.SERVICE
|
|
|
|
|
+import com.yc.module_base.PAY_AGREE
|
|
|
import com.yc.module_base.arouter.MeRouter
|
|
import com.yc.module_base.arouter.MeRouter
|
|
|
import com.yc.module_base.arouter.RoomLibRouter
|
|
import com.yc.module_base.arouter.RoomLibRouter
|
|
|
import com.yc.module_base.ext.inject
|
|
import com.yc.module_base.ext.inject
|
|
|
import com.yc.module_base.ext.navigationTo
|
|
import com.yc.module_base.ext.navigationTo
|
|
|
import kotlinx.android.synthetic.main.module_me_activity_wallet.cv_pay_ali
|
|
import kotlinx.android.synthetic.main.module_me_activity_wallet.cv_pay_ali
|
|
|
import kotlinx.android.synthetic.main.module_me_activity_wallet.cv_pay_wechat
|
|
import kotlinx.android.synthetic.main.module_me_activity_wallet.cv_pay_wechat
|
|
|
|
|
+import kotlinx.android.synthetic.main.module_me_activity_wallet.ivPayAgree
|
|
|
import kotlinx.android.synthetic.main.module_me_activity_wallet.recyclerView
|
|
import kotlinx.android.synthetic.main.module_me_activity_wallet.recyclerView
|
|
|
import kotlinx.android.synthetic.main.module_me_activity_wallet.scroll
|
|
import kotlinx.android.synthetic.main.module_me_activity_wallet.scroll
|
|
|
import kotlinx.android.synthetic.main.module_me_activity_wallet.titleBar
|
|
import kotlinx.android.synthetic.main.module_me_activity_wallet.titleBar
|
|
@@ -68,14 +71,28 @@ class WalletActivity : BaseActivity<WalletVm>() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private var product: Product? = null
|
|
private var product: Product? = null
|
|
|
|
|
+ private var isPayAgree: Boolean = false
|
|
|
|
|
|
|
|
override fun initView() {
|
|
override fun initView() {
|
|
|
this.window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR or
|
|
this.window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR or
|
|
|
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
|
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
|
|
|
|
+ isPayAgree = Cache.getBoolean(PAY_AGREE) ?: false
|
|
|
|
|
+
|
|
|
scroll.setOnClickListener {
|
|
scroll.setOnClickListener {
|
|
|
hideKeyboard(it)
|
|
hideKeyboard(it)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ ivPayAgree.setSafeListener {
|
|
|
|
|
+ if (isPayAgree) {
|
|
|
|
|
+ Cache.put(PAY_AGREE, false)
|
|
|
|
|
+ ivPayAgree.setImageResource(R.drawable.icon_pay_not_agree)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Cache.put(PAY_AGREE, true)
|
|
|
|
|
+ ivPayAgree.setImageResource(R.drawable.icon_pay_agree)
|
|
|
|
|
+ }
|
|
|
|
|
+ isPayAgree = !isPayAgree
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
recyclerView.bind(
|
|
recyclerView.bind(
|
|
|
adapter = adapter,
|
|
adapter = adapter,
|
|
|
layoutManager = GridLayoutManager(
|
|
layoutManager = GridLayoutManager(
|
|
@@ -84,14 +101,22 @@ class WalletActivity : BaseActivity<WalletVm>() {
|
|
|
)
|
|
)
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- cv_pay_ali.setOnClickListener {
|
|
|
|
|
|
|
+ cv_pay_ali.setSafeListener {
|
|
|
|
|
+ if (!isPayAgree) {
|
|
|
|
|
+ toast("同意《用户充值协议》")
|
|
|
|
|
+ return@setSafeListener
|
|
|
|
|
+ }
|
|
|
product?.let {
|
|
product?.let {
|
|
|
viewModel.payType = PayType.ALI_PAY.type
|
|
viewModel.payType = PayType.ALI_PAY.type
|
|
|
viewModel.pay(it)
|
|
viewModel.pay(it)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- cv_pay_wechat.setOnClickListener {
|
|
|
|
|
|
|
+ cv_pay_wechat.setSafeListener {
|
|
|
|
|
+ if (!isPayAgree) {
|
|
|
|
|
+ toast("同意《用户充值协议》")
|
|
|
|
|
+ return@setSafeListener
|
|
|
|
|
+ }
|
|
|
product?.let {
|
|
product?.let {
|
|
|
viewModel.payType = PayType.WECHAT_PAY.type
|
|
viewModel.payType = PayType.WECHAT_PAY.type
|
|
|
viewModel.pay(it)
|
|
viewModel.pay(it)
|