From 3466799c94227c5ebba9fb201621e745058867ee Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期二, 15 四月 2025 13:18:34 +0800
Subject: [PATCH] add: 消息提醒时间设定;会员到期时间调整;

---
 app/src/main/java/com/example/firstapp/activity/VipActivity.kt |   37 ++++++++++++++++++++++++-------------
 1 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/app/src/main/java/com/example/firstapp/activity/VipActivity.kt b/app/src/main/java/com/example/firstapp/activity/VipActivity.kt
index 1bd49b1..34a255c 100644
--- a/app/src/main/java/com/example/firstapp/activity/VipActivity.kt
+++ b/app/src/main/java/com/example/firstapp/activity/VipActivity.kt
@@ -252,8 +252,9 @@
                         Toast.makeText(this@VipActivity, "请勾选协议", Toast.LENGTH_LONG).show()
                         return@launch // 直接 return,不往下执行
                     }
-                    Toast.makeText(this@VipActivity, "功能暂未开放", Toast.LENGTH_LONG).show()
-                    return@launch
+//                    Toast.makeText(this@VipActivity, "功能暂未开放", Toast.LENGTH_LONG).show()
+//                    return@launch
+                    doWechatPay()
 
 
                 } catch (e: Exception) {
@@ -266,6 +267,23 @@
 
     }
 
+    private fun doWechatPay() {
+        val map=HashMap<String,String>()
+        map["appId"]="wxb4ba3c02aa476ea1"
+        map["partnerid"]="1900006771"
+        map["package"]="Sign=WXPay"
+        map["noncestr"]="2ac6c60ebfe7e549fbbc922ac54269bb"
+        map["timeStamp"]="1606317975"
+        map["prepayid"]="wx25232614962974fb29d1227819cc3e000g"
+        map["sign"]="wx25232614962974fb29d1227819cc3e000g"
+        PayAbility.wxPay(this, map, Observer { success ->
+            if (success == 0) {
+                Toast.makeText(this@VipActivity, "支付失败", Toast.LENGTH_LONG).show()
+            } else {
+                Toast.makeText(this@VipActivity, "支付成功", Toast.LENGTH_LONG).show()
+            }
+        })
+    }
 
     private fun vipCardInit() {
         val recyclerView = findViewById<RecyclerView>(R.id.recycler_view)
@@ -378,13 +396,6 @@
                     )
                 }
 
-
-//                setPadding(
-//                    TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20f, resources.displayMetrics).toInt(), // left padding
-//                    TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 30f, resources.displayMetrics).toInt(), // top padding
-//                    TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20f, resources.displayMetrics).toInt(), // right padding
-//                    TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 30f, resources.displayMetrics).toInt()  // bottom padding
-//                )
             }
 
             val textView = TextView(this).apply {
@@ -417,14 +428,14 @@
                 ConstraintSet.TOP,
                 previousViewId,
                 if (index == 0) ConstraintSet.TOP else ConstraintSet.BOTTOM,
-                16
+                32
             )
             constraintSet.connect(
                 iconView.id,
                 ConstraintSet.START,
                 ConstraintSet.PARENT_ID,
                 ConstraintSet.START,
-                16
+                32
             )
 
             // Text 位置
@@ -434,7 +445,7 @@
                 ConstraintSet.START,
                 iconView.id,
                 ConstraintSet.END,
-                8
+                32
             )
 
             // Check 位置
@@ -444,7 +455,7 @@
                 ConstraintSet.END,
                 ConstraintSet.PARENT_ID,
                 ConstraintSet.END,
-                16
+                32
             )
 
             constraintSet.applyTo(container)

--
Gitblit v1.9.3