Browse Source

涂鸦配件信息

zhangshenjie 2 months ago
parent
commit
d1bd1d6c40

BIN
BusinessCommon/src/main/res/drawable-xxxhdpi/tuya_accessory_1.png


BIN
BusinessCommon/src/main/res/drawable-xxxhdpi/tuya_accessory_10.png


BIN
BusinessCommon/src/main/res/drawable-xxxhdpi/tuya_accessory_2.png


BIN
BusinessCommon/src/main/res/drawable-xxxhdpi/tuya_accessory_3.png


BIN
BusinessCommon/src/main/res/drawable-xxxhdpi/tuya_accessory_4.jpg


BIN
BusinessCommon/src/main/res/drawable-xxxhdpi/tuya_accessory_5.jpg


BIN
BusinessCommon/src/main/res/drawable-xxxhdpi/tuya_accessory_6.jpg


BIN
BusinessCommon/src/main/res/drawable-xxxhdpi/tuya_accessory_7.jpg


BIN
BusinessCommon/src/main/res/drawable-xxxhdpi/tuya_accessory_8.jpg


BIN
BusinessCommon/src/main/res/drawable-xxxhdpi/tuya_accessory_9.png


+ 9 - 1
BusinessStep/src/main/java/com/develop/step/ui/recipes_detail/CookDetailToolsFragment.kt

@@ -4,6 +4,7 @@ import android.view.LayoutInflater
 import android.view.ViewGroup
 import android.widget.ImageView
 import android.widget.TextView
+import com.develop.base.ext.getSN
 import com.develop.base.ext.load
 import com.develop.base.ext.updateText
 import com.develop.common.data_repo.FoodDataProvider
@@ -19,6 +20,8 @@ import com.drake.brv.utils.setup
 //配件Fragment
 class CookDetailToolsFragment :
     CommonBVMFragment<FragmentDetailCookMethodBinding, CookDetailViewModel>() {
+    private var sn = getSN()
+
     override fun createViewModel(): CookDetailViewModel {
         return getViewModelOfActivity(CookDetailViewModel::class.java)
     }
@@ -46,7 +49,12 @@ class CookDetailToolsFragment :
         viewModel.getRecipeLiveData().observe(viewLifecycleOwner) {
             val sourceItems = mutableListOf<CookToolItem>()
             for (accessory in it.accessory) {
-                val path = FoodDataProvider.getResourcePath(accessory.photoPath)
+                val path =     if (sn.startsWith("011D")){
+                    viewModel.tuyaAccessoryPhoto(accessory.number)
+                }else{
+                    FoodDataProvider.getResourcePath(accessory.photoPath)
+                }
+
                 sourceItems.add(CookToolItem(path, accessory.name ?: ""))
             }
             binding.rvTools.models = sourceItems

+ 46 - 5
BusinessStep/src/main/java/com/develop/step/viewmodel/CookDetailViewModel.kt

@@ -511,12 +511,11 @@ class CookDetailViewModel : BaseViewModel() {
             parts.let {string->
                 string.forEach { str ->
                     val (number, name) = str.split("#")
-                    val accessory = accessoryList.find { access -> access.number == number }
-                    accessory?.let { bean ->
+                    //赛选
                         includeAccessory.add(
                             DevAccessory(
-                                bean.code, bean.number, bean.lang, bean.name,bean.photo,
-                                bean.photoPath, bean.updateTime, bean.createTime
+                                "$number#$name", number, lang, name,"$name#$number",
+                                "",0, 0
                             )
                         )
                     }
@@ -524,7 +523,6 @@ class CookDetailViewModel : BaseViewModel() {
             }
 
 
-        }
 
 
 
@@ -577,6 +575,49 @@ class CookDetailViewModel : BaseViewModel() {
             })
     }
 
+    //涂鸦配件图片
+    fun  tuyaAccessoryPhoto(number: String?) :Int{
+        var photo = when(number){
+            "1"->{
+                 com.develop.common.R.drawable.tuya_accessory_1
+            }
+            "2"->{
+                 com.develop.common.R.drawable.tuya_accessory_2
+            }
+            "3"->{
+                 com.develop.common.R.drawable.tuya_accessory_3
+            }
+            "4"->{
+                 com.develop.common.R.drawable.tuya_accessory_4
+            }
+            "5"->{
+                 com.develop.common.R.drawable.tuya_accessory_5
+            }
+            "6"->{
+                 com.develop.common.R.drawable.tuya_accessory_6
+            }
+            "7"->{
+                com.develop.common.R.drawable.tuya_accessory_7
+            }
+            "8"->{
+                com.develop.common.R.drawable.tuya_accessory_8
+            }
+            "9"->{
+               com.develop.common.R.drawable.tuya_accessory_9
+            }
+            "10"->{
+                com.develop.common.R.drawable.tuya_accessory_10
+            }
+            else->{
+                 com.develop.common.R.drawable.tuya_accessory_1
+            }
+
+        }
+
+        return  photo
+
+
+    }
 
     fun getRecipeLiveData(): LiveData<CookDetailInfo> {
         return recipeLiveData