Jelajahi Sumber

fix: 弹道展示

tongmengxiao 6 bulan lalu
induk
melakukan
1e03b0a8de

+ 15 - 2
room/src/main/java/com/swago/room/giftdandao/GiftDanDaoView.kt

@@ -24,6 +24,7 @@ import com.swago.baseswago.model.live.gift.IMGiftModel
 import com.swago.baseswago.util.AppContext
 import com.swago.baseswago.util.DpPxUtil
 import com.swago.baseswago.util.LogUtil
+import com.swago.baseswago.util.SwagoInfo
 import com.swago.baseswago.util.UserInfo
 import com.swago.room.BuildConfig
 import com.swago.room.R
@@ -37,6 +38,7 @@ import java.io.File
 class GiftDanDaoView : FrameLayout {
 
     var isBusy = false
+    var isDevicesRtl = false
     private var binding: ViewItemGiftBinding? = null
     private var svgParser: SVGAParser? = null
     private var svgParser2: SVGAParser? = null
@@ -70,6 +72,7 @@ class GiftDanDaoView : FrameLayout {
             val imageView = ImageView(context)
             imageViewData.add(imageView)
         }
+        isDevicesRtl = SwagoInfo.isMirror()
     }
 
     fun addData(imGiftModel: IMGiftModel) {
@@ -117,13 +120,23 @@ class GiftDanDaoView : FrameLayout {
             if (giftCount in 1..198){
                 ivBg.visibility = View.VISIBLE
                 tvNum.visibility = View.VISIBLE
-                tvNum.text = "x${giftCount}"
+                tvNum.text = "x${giftCount} "
+                if (isDevicesRtl){
+                    ivBg.scaleX = -1f
+                } else {
+                    ivBg.scaleX = 1f
+                }
                 ivBg.setImageResource(R.mipmap.bg_dan_dao_one)
             }
             if (giftCount in 199..498){
                 ivBg.visibility = View.VISIBLE
                 tvNum.visibility = View.VISIBLE
-                tvNum.text = "x${giftCount}"
+                tvNum.text = "x${giftCount} "
+                if (isDevicesRtl){
+                    ivBg.scaleX = -1f
+                } else {
+                    ivBg.scaleX = 1f
+                }
                 ivBg.setImageResource(R.mipmap.bg_dan_dao_two)
             }
             if (giftCount in 499..998){

+ 3 - 2
room/src/main/res/layout/view_item_gift.xml

@@ -90,8 +90,9 @@
             app:layout_constraintTop_toTopOf="parent"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintStart_toStartOf="parent"
-            android:layout_marginStart="180dp"
+            android:layout_marginStart="128dp"
             app:layout_constraintEnd_toEndOf="parent">
+
             <ImageView
                 android:id="@+id/ivGiftIcon"
                 android:src="@mipmap/default_avatar"
@@ -106,7 +107,7 @@
                 android:id="@+id/tvNum"
                 android:textSize="18dp"
                 android:textColor="#fff"
-                android:text="x123456789"
+                android:text="x123456789 "
                 android:visibility="invisible"
                 tools:visibility="visible"
                 android:textStyle="bold|italic"