Browse Source

fix: 商品状态

tongmengxiao 6 months ago
parent
commit
efd29c678b

+ 3 - 1
baseswago/src/main/res/values-ar/strings.xml

@@ -336,7 +336,7 @@
     <string name="select_all">اختر الكل</string>
     <string name="add_to_my_music">أضف إلى موسيقاي</string>
     <string name="sure_delete_this_music">هل أنت متأكد أنك تريد حذف هذه الموسيقى؟</string>
-    <string name="dress_up">إرتد ملابس</string>
+    <string name="dress_up">زخارف بلدي</string>
     <string name="mall">مجمع تجاري</string>
     <string name="buy_it_now">اشتر الآن</string>
     <string name="beauty_filter">الجمال والمرشحات</string>
@@ -349,4 +349,6 @@
     <string name="this_product_has_been_purchased">لقد تم شراء هذا المنتج</string>
     <string name="purchase_successful">تم الشراء بنجاح</string>
     <string name="no_time_limit">لا يوجد حد زمني</string>
+    <string name="already_owned">مملوكة</string>
+    <string name="using">استخدام</string>
 </resources>

+ 2 - 0
baseswago/src/main/res/values-in/strings.xml

@@ -361,4 +361,6 @@
     <string name="this_product_has_been_purchased">Produk ini telah dibeli</string>
     <string name="purchase_successful">Pembelian berhasil</string>
     <string name="no_time_limit">Tidak ada batas waktu</string>
+    <string name="already_owned">dimiliki</string>
+    <string name="using">digunakan</string>
 </resources>

+ 2 - 0
baseswago/src/main/res/values-ms/strings.xml

@@ -361,4 +361,6 @@
     <string name="this_product_has_been_purchased">Produk ini telah dibeli</string>
     <string name="purchase_successful">Pembelian berhasil</string>
     <string name="no_time_limit">Tidak ada batas waktu</string>
+    <string name="already_owned">dimiliki</string>
+    <string name="using">digunakan</string>
 </resources>

+ 3 - 1
baseswago/src/main/res/values-zh/strings.xml

@@ -336,7 +336,7 @@
     <string name="select_all">全选</string>
     <string name="add_to_my_music">添加到我的音乐</string>
     <string name="sure_delete_this_music">您确定要删除这段音乐吗?</string>
-    <string name="dress_up">装扮</string>
+    <string name="dress_up">我的装扮</string>
     <string name="mall">商城</string>
     <string name="buy_it_now">立即购买</string>
     <string name="beauty_filter">美颜&amp;滤镜</string>
@@ -349,4 +349,6 @@
     <string name="this_product_has_been_purchased">该商品已经购买</string>
     <string name="purchase_successful">购买成功</string>
     <string name="no_time_limit">不限时间</string>
+    <string name="already_owned">已拥有</string>
+    <string name="using">使用中</string>
 </resources>

+ 3 - 1
baseswago/src/main/res/values/strings.xml

@@ -368,7 +368,7 @@
     <string name="select_all">Select all</string>
     <string name="add_to_my_music">Add to my music</string>
     <string name="sure_delete_this_music">Are you sure you want to delete this music?</string>
-    <string name="dress_up">Dress up</string>
+    <string name="dress_up">my decorations</string>
     <string name="mall">Mall</string>
     <string name="buy_it_now">Buy it now</string>
     <string name="beauty_filter">beauty&amp;filter</string>
@@ -381,4 +381,6 @@
     <string name="this_product_has_been_purchased">This product has been purchased</string>
     <string name="purchase_successful">Purchase successful</string>
     <string name="no_time_limit">No time limit</string>
+    <string name="already_owned">owned</string>
+    <string name="using">using</string>
 </resources>

+ 23 - 16
user/src/main/java/com/swago/user/store/StoreBuyDialog.kt

