فهرست منبع

fix: 优化每日充值角标布局

huangdong 11 ماه پیش
والد
کامیت
8cbbbf6557

+ 1 - 1
app/src/main/java/com/adealink/weparty/module/operation/view/RechargeDailyDownTimeView.kt

@@ -36,7 +36,7 @@ class RechargeDailyDownTimeView @JvmOverloads constructor(
 
     private val TAG = "RechargeDailyDownTimeView"
     private val binding =
-        ViewRechargeDailyDownTimeBinding.inflate(LayoutInflater.from(context), this)
+        ViewRechargeDailyDownTimeBinding.inflate(LayoutInflater.from(context), this, true)
     private val dailyViewModel = fastLazy {
         findViewTreeViewModelStoreOwner()?.let { OperationModule.getRechargeDailyViewModel(it) }
     }

+ 4 - 12
app/src/main/res/layout/item_home_banner_entrance_day_recharge_view.xml

@@ -4,21 +4,13 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
-    <FrameLayout
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintTop_toTopOf="parent">
-
         <com.adealink.weparty.module.operation.view.RechargeDailyDownTimeView
             android:id="@+id/recharge_daily_down_time_view"
             android:layout_width="65dp"
             android:layout_height="65dp"
-            android:layout_marginTop="15dp"
-            android:layout_marginEnd="6dp" />
-
-
-    </FrameLayout>
-
+            android:layout_marginTop="10dp"
+            android:layout_marginEnd="6dp"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintTop_toTopOf="parent"/>
 
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 6 - 17
app/src/main/res/layout/view_recharge_daily_down_time.xml

@@ -1,21 +1,13 @@
 <?xml version="1.0" encoding="utf-8"?>
-<merge xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:id="@+id/activity_layout"
-    android:layout_width="65dp"
-    android:layout_height="65dp"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
     android:clipChildren="false"
     android:clipToPadding="false"
     tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
-
-
-    <androidx.constraintlayout.widget.ConstraintLayout
-        android:id="@+id/ll_container"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:visibility="visible">
-
         <androidx.appcompat.widget.AppCompatImageView
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
@@ -31,7 +23,7 @@
             android:orientation="horizontal"
             app:layout_constraintGuide_percent="0.81" />
 
-        <com.adealink.weparty.commonui.widget.MediumTextView
+        <androidx.appcompat.widget.AppCompatTextView
             android:id="@+id/tv_live_time_countdown"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
@@ -45,10 +37,7 @@
             app:layout_constraintTop_toBottomOf="@+id/guideline"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
+            tools:visibility="visible"
             tools:text="12:12:12"/>
-    </androidx.constraintlayout.widget.ConstraintLayout>
-
-
-
 
-</merge>
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 8 - 1
module/room/src/main/java/com/adealink/weparty/room/operate/RoomRechargeDailyRightBottomViewComp.kt

@@ -1,8 +1,11 @@
 package com.adealink.weparty.room.operate
 
 import android.view.View
+import android.view.ViewGroup.MarginLayoutParams
+import androidx.core.view.updateLayoutParams
 import androidx.lifecycle.LifecycleOwner
 import com.adealink.frame.base.fastLazy
+import com.adealink.weparty.commonui.ext.dp
 import com.adealink.weparty.commonui.layout.DynamicLayers
 import com.adealink.weparty.commonui.layout.IDynamicView
 import com.adealink.weparty.module.operation.OperationModule
@@ -29,7 +32,6 @@ class RoomRechargeDailyRightBottomViewComp(
             ) {
             override fun onViewAdded(view: RechargeDailyDownTimeView) {
                 view.visibility = View.GONE
-
                 // 使用内部跳转逻辑
                 view.allowInternalClick = true
             }
@@ -46,6 +48,11 @@ class RoomRechargeDailyRightBottomViewComp(
         dailyViewModel.value?.allowDailyRechargeLD?.observe(viewLifecycleOwner) {
             if (it) {
                 downTimeView.show()
+                downTimeView.view { view ->
+                    view.updateLayoutParams<MarginLayoutParams> {
+                        marginEnd = 7.5f.dp()
+                    }
+                }
             } else {
                 downTimeView.gone()
             }