Browse Source

在模式中换锅ui错乱,添加鸡蛋程序

zhangshenjie 1 year ago
parent
commit
35f23d457a

+ 1 - 1
BusinessAirFryer/src/main/assets/config_000.json

@@ -12,7 +12,7 @@
     {
       "type": "COOK_EGGS",
       "name": "cook_eggs",
-      "bg": "cm_icon_cook_eggs",
+      "bg": "cm_icon_cook_eggs_bg",
       "icon": "cm_icon_cook_eggs",
       "devMode": "SOUP",
       "listShow": true

+ 8 - 0
BusinessAirFryer/src/main/assets/config_030.json

@@ -9,6 +9,14 @@
       "devMode": "SOUP",
       "listShow": true
     },
+    {
+      "type": "COOK_EGGS",
+      "name": "cook_eggs",
+      "bg": "cm_icon_cook_eggs_bg",
+      "icon": "cm_icon_cook_eggs",
+      "devMode": "SOUP",
+      "listShow": true
+    },
     {
       "type": "WIGHT",
       "name": "wight",

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


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


+ 1 - 1
BusinessMain/src/main/java/com/develop/main/ui/RecipesFragment.kt

@@ -241,7 +241,7 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
                              * */
                             val letterRv =
                                 findView<RecyclerView>(com.develop.common.R.id.letter_rv)
-                            if (categoryName!=null){
+                            if (categoryName!=null&&viewModel.recipesType != RecipesType.ONLINE){
                                 letterRv.setVisible()
                                 letterRv.apply {
                                     letterRv.layoutManager = LinearLayoutManager(getContext(), RecyclerView.HORIZONTAL, false)

+ 0 - 3
BusinessMain/src/main/java/com/develop/main/viewmodel/HomeViewModel.kt

@@ -145,9 +145,6 @@ class HomeViewModel : BaseViewModel() {
                     FoodDataProvider.getDatabase().recipeDao().queryRecipesByCategoryStartLetter(categoryNum,letter)
                         .toMutableList()
                 }
-            totalLocalRecipes.forEach {
-                Log.d("TAG totalLocalRecipes","name :"+it.name)
-            }
             //如果首字母没有的情况下,再获取包含
             if (totalLocalRecipes.isEmpty()) {
                 totalLocalRecipes =

+ 76 - 29
BusinessStep/src/main/java/com/develop/step/ui/ModesDetailActivity.kt

@@ -68,6 +68,7 @@ import com.kuyuntech.cofarcooking.device.sdk.eventbus.event.DevStatusEvent
 import com.kuyuntech.cofarcooking.device.sdk.util.core.CofarSDK
 import org.greenrobot.eventbus.EventBus
 import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
 import java.util.Objects
 import java.util.concurrent.TimeUnit
 
@@ -115,7 +116,8 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
     private var confirmType: Boolean = false
     private var eggConfirm: AppCompatTextView? = null
     private var potCloverInterval: Interval? = null
-    private var workMode :WorkMode? = null
+    private var workMode: WorkMode? = null
+    private var sdkDevMode: String = ""
     private val backRequestDialog by lazy {
         CancelConfirmDialog()
     }
@@ -138,7 +140,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
                 eggConfirm?.setOnClickListener {
                     var size = view.getSizeCheckType()
                     var hardness = view.getHardnessCheckType()
-                    setEggTime(size,hardness)
+                    setEggTime(size, hardness)
                     popupWindow.dismiss()
                 }
 
@@ -157,13 +159,16 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
     private fun turnDevModeUI() {
 
         if (CofarSDK.devInfo().devMode == DevModes.AIR_FRYER) {
+            binding.clCookTemp.visibility = View.VISIBLE
+            binding.clCookTime.visibility = View.VISIBLE
+
             //隐藏点击
             binding.clCookDirection.visibility = View.GONE;
             binding.clCookSpeed.visibility = View.GONE;
             /**
              * 2023.11.21 空炸部分把喷水功能隐藏
              * */
-             binding.clCookWater.visibility = View.GONE
+            binding.clCookWater.visibility = View.GONE
 //            binding.clCookWater.visibility = View.VISIBLE
             binding.ivTurbo.visibility = View.GONE
 
@@ -173,13 +178,16 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
         }
 
         if (CofarSDK.devInfo().devMode == DevModes.SOUP) {
+
             //隐藏点击
+            binding.clCookTemp.visibility = View.VISIBLE
+            binding.clCookTime.visibility = View.VISIBLE
             binding.clCookDirection.visibility = View.VISIBLE;
             binding.clCookSpeed.visibility = View.VISIBLE;
             binding.clCookWater.visibility = View.GONE
             //  binding.ivTurbo.visibility = View.VISIBLE
-
             binding.clCookWater.visibility = View.GONE
+            binding.clTextView.visibility = View.GONE
         }
 
 //        if (CofarSDK.devInfo().devMode=="AF_AIR_FRYER"){
@@ -225,17 +233,20 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
         lastModeType = viewModel.modeType
         modeType = lastModeType
         workMode = ConfigUtils.getMode(modeType)
+        sdkDevMode = CofarSDK.devInfo().devMode
         if (!isNightTheme()) {
             if (workMode == null) {
                 binding.ivBanner.setImageResource(com.develop.common.R.drawable.ic_mode_diy)
 //                Glide.with(this).load(com.develop.common.R.drawable.ic_mode_diy)
 //                    .into(binding.ivBanner)
             } else {
-                binding.ivBanner.setImageResource(resources.getIdentifier(
-                    workMode?.bg,
-                    "drawable",
-                    this.packageName
-                ))
+                binding.ivBanner.setImageResource(
+                    resources.getIdentifier(
+                        workMode?.bg,
+                        "drawable",
+                        this.packageName
+                    )
+                )
 //                Glide.with(this).load(
 //                    resources.getIdentifier(
 //                        workMode?.bg,
@@ -654,12 +665,13 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
 
     private var currentBgId = com.develop.common.R.drawable.pot_clover_ele_unlock //0是开锁图,1上锁图
 
-    @Subscribe
+    @Subscribe(threadMode = ThreadMode.MAIN)
     fun onDevStateEvent(event: DevStatusEvent) {
         if (!initModeData) {
             return
         }
-        Log.d("TAG dddddd","event:"+event.devInfo.toString())
+        Log.d("TAG dddddd", "event:" + event.devInfo.toString())
+
         ThreadUtils.runOnMainThread {
             currDevInfo = event.devInfo
             mRunningState = currDevInfo.runningStatus.toInt()
@@ -755,6 +767,32 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
                 updateWeightUI(currDevInfo.weight.toFloat())
             }
         }
+        //处理中途换换锅问题
+        if (sdkDevMode != event.devInfo.devMode) {
+
+
+            Log.e("TAG 换锅","sdkDevMode: "+sdkDevMode + "   event.devInfo.devMode :"+event.devInfo.devMode)
+            sdkDevMode = event.devInfo.devMode
+            initDevMode()
+            Log.e("TAG 11111","sdkDevMode: "+sdkDevMode + "   event.devInfo.devMode :"+event.devInfo.devMode)
+        }
+
+    }
+    private fun initDevMode() {
+        Log.e("TAG initDevMode","sdkDevMode: "+sdkDevMode + "   CofarSDK.devInfo().devMode :"+CofarSDK.devInfo().devMode)
+        binding.clCookTemp.visibility = View.GONE
+        binding.clTextView.visibility = View.GONE
+        binding.clCookTime.visibility = View.GONE
+        binding.clCookSpeed.visibility = View.GONE
+        binding.clCookDirection.visibility = View.GONE
+        binding.clCookWater.visibility = View.GONE
+        CofarSDK.changeDevModeFocus(sdkDevMode)
+        turnDevModeUI();
+//        初始化模式数据
+        initModeData(lastModeType)
+        initData()
+        changeCommonStep()
+
     }
 
 
@@ -882,7 +920,6 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
 //                        targetTime = baseMode.defaultTime.toInt()
 //                    }
 
-                    Log.d("TAG initModeData", "baseMode class :" + baseMode.javaClass.name)
 
                     baseMode.apply {
                         currentTemp = targetTemp.toInt()
@@ -1161,7 +1198,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
         binding.clSetTime.stopAlphaAnim()
         binding.functionLayout.visibility = View.VISIBLE
         binding.llWeightView.visibility = View.GONE
-            // 2023.12.11客户需要隐藏
+        // 2023.12.11客户需要隐藏
 //        if (getSN().startsWith("000")){
 //            binding.ivPotCover.setVisible()
 //        }
@@ -1505,9 +1542,15 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
         this.isTempChange = isTempChange
         binding.apply {
 
-            if (targetTemp.toInt()>maxTemp){
+            if (targetTemp.toInt() > maxTemp) {
                 CofarSDK.cfgHeat(maxTemp.toInt().toShort(), HeatModes.PU_TONG);
-                clCookTemp.setConfigValue("--${CofarUtils.parseTemp(maxTemp.toInt().toShort())}°C--")
+                clCookTemp.setConfigValue(
+                    "--${
+                        CofarUtils.parseTemp(
+                            maxTemp.toInt().toShort()
+                        )
+                    }°C--"
+                )
                 tempRingView.updateProgress(CofarUtils.parseTemp(maxTemp.toInt().toShort()).toInt())
                 tempRingText.text = ("${CofarUtils.parseTemp(maxTemp.toInt().toShort()).toInt()}°C")
 
@@ -1554,7 +1597,10 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
     ) {
 
 
-        Log.d("TAG updateTimeUI","minTime:$minTime   maxTime:$maxTime  remainTime:$remainTime  targetTime:$targetTime  isTimeChange:$isTimeChange   focusUpdate$focusUpdate  type :$type")
+        Log.d(
+            "TAG updateTimeUI",
+            "minTime:$minTime   maxTime:$maxTime  remainTime:$remainTime  targetTime:$targetTime  isTimeChange:$isTimeChange   focusUpdate$focusUpdate  type :$type"
+        )
 
         this.isTimeChange = isTimeChange
         this.maxTime = maxTime.toLong()
@@ -2124,15 +2170,15 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
             1 -> {//小
                 when (hardness) {
                     1 -> {//软
-                        time = 8*60
+                        time = 8 * 60
                     }
 
                     2 -> {//中
-                        time = 9*60
+                        time = 9 * 60
                     }
 
                     3 -> {//硬
-                        time = 15*60
+                        time = 15 * 60
                     }
 
                     else -> {
@@ -2146,16 +2192,16 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
             2 -> {//中
                 when (hardness) {
                     1 -> {//软
-                        time = 10*60
+                        time = 10 * 60
 
                     }
 
                     2 -> {//中
-                        time = 12*60
+                        time = 12 * 60
                     }
 
                     3 -> {//硬
-                        time = 18*60
+                        time = 18 * 60
                     }
 
                     else -> {
@@ -2168,15 +2214,15 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
             3 -> {//大
                 when (hardness) {
                     1 -> {//软
-                        time = 11*60
+                        time = 11 * 60
                     }
 
                     2 -> {//中
-                        time = 13*60
+                        time = 13 * 60
                     }
 
                     3 -> {//硬
-                        time = 18*60
+                        time = 18 * 60
                     }
 
                     else -> {
@@ -2191,7 +2237,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
                 time = 0
             }
         }
-        if (time ==0){
+        if (time == 0) {
             return
         }
         //确认
@@ -2201,13 +2247,14 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
         CofarSDK.cfgTime(time)
         CofarSDK.confirm()
     }
-    private fun  visibilityEgg(visibility :Int){
+
+    private fun visibilityEgg(visibility: Int) {
         //2023.12.11 000A客户,鸡蛋程序还未完整,需隐藏
         if ("COOK_EGGS" == viewModel.modeType) {
             binding.ivEggs.visibility = visibility
             //由于鸡蛋SDK默认时间只有20秒,需要自己另行设置
-            CofarSDK.devInfo().mode.maxTime = 20*60
-        }else{
+            CofarSDK.devInfo().mode.maxTime = 20 * 60
+        } else {
             binding.ivEggs.visibility = View.GONE
         }
     }

+ 18 - 11
BusinessStep/src/main/res/layout/activity_mode_detail.xml

@@ -110,7 +110,7 @@
         android:id="@+id/function_layout"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:paddingHorizontal="@dimen/convert_44px">
+        android:paddingHorizontal="@dimen/convert_38px">
 
 
         <androidx.constraintlayout.widget.ConstraintLayout
@@ -274,27 +274,30 @@
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toTopOf="parent" />
 
-        <com.develop.common.ui.AdaptLinearLayout
+        <LinearLayout
             android:id="@+id/card_wrapper"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:gravity="center"
             android:orientation="horizontal"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toBottomOf="@id/temp_ring_view">
+            app:layout_constraintTop_toBottomOf="@id/temp_ring_view"
+
+            >
 
             <com.develop.common.widget.CookCardView
                 android:id="@+id/cl_cook_temp"
                 android:layout_width="@dimen/convert_280px"
                 android:layout_height="@dimen/convert_140px"
-                android:layout_marginEnd="@dimen/convert_24px"
+                android:layout_marginEnd="@dimen/convert_20px"
+                android:layout_marginRight="@dimen/convert_20px"
                 app:cardSelected="true"
                 app:cardType="Temperature" />
 
             <View
                 android:visibility="gone"
                 android:id="@+id/cl_text_view"
-                android:layout_marginEnd="@dimen/convert_24px"
+                android:layout_marginEnd="@dimen/convert_20px"
+                android:layout_marginRight="@dimen/convert_20px"
                 android:layout_width="@dimen/convert_280px"
                 android:layout_height="@dimen/convert_140px" />
 
@@ -302,7 +305,8 @@
                 android:id="@+id/cl_cook_time"
                 android:layout_width="@dimen/convert_280px"
                 android:layout_height="@dimen/convert_140px"
-                android:layout_marginEnd="@dimen/convert_24px"
+                android:layout_marginEnd="@dimen/convert_20px"
+                android:layout_marginRight="@dimen/convert_20px"
                 app:cardType="Cook_time" />
 
 
@@ -310,24 +314,27 @@
                 android:id="@+id/cl_cook_speed"
                 android:layout_width="@dimen/convert_280px"
                 android:layout_height="@dimen/convert_140px"
-                android:layout_marginEnd="@dimen/convert_24px"
+                android:layout_marginEnd="@dimen/convert_20px"
+                android:layout_marginRight="@dimen/convert_20px"
                 app:cardType="Speed" />
 
             <com.develop.common.widget.CookCardView
                 android:id="@+id/cl_cook_direction"
                 android:layout_width="@dimen/convert_280px"
                 android:layout_height="@dimen/convert_140px"
-                android:layout_marginEnd="@dimen/convert_24px"
+                android:layout_marginEnd="@dimen/convert_20px"
+                android:layout_marginRight="@dimen/convert_20px"
                 app:cardType="Direction" />
 
             <com.develop.common.widget.CookCardView
                 android:id="@+id/cl_cook_water"
                 android:layout_width="@dimen/convert_280px"
                 android:layout_height="@dimen/convert_140px"
-                android:layout_marginEnd="@dimen/convert_24px"
+                android:layout_marginEnd="@dimen/convert_20px"
+                android:layout_marginRight="@dimen/convert_20px"
                 app:cardType="WATER_SPARY" />
 
-        </com.develop.common.ui.AdaptLinearLayout>
+        </LinearLayout>
 
 
         <androidx.appcompat.widget.AppCompatTextView

+ 1 - 1
app/build.gradle

@@ -13,7 +13,7 @@ ext{
     versionCode=Integer.parseInt(new SimpleDateFormat("yyMMddHH").format(new Date()) + 1)
 //    versionCode=230617180
 //    brandCode="036I"
-    brandCode="000A"
+    brandCode="030A"
     model="1039"
 
 }

+ 1 - 1
libBase/src/main/java/com/develop/base/ext/GlobaExt.kt

@@ -188,7 +188,7 @@ fun getSN(): String {
 
 //    return "045A10220020123010120023"
 //    return "000A30150020123010190001"
-     return "002A30150020123010190001"
+//     return "002A30150020123010190001"
 //     return "000A10390020123010190001"
 //    return "010D30150020123010190001"
 //    return "011A30150020123010190001"