Browse Source

011config 处理,添加酸奶背景图,空炸模式,锅盖不合上,小图标闪烁

zhangshenjie 1 year ago
parent
commit
c2841ae92e

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

@@ -39,6 +39,14 @@
       "bg": "ic_a_boil_water_bg",
       "icon": "ic_a_boil_water",
       "devMode": "SOUP",
+      "listShow": false
+    },
+    {
+      "type": "AUTO_CLEAN",
+      "name": "auto_clean",
+      "bg": "ic_a_boil_water_bg",
+      "icon": "ic_a_boil_water",
+      "devMode": "SOUP",
       "listShow": true
     },
     {

+ 53 - 38
BusinessAirFryer/src/main/java/com/develop/airfryer/ui/DevModeView.kt

@@ -6,6 +6,9 @@ import android.util.AttributeSet
 import android.util.Log
 import android.view.LayoutInflater
 import android.view.View
+import android.view.animation.AlphaAnimation
+import android.view.animation.Animation
+import android.view.animation.LinearInterpolator
 import androidx.constraintlayout.widget.ConstraintLayout
 import com.blankj.utilcode.util.ActivityUtils.startActivity
 import com.blankj.utilcode.util.AppUtils
@@ -20,21 +23,24 @@ import com.kuyuntech.cofarcooking.device.sdk.eventbus.event.DevStatusEvent
 import com.kuyuntech.cofarcooking.device.sdk.util.core.CofarSDK
 import org.greenrobot.eventbus.Subscribe
 
-class DevModeView(context: Context, attrs: AttributeSet) : ConstraintLayout(context, attrs){
+class DevModeView(context: Context, attrs: AttributeSet) : ConstraintLayout(context, attrs) {
 
-   private var mode = CofarSDK.devInfo().devMode;
+    private var mode = CofarSDK.devInfo().devMode;
 
-   private val binding: DevModeViewBinding
+    private val binding: DevModeViewBinding
 
-   init {
-       binding = DevModeViewBinding.inflate(LayoutInflater.from(context), this, true)
-       setupClickListener()
-       CofarSDK.register(this)
-       updateUI()
-       if(!AppUtils.getAppVersionName().split(".")[0].startsWith("5")){
-           this.visibility = GONE
-       }
-   }
+    private var alphaAnimation: AlphaAnimation? = null
+
+    init {
+        binding = DevModeViewBinding.inflate(LayoutInflater.from(context), this, true)
+        setupClickListener()
+        CofarSDK.register(this)
+        animation()
+        updateUI()
+        if (!AppUtils.getAppVersionName().split(".")[0].startsWith("5")) {
+            this.visibility = GONE
+        }
+    }
 
     override fun onDetachedFromWindow() {
         super.onDetachedFromWindow()
@@ -42,65 +48,68 @@ class DevModeView(context: Context, attrs: AttributeSet) : ConstraintLayout(cont
     }
 
 
-
     @Subscribe
     fun onDevStateEvent(event: DevStatusEvent) {
-        ThreadUtils.runOnMainThread{
+        ThreadUtils.runOnMainThread {
             updateUI()
         }
     }
 
 
-
     @Subscribe
-    fun onDevModeChange(event: DevCommonEvent){
-            if(CommonEventTypes.DEV_MODE_CHANGE == event.type){
-                mode = CofarSDK.devInfo().devMode;
-                updateUI();
-                val intent = Intent(this.context, Class.forName("com.develop.main.ui.ModeEntranceActivity"))
-                intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK
-                this.context.startActivity(intent)
-            }
+    fun onDevModeChange(event: DevCommonEvent) {
+        if (CommonEventTypes.DEV_MODE_CHANGE == event.type) {
+            mode = CofarSDK.devInfo().devMode;
+            updateUI();
+            val intent =
+                Intent(this.context, Class.forName("com.develop.main.ui.ModeEntranceActivity"))
+            intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK
+            this.context.startActivity(intent)
+        }
 
     }
 
-    private fun updateUI(){
+    private fun updateUI() {
         //判断模式
-        if(mode == DevModes.AIR_FRYER){
+        if (mode == DevModes.AIR_FRYER) {
             binding.dfbAtive.visibility = View.GONE;
             binding.dfbUnactive.visibility = View.VISIBLE;
             binding.kqzgActive.visibility = View.VISIBLE;
             binding.kqzgUnactive.visibility = View.GONE;
 
 
-            if(CofarSDK.devInfo().potCloverStatus.toInt() == 0){
+            if (CofarSDK.devInfo().potCloverStatus.toInt() == 0) {
                 binding.kqzgCoverOpen.visibility = View.GONE
                 binding.kqzgCoverClose.visibility = View.VISIBLE
-            }else{
+                binding.kqzgCoverOpen.clearAnimation()
+
+            } else {
                 binding.kqzgCoverOpen.visibility = View.VISIBLE
                 binding.kqzgCoverClose.visibility = View.GONE
+                binding.kqzgCoverOpen.startAnimation(alphaAnimation)
+
             }
 
 
-        }else{
+        } else {
 
 
-            if(PotStatus.UNEXIST == CofarSDK.devInfo().potStatus){
+            if (PotStatus.UNEXIST == CofarSDK.devInfo().potStatus) {
                 binding.dfbAtive.visibility = View.GONE;
                 binding.dfbUnactive.visibility = View.VISIBLE;
                 binding.kqzgActive.visibility = View.GONE;
                 binding.kqzgUnactive.visibility = View.VISIBLE;
-            }else{
+            } else {
                 binding.dfbAtive.visibility = View.VISIBLE;
                 binding.dfbUnactive.visibility = View.GONE;
                 binding.kqzgActive.visibility = View.GONE;
                 binding.kqzgUnactive.visibility = View.VISIBLE;
             }
 
-            if(CofarSDK.devInfo().potCloverStatus.toInt() == 0){
+            if (CofarSDK.devInfo().potCloverStatus.toInt() == 0) {
                 binding.tgCoverOpen.visibility = View.GONE
                 binding.tgCoverClose.visibility = View.VISIBLE
-            }else{
+            } else {
                 binding.tgCoverOpen.visibility = View.VISIBLE
                 binding.tgCoverClose.visibility = View.GONE
             }
@@ -108,18 +117,24 @@ class DevModeView(context: Context, attrs: AttributeSet) : ConstraintLayout(cont
         }
     }
 
-   private fun setupClickListener(){
-
+    private fun setupClickListener() {
 
-      setOnClickListener {
-          CofarSDK.changeDevMode(if (mode ==DevModes.SOUP) DevModes.AIR_FRYER else DevModes.SOUP)
 
-      }
+        setOnClickListener {
+            CofarSDK.changeDevMode(if (mode == DevModes.SOUP) DevModes.AIR_FRYER else DevModes.SOUP)
 
-   }
+        }
 
+    }
 
+    private fun animation() {
+        alphaAnimation = AlphaAnimation(1f, 0f)
+        alphaAnimation?.duration = 300;
+        alphaAnimation?.interpolator =  LinearInterpolator()
+        alphaAnimation?.repeatCount = Animation.INFINITE;
+        alphaAnimation?.repeatMode = Animation.REVERSE;
 
+    }
 
 
 }

BIN
BusinessCommon/src/main/res/drawable-xxxhdpi/ic_mode_ferment.webp


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

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