| | |
| | | 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) { |
| | |
| | | |
| | | } |
| | | |
| | | 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) |
| | |
| | | ) |
| | | } |
| | | |
| | | |
| | | // 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 { |
| | |
| | | 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 位置 |
| | |
| | | ConstraintSet.START, |
| | | iconView.id, |
| | | ConstraintSet.END, |
| | | 8 |
| | | 32 |
| | | ) |
| | | |
| | | // Check 位置 |
| | |
| | | ConstraintSet.END, |
| | | ConstraintSet.PARENT_ID, |
| | | ConstraintSet.END, |
| | | 16 |
| | | 32 |
| | | ) |
| | | |
| | | constraintSet.applyTo(container) |