Browse Source

032 登录注册隐藏,旋钮灯待机改动,

zhangshenjie 1 year ago
parent
commit
04beaf0c57

+ 1 - 1
BusinessAuth/src/main/java/com/develop/auth/ui/MemberLoginFragment.kt

@@ -41,7 +41,7 @@ class MemberLoginFragment : CommonBVMFragment<FragmentMemberLoginBinding, Member
             )
         }
         //2024.01.04 032客户需要删除注册功能
-        if (getSN().startsWith("032")){
+        if (getSN().startsWith("032D")){
             binding.tvRegister.visibility = View.INVISIBLE
         }
         binding.tvRegister.setOnClickListener {

+ 42 - 0
BusinessCommon/src/main/java/com/develop/common/data_repo/db/DataFactory.kt

@@ -202,7 +202,49 @@ object DataFactory {
         }
         return result
     }
+    fun genSetting032DModesList(resource: Resources): MutableList<SettingModel> {
+        val result = mutableListOf<SettingModel>()
+        val resIdList = mutableListOf(
+            R.drawable.ic_setting_language,
+            R.drawable.ic_setting_wifi,
+//            R.drawable.ic_setting_voice,
+            R.drawable.ic_setting_brightness,
+//            R.drawable.ic_setting_user,
+//            R.drawable.ic_setting_folder,
+            R.drawable.ic_setting_reset,
+            R.drawable.ic_setting_about,
+        )
+
+        val nameList = mutableListOf(
+            resource.getString(R.string.language), resource.getString(R.string.wifi),
+//            resource.getString(R.string.sound),
+            resource.getString(R.string.brightness),
+//            resource.getString(R.string.user_account),
+//            resource.getString(R.string.storage),
+            resource.getString(R.string.reset), resource.getString(R.string.about)
+
+        )
+        val settingTypeList = mutableListOf(
+            SettingType.LANGUAGE, SettingType.WIFI,
+//            SettingType.SOUND,
+            SettingType.BRIGHTNESS,
+//            SettingType.USER_ACCOUNT,
+//            SettingType.STORAGE,
+            SettingType.RESTORE_FACTORY_SETTINGS, SettingType.ABOUT
+        )
+
+        var tuyaConfig =  ConfigUtils.loadTuyaConfig()
+        if(tuyaConfig != null){
+            settingTypeList.add(SettingType.TUYA)
+            nameList.add(resource.getString(R.string.tuya))
+            resIdList.add(R.drawable.ic_setting_tuya)
+        }
 
+        for (i in resIdList.indices) {
+            result.add(SettingModel(resIdList[i], nameList[i], settingTypeList[i]))
+        }
+        return result
+    }
     fun genSetting010DModesList(resource: Resources): MutableList<SettingModel> {
         val result = mutableListOf<SettingModel>()
         val resIdList = mutableListOf(

+ 25 - 14
BusinessCommon/src/main/java/com/develop/common/food_sdk/GlobalDevEvent.kt

@@ -38,36 +38,47 @@ object GlobalDevEvent {
     var ledLock = false;
     fun globalCoverEvent(event: DevStatusEvent, pm: PowerManager) {
         if (!ledLock) {
-            ledLock = true
-            val devInfo = event.devInfo
+            ledLock = true;
+            //屏幕暗
             if (!pm.isScreenOn) {
+                //errcode 为0得时候,是有故障
                 //合盖
-                if (devInfo.potCloverStatus.toInt() == 0) {
-                    CofarSDK.flashWhiteRedLed()
+                //devInfo.potStatus 0是有锅  1是没锅
+//            //devInfo.potCloverStatus 0是合盖,1是没盒盖
+                if (event.devInfo.potStatus.toInt() == 0) {
+                    if (event.devInfo.potCloverStatus.toInt() == 0) {
+                        CofarSDK.flashWhiteRedLed()
+                    } else {
+                        CofarSDK.switchWhiteLed('0');
+                        CofarSDK.flashRedLed()
+                    }
                 } else {
                     CofarSDK.switchWhiteLed('0');
-                    CofarSDK.flashRedLed()
+                    CofarSDK.flashRedLed();
                 }
-
             } else {
-                if (devInfo.status == DevStatus.STOP.toInt()) {
+                //屏幕亮
+                //devInfo.potStatus 0是有锅  1是没锅
+//            //devInfo.potCloverStatus 0是合盖,1是没盒盖
+                if (event.devInfo.status == DevStatus.STOP.toInt()) {
 
-                    if (devInfo.potStatus.toInt() == 0) {
-                        if (devInfo.potCloverStatus.toInt() == 0) {
+                    if (event.devInfo.potStatus.toInt() == 0) {
+                        if (event.devInfo.potCloverStatus.toInt() == 0) {
                             CofarSDK.flashWhiteRedLed()
                         } else {
                             CofarSDK.switchWhiteLed('0');
                             CofarSDK.flashRedLed()
                         }
                     } else {
-                        CofarSDK.flashWhiteRedLed();
+                        CofarSDK.switchWhiteLed('0');
+                        CofarSDK.flashRedLed();
                     }
 
                 }
 
-                if (devInfo.status == DevStatus.RUNNING.toInt()) {
+                if (event.devInfo.status == DevStatus.RUNNING.toInt()) {
 
-                    if (devInfo.temp < 60) {
+                    if (event.devInfo.temp < 60) {
                         CofarSDK.switchRedLed('0');
                         CofarSDK.switchWhiteLed('1');
                     } else {
@@ -77,11 +88,11 @@ object GlobalDevEvent {
 
                 }
 
-                if (devInfo.status == DevStatus.PAUSE.toInt()) {
+                if (event.devInfo.status == DevStatus.PAUSE.toInt()) {
 
                     //判断盖子是否打开
                     //合盖
-                    if (devInfo.potCloverStatus.toInt() == 1) {
+                    if (event.devInfo.potCloverStatus.toInt() == 1) {
                         CofarSDK.switchWhiteLed('0');
                         CofarSDK.flashRedLed()
                     } else {

+ 4 - 0
BusinessCommon/src/main/java/com/develop/common/widget/HomeFunctionTopBar.kt

@@ -8,6 +8,7 @@ import android.widget.RelativeLayout
 import com.develop.base.ext.load
 import com.develop.base.R.*
 import com.develop.base.ext.background_drawable
+import com.develop.base.ext.getSN
 import com.develop.base.ext.isNightTheme
 import com.develop.base.ext.resId2Dimension
 import com.develop.base.ext.src
@@ -50,6 +51,9 @@ class HomeFunctionTopBar : RelativeLayout, View.OnClickListener {
             params.height = dp50
             binding.ivFunction.layoutParams = params
         }
+        if (getSN().startsWith("032D")){
+            binding.userLayout.visibility = View.INVISIBLE
+        }
     }
 
     fun setHomeOrBack(type: HomeOrBack) {

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

@@ -6,10 +6,12 @@ import android.util.Log
 import android.view.Gravity
 import android.view.KeyEvent
 import android.view.LayoutInflater
+import android.view.View
 import android.widget.LinearLayout
 import androidx.databinding.ViewDataBinding
 import com.alibaba.android.arouter.facade.annotation.Route
 import com.develop.base.ext.background_drawable
+import com.develop.base.ext.getSN
 import com.develop.base.ext.isFrLanguage
 import com.develop.base.ext.navigateTo
 import com.develop.base.ext.resId2Dimension
@@ -249,6 +251,12 @@ class HomeActivity : CommonBVMActivity<ActivityHomeBinding, HomeViewModel>() {
                 withBoolean("enter_from_home", true)
             }
         }
+        //032客户需要隐藏登录和注册
+        if (getSN().startsWith("032D")){
+            binding.tvUserName.visibility  = View.GONE
+            //头像需要占位显示
+            binding.ivAvatar.visibility = View.INVISIBLE
+        }
     }
 
     private fun updateUserInfoUi(userInfo: UserInfo?) {

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

@@ -3,6 +3,7 @@ package com.develop.main.ui
 import android.os.Bundle
 import android.util.DisplayMetrics
 import android.view.LayoutInflater
+import android.view.View
 import android.view.ViewGroup.LayoutParams
 import android.widget.ImageView
 import androidx.appcompat.widget.AppCompatTextView
@@ -502,6 +503,13 @@ class ModeEntranceActivity : CommonBindingActivity<ActivityModeEntranceBinding>(
             binding.tvHelp.textSize = HomeActivity.dp20
         }
 
+        //032客户需要隐藏登录和注册
+        if (getSN().startsWith("032D")){
+            binding.tvUserName.visibility  = View.GONE
+            //头像需要占位显示
+            binding.ivAvatar.visibility = View.INVISIBLE
+        }
+
     }
 
     override fun onResume() {

+ 12 - 12
BusinessMain/src/main/res/layout/activity_home.xml

@@ -37,7 +37,17 @@
             android:layout_centerHorizontal="true"
             android:layout_marginTop="@dimen/convert_80px"
             android:src="@drawable/ic_user" />
-
+        <androidx.appcompat.widget.AppCompatTextView
+            android:id="@+id/tv_user_name"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_below="@id/iv_avatar"
+            android:layout_centerHorizontal="true"
+            android:layout_marginTop="@dimen/convert_24px"
+            android:includeFontPadding="false"
+            android:text="@string/login"
+            android:textColor="@color/home_user_name"
+            android:textSize="@dimen/convert_30px" />
         <LinearLayout
             android:id="@+id/history_layout"
             android:layout_width="match_parent"
@@ -203,17 +213,7 @@
                 android:textSize="@dimen/convert_30px" />
         </LinearLayout>
 
-        <androidx.appcompat.widget.AppCompatTextView
-            android:id="@+id/tv_user_name"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/iv_avatar"
-            android:layout_centerHorizontal="true"
-            android:layout_marginTop="@dimen/convert_24px"
-            android:includeFontPadding="false"
-            android:text="@string/login"
-            android:textColor="@color/home_user_name"
-            android:textSize="@dimen/convert_30px" />
+
     </RelativeLayout>
 
 </androidx.drawerlayout.widget.DrawerLayout>

+ 12 - 12
BusinessMain/src/main/res/layout/activity_mode_entrance.xml

@@ -41,7 +41,17 @@
             android:layout_centerHorizontal="true"
             android:layout_marginTop="@dimen/convert_80px"
             android:src="@drawable/ic_user" />
-
+        <androidx.appcompat.widget.AppCompatTextView
+            android:id="@+id/tv_user_name"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_below="@id/iv_avatar"
+            android:layout_centerHorizontal="true"
+            android:layout_marginTop="@dimen/convert_24px"
+            android:includeFontPadding="false"
+            android:text="@string/login"
+            android:textColor="@color/home_user_name"
+            android:textSize="@dimen/convert_30px" />
         <LinearLayout
             android:id="@+id/history_layout"
             android:layout_width="match_parent"
@@ -207,16 +217,6 @@
                 android:textSize="@dimen/convert_30px" />
         </LinearLayout>
 
-        <androidx.appcompat.widget.AppCompatTextView
-            android:id="@+id/tv_user_name"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/iv_avatar"
-            android:layout_centerHorizontal="true"
-            android:layout_marginTop="@dimen/convert_24px"
-            android:includeFontPadding="false"
-            android:text="@string/login"
-            android:textColor="@color/home_user_name"
-            android:textSize="@dimen/convert_30px" />
+
     </RelativeLayout>
 </androidx.drawerlayout.widget.DrawerLayout>

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

@@ -52,8 +52,16 @@ class SettingMainActivity : CommonBindingActivity<ActivitySettingMainBinding>()
         dataList = if (getSN().startsWith("010D")) {
             DataFactory.genSetting010DModesList(resources)
         } else {
-            DataFactory.genSettingModesList(resources)
+            if (getSN().startsWith("032D")){
+                DataFactory.genSetting032DModesList(resources)
+
+            }else{
+                DataFactory.genSettingModesList(resources)
+
+            }
         }
+
+
         binding.tvTitle.updateText(getString(com.develop.common.R.string.settings))
         binding.ivClose.setVisible()
         binding.ivClose.setImageResource(com.develop.common.R.drawable.ic_close)

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

@@ -176,7 +176,11 @@ class WifiListActivity : CommonBindingActivity<ActivityWifiListBinding>(),
     private fun initListener() {
         binding.tvSkin.setOnClickListener {
             if (NetworkUtils.isConnected()) {
-                navigateTo(Screens.Auth.MEMBER)
+                if (getSN().startsWith("032D")){
+                    navigateTo(Screens.Main.ENTRANCE_CHOSEN)
+                }else{
+                    navigateTo(Screens.Auth.MEMBER)
+                }
             } else {
                 navigateTo(Screens.Main.ENTRANCE_CHOSEN)
             }
@@ -189,7 +193,12 @@ class WifiListActivity : CommonBindingActivity<ActivityWifiListBinding>(),
             if (isFromMainSetting) {
                 finish()
             } else {
-                navigateTo(Screens.Auth.MEMBER)
+                if (getSN().startsWith("032D")){
+                    navigateTo(Screens.Main.ENTRANCE_CHOSEN)
+                    finish()
+                }else{
+                    navigateTo(Screens.Auth.MEMBER)
+                }
                 finish()
             }
         }

+ 61 - 57
app/src/main/java/com/develop/foodcooking/FoodCookingApp.kt

@@ -254,63 +254,67 @@ class FoodCookingApp : BaseApp() {
             }
         }
 
-        if (!ledLock) {
-            ledLock = true;
-            if (!pm.isScreenOn) {
-
-                //合盖
-                if (devInfo.potCloverStatus.toInt() == 0) {
-                    CofarSDK.flashWhiteRedLed()
-                } else {
-                    CofarSDK.switchWhiteLed('0');
-                    CofarSDK.flashRedLed()
-                }
-
-            } else {
-                if (devInfo.status == DevStatus.STOP.toInt()) {
-
-                    if (devInfo.potStatus.toInt() == 0) {
-                        if (devInfo.potCloverStatus.toInt() == 0) {
-                            CofarSDK.flashWhiteRedLed()
-                        } else {
-                            CofarSDK.switchWhiteLed('0');
-                            CofarSDK.flashRedLed()
-                        }
-                    } else {
-                        CofarSDK.switchWhiteLed('0');
-                        CofarSDK.flashRedLed();
-                    }
-
-                }
-
-                if (devInfo.status == DevStatus.RUNNING.toInt()) {
-
-                    if (devInfo.temp < 60) {
-                        CofarSDK.switchRedLed('0');
-                        CofarSDK.switchWhiteLed('1');
-                    } else {
-                        CofarSDK.switchRedLed('1');
-                        CofarSDK.switchWhiteLed('0');
-                    }
-
-                }
-
-                if (devInfo.status == DevStatus.PAUSE.toInt()) {
-
-                    //判断盖子是否打开
-                    //合盖
-                    if (devInfo.potCloverStatus.toInt() == 1) {
-                        CofarSDK.switchWhiteLed('0');
-                        CofarSDK.flashRedLed()
-                    } else {
-                        CofarSDK.flashWhiteRedLed()
-                    }
-
-
-                }
-            }
-            ledLock = false;
-        }
+//        if (!ledLock) {
+//            //devInfo.potStatus 0是有锅  1是没锅
+//            //devInfo.potCloverStatus 0是合盖,1是没盒盖
+//            ledLock = true;
+//            //屏幕暗
+//            if (!pm.isScreenOn) {
+//
+//                //合盖
+//                if (devInfo.potCloverStatus.toInt() == 0) {
+//                    CofarSDK.flashWhiteRedLed()
+//                } else {
+//                    CofarSDK.switchWhiteLed('0');
+//                    CofarSDK.flashRedLed()
+//                }
+//
+//            } else {
+//                //屏幕亮
+//                if (devInfo.status == DevStatus.STOP.toInt()) {
+//
+//                    if (devInfo.potStatus.toInt() == 0) {
+//                        if (devInfo.potCloverStatus.toInt() == 0) {
+//                            CofarSDK.flashWhiteRedLed()
+//                        } else {
+//                            CofarSDK.switchWhiteLed('0');
+//                            CofarSDK.flashRedLed()
+//                        }
+//                    } else {
+//                        CofarSDK.switchWhiteLed('0');
+//                        CofarSDK.flashRedLed();
+//                    }
+//
+//                }
+//
+//                if (devInfo.status == DevStatus.RUNNING.toInt()) {
+//
+//                    if (devInfo.temp < 60) {
+//                        CofarSDK.switchRedLed('0');
+//                        CofarSDK.switchWhiteLed('1');
+//                    } else {
+//                        CofarSDK.switchRedLed('1');
+//                        CofarSDK.switchWhiteLed('0');
+//                    }
+//
+//                }
+//
+//                if (devInfo.status == DevStatus.PAUSE.toInt()) {
+//
+//                    //判断盖子是否打开
+//                    //合盖
+//                    if (devInfo.potCloverStatus.toInt() == 1) {
+//                        CofarSDK.switchWhiteLed('0');
+//                        CofarSDK.flashRedLed()
+//                    } else {
+//                        CofarSDK.flashWhiteRedLed()
+//                    }
+//
+//
+//                }
+//            }
+//            ledLock = false;
+//        }
         GlobalDevEvent.globalCoverEvent(event, pm)
     }
 }

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