jlin пре 1 месец
родитељ
комит
6bcb47eb22

+ 1 - 0
module_base/src/main/java/com/yc/module_base/Constans.kt

@@ -29,3 +29,4 @@ const val IS_HOME_ACTIVITY= "is_home_activity"
 const val KEY_HAS_GET_INSTALL_PARAMS= "key_Has_Get_Install_Params"
 const val KEY_NIGHT_MODE= "key_night_mode"
 const val ANCHOR_PK_TIME_SETTING= "anchor_pk_time_setting"
+const val PAY_AGREE= "pay_agree"

+ 27 - 2
module_me/src/main/java/com/mita/module_me/view/wallet/WalletActivity.kt

@@ -26,6 +26,7 @@ import com.tencent.mm.opensdk.openapi.WXAPIFactory
 import com.umeng.commonsdk.UMConfigure
 import com.xueyu.kotlinextlibrary.launchActivity
 import com.yc.baselibrary.adapter.viewHolder.MutableAdapter
+import com.yc.baselibrary.cache.Cache
 import com.yc.baselibrary.ext.bind
 import com.yc.baselibrary.ext.setSafeListener
 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.commonlibrary.RECHARGE
 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.RoomLibRouter
 import com.yc.module_base.ext.inject
 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_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.scroll
 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 isPayAgree: Boolean = false
 
     override fun initView() {
         this.window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR or
                 View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+        isPayAgree = Cache.getBoolean(PAY_AGREE) ?: false
+
         scroll.setOnClickListener {
             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(
             adapter = adapter,
             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 {
                 viewModel.payType = PayType.ALI_PAY.type
                 viewModel.pay(it)
             }
         }
 
-        cv_pay_wechat.setOnClickListener {
+        cv_pay_wechat.setSafeListener {
+            if (!isPayAgree) {
+                toast("同意《用户充值协议》")
+                return@setSafeListener
+            }
             product?.let {
                 viewModel.payType = PayType.WECHAT_PAY.type
                 viewModel.pay(it)

BIN
module_me/src/main/res/drawable-xxhdpi/icon_pay_not_agree.png


+ 5 - 3
module_me/src/main/res/layout/module_me_activity_wallet.xml

@@ -141,9 +141,11 @@
                 app:layout_constraintTop_toBottomOf="@id/recyclerView">
 
                 <ImageView
-                    android:layout_width="@dimen/dp_14"
-                    android:layout_height="@dimen/dp_14"
-                    android:src="@drawable/icon_pay_agree" />
+                    android:id="@+id/ivPayAgree"
+                    android:layout_width="@dimen/dp_24"
+                    android:layout_height="@dimen/dp_24"
+                    android:padding="@dimen/dp_5"
+                    android:src="@drawable/icon_pay_not_agree" />
 
                 <TextView
                     android:layout_width="wrap_content"