zhangshenjie il y a 1 mois
Parent
commit
61bf60b05a

+ 23 - 2
BusinessAirFryer/src/main/java/com/develop/airfryer/ui/DevModeView.kt

@@ -12,7 +12,10 @@ import android.view.animation.LinearInterpolator
 import androidx.constraintlayout.widget.ConstraintLayout
 import com.blankj.utilcode.util.ActivityUtils.startActivity
 import com.blankj.utilcode.util.AppUtils
+import com.develop.airfryer.R
 import com.develop.airfryer.databinding.DevModeViewBinding
+import com.develop.base.ext.getModelNum
+import com.develop.base.ext.getSN
 import com.develop.base.util.DevModesEvent
 import com.develop.base.util.ThreadUtils
 import com.kuyuntech.cofarcooking.device.sdk.constant.core.CommonEventTypes
@@ -32,18 +35,22 @@ class DevModeView(context: Context, attrs: AttributeSet) : ConstraintLayout(cont
     private val binding: DevModeViewBinding
 
     private var alphaAnimation: AlphaAnimation? = null
+    private var modelNum = getModelNum()
 
     init {
         binding = DevModeViewBinding.inflate(LayoutInflater.from(context), this, true)
         setupClickListener()
         CofarSDK.register(this)
         animation()
+        setImageUi()
         updateUI()
         if (!AppUtils.getAppVersionName().split(".")[0].startsWith("5")) {
             this.visibility = GONE
         }
     }
 
+
+
     override fun onDetachedFromWindow() {
         super.onDetachedFromWindow()
         CofarSDK.unregister(this);
@@ -62,7 +69,7 @@ class DevModeView(context: Context, attrs: AttributeSet) : ConstraintLayout(cont
     fun onDevModeChange(event: DevCommonEvent) {
         //
         if (CommonEventTypes.DEV_MODE_CHANGE == event.type) {
-            mode = CofarSDK.devInfo().devMode;
+            mode = CofarSDK.devInfo().devMode
             updateUI();
 
 //            val intent =
@@ -71,14 +78,28 @@ class DevModeView(context: Context, attrs: AttributeSet) : ConstraintLayout(cont
 //            this.context.startActivity(intent)
         }
 
+    }
+    private fun setImageUi() {
+        if (modelNum == "5067"){
+            //厨师机,汤锅和厨师机图标
+            binding.tgCoverClose.setImageResource(R.drawable.tg_cover_close_a)
+            binding.tgCoverOpen.setImageResource(R.drawable.tg_cover_open_a)
+            binding.tgUnactive.setImageResource(R.drawable.tg_unactive_a)
+            binding.kqzgUnactiveA.setImageResource(R.drawable.csj_unactive_a)
+            binding.kqzgCoverOpen.setImageResource(R.drawable.csj_cover_open_a)
+            binding.kqzgCoverClose.setImageResource(R.drawable.csj_cover_close_a)
+
+        }
+
     }
 
     private fun updateUI() {
+
         //  //devInfo.potStatus 0是有锅  1是没锅
 //      //devInfo.potCloverStatus 0是合盖,1是没盒盖
         if (CofarSDK.devInfo().potStatus.toInt()==0){
             //判断模式
-            if (mode == DevModes.AIR_FRYER) {
+            if (mode == DevModes.AIR_FRYER || mode == DevModes.STAND_MIXER) {
                 binding.dfbAtive.visibility = View.GONE;
                 binding.dfbUnactive.visibility = View.VISIBLE;
                 binding.kqzgActive.visibility = View.VISIBLE;

BIN
BusinessAirFryer/src/main/res/drawable-xxxhdpi/csj_cover_close_a.png


BIN
BusinessAirFryer/src/main/res/drawable-xxxhdpi/csj_cover_open_a.png


BIN
BusinessAirFryer/src/main/res/drawable-xxxhdpi/csj_unactive_a.png


BIN
BusinessAirFryer/src/main/res/drawable-xxxhdpi/tg_cover_close_a.png


BIN
BusinessAirFryer/src/main/res/drawable-xxxhdpi/tg_cover_open_a.png


BIN
BusinessAirFryer/src/main/res/drawable-xxxhdpi/tg_unactive_a.png


+ 2 - 0
BusinessAirFryer/src/main/res/layout/dev_mode_view.xml

@@ -55,6 +55,7 @@
                             android:layout_height="@dimen/convert_60px"
                             >
                                 <ImageView
+                                    android:id="@+id/tg_unactive"
                                     android:layout_width="@dimen/convert_60px"
                                     android:layout_height="@dimen/convert_60px"
                                     android:src="@drawable/tg_unactive"
@@ -69,6 +70,7 @@
                             android:layout_height="@dimen/convert_60px"
                             >
                                 <ImageView
+                                    android:id="@+id/kqzg_unactive_a"
                                     android:layout_width="@dimen/convert_60px"
                                     android:layout_height="@dimen/convert_60px"
                                     android:src="@drawable/kqzg_unactive"

+ 2 - 1
BusinessAuth/src/main/res/layout/activity_member_auth.xml

@@ -13,7 +13,8 @@
         android:layout_height="match_parent"
         android:background="#666"
         android:scaleType="centerCrop"
-        android:src="@drawable/guide_bg"/>
+        android:src="@drawable/guide_bg"
+        />
 
     <View
         android:visibility="gone"

+ 2 - 2
BusinessMain/src/main/java/com/develop/main/ui/HomeActivity.kt

@@ -477,11 +477,11 @@ class HomeActivity : CommonBVMActivity<ActivityHomeBinding, HomeViewModel>() {
         cancelConfirmDialog.onDialogClickListener =
             object : CancelConfirmDialog.OnDialogClickListener {
                 override fun onConfirm() {
-                    cancelConfirmDialog.removeSelf();
+                    cancelConfirmDialog.removeSelf()
                 }
 
                 override fun onCancel() {
-                    cancelConfirmDialog.removeSelf();
+                    cancelConfirmDialog.removeSelf()
                 }
 
                 override fun onKey() {

+ 8 - 8
BusinessMain/src/main/java/com/develop/main/ui/ModesFragment.kt

@@ -113,14 +113,14 @@ class  ModesFragment : CommonBVMFragment<FragmentModesBinding, HomeViewModel>()
             binding.modesFragmentLayout.background = null
         }
 
-        //先用汤机模式给5067显示厨师机
-        if (isModelNum == "5067"&& getSN().startsWith("000A")){
-            devMode = "STAND_MIXER"
-        }else{
-            devMode = CofarSDK.devInfo().devMode
-        }
-
-//        devMode = CofarSDK.devInfo().devMode
+//        //先用汤机模式给5067显示厨师机
+//        if (isModelNum == "5067"&& getSN().startsWith("000A")){
+//            devMode = "STAND_MIXER"
+//        }else{
+//            devMode = CofarSDK.devInfo().devMode
+//        }
+
+        devMode = CofarSDK.devInfo().devMode
 
         val configJson = ConfigUtils.loadConfig()
 

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

@@ -19,6 +19,7 @@ import com.blankj.utilcode.util.NetworkUtils
 import com.bumptech.glide.Glide
 import com.develop.base.ext.background_color
 import com.develop.base.ext.background_drawable
+import com.develop.base.ext.getModelNum
 import com.develop.base.ext.getSN
 import com.develop.base.ext.globalApp
 import com.develop.base.ext.isBrand011A
@@ -52,9 +53,15 @@ import com.develop.main.viewmodel.HomeViewModel
 import com.drake.brv.BindingAdapter
 import com.drake.brv.utils.*
 import com.drake.net.utils.scopeNet
+import com.kuyuntech.cofarcooking.device.sdk.constant.core.CommonEventTypes
+import com.kuyuntech.cofarcooking.device.sdk.constant.core.DevModes
+import com.kuyuntech.cofarcooking.device.sdk.eventbus.event.DevCommonEvent
+import com.kuyuntech.cofarcooking.device.sdk.eventbus.event.DevStatusEvent
+import com.kuyuntech.cofarcooking.device.sdk.util.core.CofarSDK
 import kotlinx.coroutines.delay
 import org.greenrobot.eventbus.EventBus
 import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
 
 
 class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewModel>() {
@@ -82,6 +89,10 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
 
     private var recyclePosition = 0
     private var recycleTouch = false
+    private var devMode = ""
+    private var isDevModes = true
+    private var isModelNum = ""
+    private var isRegister = true
 
     private val filterPopupWindow by lazy {
         CommonPopupWindow.ViewBuilder<FilterSortViewLayout>().width(dp417).height(dp549)
@@ -147,7 +158,6 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
-        EventBus.getDefault().register(this)
     }
 
     override fun onPostCreateView() {
@@ -163,14 +173,23 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
         if (needRefresh) {
             refreshOnLineOrLocalRecipes()
         }
+
+        if (isRegister) {
+            EventBus.getDefault().register(this)
+        }
+        isRegister = false
+
     }
 
-    override fun onDestroy() {
-        super.onDestroy()
+    override fun onDestroyView() {
+        super.onDestroyView()
         EventBus.getDefault().unregister(this)
-    }
 
+    }
     private fun initView() {
+        isModelNum = getModelNum()
+        devMode = CofarSDK.devInfo().devMode
+
         sortDataList.addAll(DataFactory.genSortNameList(resources))
         //添加字母A-Z
         letterStringList.addAll(TimeUtil.forLetterList())
@@ -929,7 +948,6 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
         fromRefreshEvent = false
         viewModel.lastSortedPos = pos
         if (needRefresh) {
-
             if (viewModel.recipesType == RecipesType.ONLINE) {
                 viewModel.getOnLineRecipeList(viewModel.categoryCode, "")
             } else {
@@ -996,6 +1014,67 @@ class RecipesFragment : CommonBVMFragment<FragmentCommeListBinding, HomeViewMode
 
     }
 
+    @Subscribe(threadMode = ThreadMode.MAIN)
+    fun onDevStateEvent(event: DevStatusEvent) {
+        Log.e("TAG Recipes",event.toString())
+
+        //当没有锅得时候,默认是汤锅模式 //切当前Fragment可见状态 // 只针对5037的处理 5067处理
+        //potStatus 锅状态, 无锅 1 ,有锅 0
+        if ((isModelNum == "5037"|| isModelNum == "5067") && isVisible&& isResumed && event.devInfo.potStatus.toInt() == 1) {
+            Log.d("TAG RecipesChange","onDevStateEventonDevStateEventonDevStateEvent")
+
+            // isDevModes 避免重复刷新
+            if (isDevModes) {
+                isDevModes = false
+                CofarSDK.changeDevModeFocus(DevModes.SOUP)
+            }
+        } else if (isModelNum == "5037" && isVisible&& isResumed && event.devInfo.potStatus.toInt() == 0) {
+            /**
+             * 由于客户无锅状态下是默认汤锅列表,但是在一进来是空炸锅,拿出来(无锅的时候已经换了汤锅模式),
+             * 但重新放空炸锅,onDevModeChange 是不会回调的,固需要用potCoverType 锅盖协议来判断是否需要重新换模式
+             * */
+            //potCoverType 0 是汤锅 1是空炸
+            if (event.devInfo.potCloverType.toInt() == 1 && devMode == DevModes.SOUP) {
+                Log.d("TAG RecipesChange","ModeChangeModeChangeModeChange")
+                CofarSDK.changeDevModeFocus(DevModes.AIR_FRYER)
+            }else if (event.devInfo.potCloverType.toInt() == 0 && devMode == DevModes.AIR_FRYER){
+                Log.d("TAG RecipesChange","ModeChangeModeChangeModeChange2222222222")
+                CofarSDK.changeDevModeFocus(DevModes.SOUP)
+            }
+            isDevModes = true
+
+        } else if (isModelNum == "5067" && isVisible&& isResumed && event.devInfo.potStatus.toInt() == 0) {
+            /**
+             * 由于客户无锅状态下是默认汤锅列表,但是在一进来是空炸锅,拿出来(无锅的时候已经换了汤锅模式),
+             * 但重新放空炸锅,onDevModeChange 是不会回调的,固需要用potCoverType 锅盖协议来判断是否需要重新换模式
+             * */
+            //potCoverType 0 是汤锅 1是空炸 2是厨师机
+            if (event.devInfo.potCloverType.toInt() == 2 && devMode == DevModes.SOUP) {
+                Log.d("TAG RecipesChange","ModeChangeModeChangeModeChange")
+                CofarSDK.changeDevModeFocus(DevModes.STAND_MIXER)
+            }else if (event.devInfo.potCloverType.toInt() == 0 && devMode == DevModes.STAND_MIXER){
+                Log.d("TAG RecipesChange","ModeChangeModeChangeModeChange2222222222")
+                CofarSDK.changeDevModeFocus(DevModes.SOUP)
+            }
+            isDevModes = true
+
+        }
+
+
+    }
+    @Subscribe
+    fun onDevModeChange(event: DevCommonEvent) {
+        //在当前页面,换了模式以后 重新初始化,需要判断是否显示状态
+        if (CommonEventTypes.DEV_MODE_CHANGE == event.type && isVisible) {
+            //如果相同的模式情况下,不用重新初始化
+            if (devMode == CofarSDK.devInfo().devMode) {
+                return
+            }
+            devMode = CofarSDK.devInfo().devMode
+        }
+    }
+
+
     @Subscribe
     fun refreshStarRecipes(event: RefreshStarDataEvent) {
         val dataList = binding.rv.bindingAdapter._data ?: arrayListOf()

+ 1 - 1
BusinessSetting/src/main/java/com/develop/setting/ui/LanguageActivity.kt

@@ -94,7 +94,7 @@ class LanguageActivity : BaseBindingActivity<ActivityLanguageBinding>() {
             binding.ivLogo.setGone()
             binding.ivBanner.setBackgroundResource(com.develop.common.R.drawable.account_background_045a)
         }else if (getSN().startsWith("002D")) {
-            binding.ivBanner.setImageResource(com.develop.common.R.drawable.account_background_002d)
+            binding.ivBanner.setBackgroundResource(com.develop.common.R.drawable.account_background_002d)
         } else if (getSN().startsWith("029")) {
             binding.ivBanner.setBackgroundResource(com.develop.common.R.drawable.account_background_029c)
             binding.ivLogo.setGone()

+ 1 - 1
BusinessSetting/src/main/java/com/develop/setting/ui/PrivacyPolicyActivity.kt

@@ -68,7 +68,7 @@ class PrivacyPolicyActivity : BaseBindingActivity<ActivityPrivacePolicyBinding>(
         }else if (sn.startsWith("045")){
             binding.ivBanner.setBackgroundResource(com.develop.common.R.drawable.account_background_045a)
         }else if (sn.startsWith("002D")) {
-            binding.ivBanner.setImageResource(com.develop.common.R.drawable.account_background_002d)
+            binding.ivBanner.setBackgroundResource(com.develop.common.R.drawable.account_background_002d)
         } else if (sn.startsWith("011")){
             binding.ivBanner.background = null
             var params = RelativeLayout.LayoutParams(

+ 1 - 1
BusinessSetting/src/main/java/com/develop/setting/ui/WifiListActivity.kt

@@ -138,7 +138,7 @@ class WifiListActivity : CommonBindingActivity<ActivityWifiListBinding>(),
             binding.ivBanner.setBackgroundResource(com.develop.common.R.drawable.account_background_045a)
             binding.ivLogo.setGone()
         }else if (sn.startsWith("002D")) {
-            binding.ivBanner.setImageResource(com.develop.common.R.drawable.account_background_002d)
+            binding.ivBanner.setBackgroundResource(com.develop.common.R.drawable.account_background_002d)
         } else if (sn.startsWith("029")) {
             binding.ivBanner.setBackgroundResource(com.develop.common.R.drawable.account_background_029c)
             binding.ivLogo.setGone()

+ 19 - 18
app/build.gradle

@@ -18,10 +18,10 @@ ext {
 
     versionCode = Integer.parseInt(new SimpleDateFormat("yyMMddHH").format(new Date()) + 1)
 //    versionCode=230617180
-    brandCode="063B"
-//    brandCode = "011E"
-//    model = "5037"
-    model = "1039"
+//    brandCode="002D"
+    brandCode = "000A"
+    model = "5067"
+//    model = "1039"
 
 }
 
@@ -631,12 +631,13 @@ android {
 //            //appCode 1.01 指向bug修复,2.01指向功能变更
 //            buildConfigField("String", "appCode", "\"1.01\"")
 
-//            buildConfigField("String", "UpdatePlatform", "\"normal\"")
-//            resValue("string", "app_theme", "@style/SplashTheme")
-//            buildConfigField("String", "model", "\"5067\"")
-//            buildConfigField("String", "brandCode", "\"000A\"")
-//            //appCode 1.01 指向bug修复,2.01指向功能变更
-//            buildConfigField("String", "appCode", "\"1.01\"")
+            manifestPlaceholders = [channelName: "brand000ATuya"]
+            buildConfigField("String", "UpdatePlatform", "\"normal\"")
+            resValue("string", "app_theme", "@style/SplashTheme")
+            buildConfigField("String", "model", "\"5067\"")
+            buildConfigField("String", "brandCode", "\"000A\"")
+            //appCode 1.01 指向bug修复,2.01指向功能变更
+            buildConfigField("String", "appCode", "\"1.01\"")
 
 //            manifestPlaceholders = [channelName: "brand011ATuya"]
 //            buildConfigField("String", "UpdatePlatform", "\"011\"")
@@ -787,14 +788,14 @@ android {
 //            buildConfigField("String", "time","\"${getCurrentTime()}\"" )
 //
 
-            manifestPlaceholders = [channelName: "brand063BTuya"]
-            buildConfigField("String", "UpdatePlatform", "\"normal\"")
-            resValue("string", "app_theme", "@style/SplashThemeNotLogo")
-            buildConfigField("String", "model", "\"1039\"")
-            buildConfigField("String", "brandCode", "\"063B\"")
-            //appCode 1.01 指向bug修复,2.01指向功能变更
-            buildConfigField("String", "appCode", "\"1.01\"")
-            buildConfigField("String", "time","\"${getCurrentTime()}\"" )
+//            manifestPlaceholders = [channelName: "brand063BTuya"]
+//            buildConfigField("String", "UpdatePlatform", "\"normal\"")
+//            resValue("string", "app_theme", "@style/SplashThemeNotLogo")
+//            buildConfigField("String", "model", "\"1039\"")
+//            buildConfigField("String", "brandCode", "\"063B\"")
+//            //appCode 1.01 指向bug修复,2.01指向功能变更
+//            buildConfigField("String", "appCode", "\"1.01\"")
+//            buildConfigField("String", "time","\"${getCurrentTime()}\"" )
 
 
         }

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

@@ -216,7 +216,7 @@ fun getSN(): String {
 //        return "000A30150020123010190001"
 //     return "000A10390020123010170001"
 //     return "000A10390020123010190001"
-//        return "000A50670020123010190005"
+        return "000A50670020123010190005"
 //        return "010D10390020123010190001"
 //        return "010F10390020123010190001"
 //        return "011D10390020123010190001"
@@ -225,7 +225,7 @@ fun getSN(): String {
 //        return "000A50370020123010190004"
 //        return "011A50370020123010190003"
 //        return "011A50370020123010190006"
-        return "011E50370020123010190001"
+//        return "011E50370020123010190001"
 //    return "007D20020020123010190001"
 //        return "036I21060020123010190007"
 //        return "030A10390020123010190004"

BIN
libThirdPart/libs/cofar-cooking-device-sdk-0.0.1-SNAPSHOT.jar