tj
2025-04-02 11adee7f9ff0986fa209af6ce29a37b3c0b27044
1.vip续费页面-样式修改
已修改4个文件
56 ■■■■ 文件已修改
app/src/main/java/com/example/firstapp/activity/VipActivity.kt 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/example/firstapp/ui/dashboard/DashboardFragment.kt 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/example/firstapp/ui/vip/MemberInfoCardViewModel.kt 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/layout/activity_vip.xml 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/example/firstapp/activity/VipActivity.kt
@@ -328,14 +328,17 @@
            val alipayAmount:TextView = findViewById(R.id.alipay_amount);
            val wechatAmount:TextView = findViewById(R.id.wechat_amount);
            val protocolDescLayout:TextView = findViewById(R.id.protocol_desc_layout);
            alipayAmount.text=currentPrice.toString()
            wechatAmount.text=currentPrice.toString()
            protocolDescLayout.text="自动续费可随时取消,开通后每月按${currentPrice.toString()}元自动续费,可随时取消自动续费"
        }catch (e: Exception) {
            Toast.makeText(this@VipActivity, e.message, Toast.LENGTH_LONG).show()
            Log.d("AliPayHelper","xuan: ${e.message}")
            Log.d("AliPayHelper","支付失败: ${e.message}")
        }
        val adapter = CardAdapter(cardList) { cardViewList, cardData, cardView ->
@@ -365,7 +368,23 @@
                layoutParams = ConstraintLayout.LayoutParams(
                    TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 30f, resources.displayMetrics).toInt(),
                    TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 30f, resources.displayMetrics).toInt()
                ).apply {
                    // 设置 margin
                    setMargins(
                        TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20f, resources.displayMetrics).toInt(), // left
                        TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 30f, resources.displayMetrics).toInt(), // top
                        TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 20f, resources.displayMetrics).toInt(), // right
                        TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 30f, resources.displayMetrics).toInt()  // bottom
                )
                }
//                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 {
@@ -469,6 +488,13 @@
        wechatAmount.text=currentPrice.toString()
        // 处理点击事件,这里我们只是简单地展示一个 Toast
//        Toast.makeText(this, "点击了: ${title}", Toast.LENGTH_SHORT).show()
        // 只有连续包月才展示
        val xieyiLayout:LinearLayout = findViewById(R.id.xieyi_layout);
        if (title == "连续包月") {
            xieyiLayout.visibility = View.VISIBLE
        }else{
            xieyiLayout.visibility = View.GONE
        }
        orderName = title
        orderType=title
app/src/main/java/com/example/firstapp/ui/dashboard/DashboardFragment.kt
@@ -84,7 +84,7 @@
        loadUserInfo()
        // 遮罩层点击时间
        binding.viewOverlay.setOnClickListener {
        binding.overlayContent.setOnClickListener {
            // 跳转到vipActivity
            val intent = android.content.Intent(requireContext(), com.example.firstapp.activity.VipActivity::class.java)
            startActivity(intent)
@@ -93,12 +93,14 @@
    private fun showOverlay() {
        binding.viewOverlay.visibility = View.VISIBLE
        binding.overlayContent.visibility = View.VISIBLE
        binding.viewOverlay.visibility = View.VISIBLE
    }
    private fun hiddleOverlay() {
        binding.viewOverlay.visibility = View.GONE
        binding.overlayContent.visibility = View.GONE
        binding.viewOverlay.visibility = View.GONE
    }
app/src/main/java/com/example/firstapp/ui/vip/MemberInfoCardViewModel.kt
@@ -68,9 +68,15 @@
            // 头像
            // 如果头像不为空的话,则更新头像
            if(userInfo.cover.isNotEmpty()){
                _cover.value = userInfo.cover
//            if(userInfo.cover.isNotEmpty()){
//                _cover.value = userInfo.cover
//            }
            userInfo.cover?.let {
                if (it.isNotEmpty()) {
                    _cover.value = it
            }
            }
        }
    }
app/src/main/res/layout/activity_vip.xml
@@ -84,7 +84,7 @@
                android:layout_marginTop="300dp"
                android:layout_marginLeft="15dp"
                android:layout_marginRight="15dp"
                android:padding="5dp"
                android:padding="0dp"
                android:background="@android:color/transparent"
                app:cardBackgroundColor="@android:color/transparent"
                android:foreground="@drawable/gray_border_shape"
@@ -245,8 +245,8 @@
                    >
                    <ImageView
                        android:layout_width="30dp"
                        android:layout_height="30dp"
                        android:layout_width="25dp"
                        android:layout_height="25dp"
                        android:src="@mipmap/vip_more"
                        android:layout_marginEnd="8dp"/>
@@ -316,7 +316,7 @@
                android:layout_width="250dp"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:gravity="start"
                android:gravity="center"
                android:baselineAligned="false"
                >
@@ -372,7 +372,7 @@
                android:layout_width="250dp"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:gravity="start"
                android:gravity="center"
                android:baselineAligned="false"
                >