@@ -56,30 +56,37 @@ class StoreBuyDialog : BaseXDFragment<DialogStoreDetailBinding>(){
         storeBean?.let {
             binding.tvName.text = it.product_name
             binding.tvCoin.text = "${it.product_coin}"
-            if (storeType == 1 || storeType == 2){
+            if (storeType == 1){
                 binding.ivIcon.visibility = View.GONE
+                binding.svgContent.visibility = View.VISIBLE
+                binding.svgAvatar.visibility = View.GONE
                 svgaParser?.decodeFromURL(URL(it.product_svg_url), object : SVGAParser.ParseCompletion{
                     override fun onComplete(videoItem: SVGAVideoEntity) {
                         val drawable = SVGADrawable(videoItem)
-                        if (storeType == 1){
-                            binding.svgContent.visibility = View.VISIBLE
-                            binding.svgAvatar.visibility = View.GONE
-                            binding.svgContent.setImageDrawable(drawable)
-                            binding.svgContent.startAnimation()
-                        } else {
-                            binding.svgContent.visibility = View.GONE
-                            binding.svgAvatar.visibility = View.VISIBLE
-                            binding.svgAvatar.setImageDrawable(drawable)
-                            binding.svgAvatar.startAnimation()
-                        }
-
+                        binding.svgContent.visibility = View.VISIBLE
+                        binding.svgAvatar.visibility = View.GONE
+                        binding.svgContent.setImageDrawable(drawable)
+                        binding.svgContent.startAnimation()
+                    }
+                    override fun onError() {
+                    }
+                })
+            } else if (storeType == 2){
+                binding.ivIcon.visibility = View.GONE
+                binding.svgContent.visibility = View.GONE
+                binding.svgAvatar.visibility = View.VISIBLE
+                svgaParser?.decodeFromURL(URL(it.product_svg_url), object : SVGAParser.ParseCompletion{
+                    override fun onComplete(videoItem: SVGAVideoEntity) {
+                        val drawable = SVGADrawable(videoItem)
+                        binding.svgContent.visibility = View.GONE
+                        binding.svgAvatar.visibility = View.VISIBLE
+                        binding.svgAvatar.setImageDrawable(drawable)
+                        binding.svgAvatar.startAnimation()
                     }
-
                     override fun onError() {
-
                     }
                 })
-            } else {
+            }else {
                 binding.svgContent.visibility = View.GONE
                 binding.svgAvatar.visibility = View.GONE
                 binding.ivIcon.visibility = View.VISIBLE

+ 19 - 1
user/src/main/java/com/swago/user/store/StoreItemAdapter.kt

@@ -17,7 +17,25 @@ class StoreItemAdapter(private val type: Int) : BaseQuickAdapter<StoreItemBean,
             setVisible(R.id.tv_time , type == 2)
 
             item?.let {
-                setVisible(R.id.tvUsing , type ==2 && item.product_status == 1)
+                if(type == 1) {
+                    when(item.product_status){
+                        1 ->{
+                            setVisible(R.id.tvUsing , true)
+                            setText(R.id.tvUsing, R.string.already_owned)
+                        }
+                        2 ->{
+                            setVisible(R.id.tvUsing , true)
+                            setText(R.id.tvUsing, R.string.using)
+                        }
+                        else -> {
+                            setVisible(R.id.tvUsing , false)
+                        }
+
+                    }
+
+                } else if (type == 2){
+                    setVisible(R.id.tvUsing , item.product_status == 1)
+                }
                 setText(R.id.tv_name ,item.product_name)
                 if (type == 1){
                     setText(R.id.tv_coin ,"${item.product_coin}")

+ 5 - 0
user/src/main/res/layout/dialog_store_detail.xml

@@ -11,6 +11,8 @@
             android:layout_height="0dp"
             app:autoPlay="true"
             app:fillMode="Forward"
+            android:visibility="gone"
+            tools:visibility="gone"
             app:layout_constraintDimensionRatio="h,1:1"
             app:layout_constraintBottom_toTopOf="@+id/cl_bottom"
             app:layout_constraintTop_toTopOf="parent"
@@ -36,6 +38,8 @@
                     android:id="@+id/ivIcon"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
+                    android:visibility="gone"
+                    tools:visibility="gone"
                     app:layout_constraintEnd_toEndOf="parent"
                     app:layout_constraintStart_toStartOf="parent"
                     app:layout_constraintBottom_toBottomOf="parent"
@@ -48,6 +52,7 @@
                     app:autoPlay="true"
                     app:fillMode="Forward"
                     android:visibility="gone"
+                    tools:visibility="gone"
                     app:layout_constraintEnd_toEndOf="parent"
                     app:layout_constraintStart_toStartOf="parent"
                     app:layout_constraintBottom_toBottomOf="parent"

+ 3 - 1
user/src/main/res/layout/item_store.xml

@@ -64,12 +64,14 @@
             android:textColor="#A3FFFFFF"/>
         <TextView
             android:id="@+id/tvUsing"
-            android:layout_width="51dp"
+            android:layout_width="wrap_content"
             android:layout_height="18dp"
             android:textSize="@dimen/sp_12"
             android:textColor="@color/_ffffff"
             app:layout_constraintTop_toTopOf="parent"
             app:layout_constraintLeft_toLeftOf="parent"
+            android:paddingStart="2dp"
+            android:paddingEnd="2dp"
             android:text="Using"
             android:gravity="center"
             android:visibility="gone"