Browse Source

提交人:jtm
提交内容:002D主页UI

江天明 1 year ago
parent
commit
f22fe967c0

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

@@ -418,6 +418,13 @@ object DataFactory {
         R.drawable.entrance_icon_3,
         R.drawable.entrance_icon_4
     )
+
+    private var icon002DResIds = arrayListOf<Int>(
+        R.drawable.entrance_icon_1_002d,
+        R.drawable.entrance_icon_3_002d,
+        R.drawable.entrance_icon_2_002d,
+        R.drawable.entrance_icon_4_002d
+    )
     private var titleStrIds = mutableListOf<Int>(
         R.string.automatic_recipes,
         R.string.automatic_programmes,
@@ -498,6 +505,19 @@ object DataFactory {
     }
 
 
+    fun get002DEntranceData(): MutableList<EntranceData> {
+        val dataList = mutableListOf<EntranceData>()
+        for (i in iconResIds.indices) {
+            dataList.add(
+                EntranceData(
+                    bg036IResIds[i], icon002DResIds[i], titleStrIds[i], title2StrIds[i], typeList[i]
+                )
+            )
+        }
+        return dataList
+    }
+
+
     fun getNightEntranceData(): MutableList<EntranceData> {
         val dataList = mutableListOf<EntranceData>()
         for (i in iconResIds1.indices) {

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


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


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


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


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


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


+ 7 - 0
BusinessCommon/src/main/res/drawable/shape_25pxffffff_corners.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <corners android:radius="@dimen/convert_25px" />
+    <solid android:color="@color/color_fff" />
+
+</shape>

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

@@ -9,6 +9,7 @@ import androidx.lifecycle.MutableLiveData
 import androidx.recyclerview.widget.RecyclerView
 import androidx.room.Update
 import com.alibaba.android.arouter.facade.annotation.Route
+import com.develop.base.ext.getSN
 import com.develop.base.ext.isBrand036I
 import com.develop.base.ext.isFrLanguage
 import com.develop.base.ext.isNightTheme
@@ -76,6 +77,11 @@ class ModeEntranceActivity : CommonBindingActivity<ActivityModeEntranceBinding>(
 //            }
         }
 
+        if (getSN().startsWith("002D")){
+            binding.ivTab.setImageResource(com.develop.common.R.drawable.ic_more_002d)
+            binding.homeLayout.setBackgroundResource(com.develop.common.R.drawable.home_entrance_bg_002d)
+        }
+
         if (isNightTheme()) {
             binding.entranceRecycle.apply {
                 linear(RecyclerView.HORIZONTAL)
@@ -156,6 +162,89 @@ class ModeEntranceActivity : CommonBindingActivity<ActivityModeEntranceBinding>(
                     }
                 }
             }.models = DataFactory.getNightEntranceData()
+        } else if (getSN().startsWith("002D")){
+            binding.entranceRecycle.apply {
+                grid(2)
+                setup {
+                    addType<EntranceData>(R.layout.item_entrance_002d)
+                    onBind {
+                        val model = getModel<EntranceData>()
+                        findView<AppCompatTextView>(R.id.tv_entrance_name).updateText(
+                            getString(
+                                model.titleStrId
+                            )
+                        )
+                        findView<ImageView>(R.id.iv_icon).setBackgroundResource(model.iconResId)
+                    }
+                    R.id.entrance_item.onClick {
+                        val clickModel = getModel<EntranceData>()
+                        title = getString(clickModel.title2StrId)
+                        when (clickModel.type) {
+                            EntranceType.automatic_recipes -> {
+                                if (FoodDataProvider.checkDataExit()) {
+                                    val bundle = Bundle()
+                                    bundle.putInt(MODE_ENTRANCE, Recipes)
+                                    bundle.putInt(RECIPES_TYPE, LocalFood)
+                                    bundle.putString(HOME_TITLE, title)
+                                    navigateTo(Screens.Main.HOME) {
+                                        with(bundle)
+                                    }
+                                } else {
+                                    showLoading()
+                                }
+                            }
+
+                            EntranceType.automatic_programmes -> {
+                                if (FoodDataProvider.checkDataExit()) {
+                                    val bundle = Bundle()
+                                    bundle.putInt(MODE_ENTRANCE, Mode)
+                                    bundle.putString(HOME_TITLE, title)
+                                    navigateTo(Screens.Main.HOME) {
+                                        with(bundle)
+                                    }
+                                } else {
+                                    showLoading()
+                                }
+
+                            }
+
+                            EntranceType.manual_cooking -> {
+                                if (FoodDataProvider.checkDataExit()) {
+                                    navigateTo(Screens.Cook.COOK_MODES) {
+                                        if(DevModes.SOUP == CofarSDK.devInfo().devMode){
+                                            val bundle = Bundle()
+                                            bundle.putString(MODE_TYPE, WorkModes.ADAPTED_COOKING)
+                                            bundle.putString("mode_name",resources.getString(com.develop.common.R.string.adapted_cooking))
+                                            with(bundle)
+                                        }else{
+                                            val bundle = Bundle()
+                                            bundle.putString(MODE_TYPE, WorkModes.AF_DIY)
+                                            with(bundle)
+                                        }
+                                    }
+                                } else {
+                                    showLoading()
+                                }
+                            }
+
+                            EntranceType.download_new_recipes -> {
+                                if (FoodDataProvider.checkDataExit()) {
+                                    val bundle = Bundle()
+                                    bundle.putInt(MODE_ENTRANCE, Recipes)
+                                    bundle.putInt(RECIPES_TYPE, NetFood)
+                                    bundle.putString(HOME_TITLE, title)
+                                    navigateTo(Screens.Main.HOME) {
+                                        with(bundle)
+                                    }
+                                } else {
+                                    showLoading()
+                                }
+
+                            }
+                        }
+                    }
+                }
+            }.models = DataFactory.get002DEntranceData()
         } else {
             binding.entranceRecycle.apply {
                 grid(2)

+ 1 - 0
BusinessMain/src/main/res/layout/activity_mode_entrance.xml

@@ -5,6 +5,7 @@
     android:layout_height="match_parent">
 
     <FrameLayout
+        android:id="@+id/home_layout"
         android:layout_width="match_parent"
         android:layout_height="match_parent">
 

+ 27 - 0
BusinessMain/src/main/res/layout/item_entrance_002d.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/entrance_item"
+    android:layout_width="@dimen/convert_460px"
+    android:layout_height="@dimen/convert_300px"
+    android:layout_marginStart="@dimen/convert_100px"
+    android:layout_marginEnd="@dimen/convert_40px"
+    android:layout_marginTop="@dimen/convert_70px"
+    android:background="@drawable/shape_25pxffffff_corners">
+
+    <androidx.appcompat.widget.AppCompatTextView
+        android:id="@+id/tv_entrance_name"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="@dimen/convert_36px"
+        android:layout_marginTop="@dimen/convert_36px"
+        android:textColor="@color/black"
+        android:textSize="@dimen/convert_36px" />
+
+    <ImageView
+        android:id="@+id/iv_icon"
+        android:layout_width="@dimen/convert_134px"
+        android:layout_height="@dimen/convert_134px"
+        android:layout_alignParentBottom="true"
+        android:layout_marginStart="@dimen/convert_24px"
+        android:layout_marginBottom="@dimen/convert_24px" />
+</RelativeLayout>

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

@@ -189,7 +189,7 @@ fun getBrandNum(): String {
 fun getSN(): String {
     var serial: String
 
-    return "000A20010020123010190001"
+    return "002D21020020123010190001"
     //通过反射获取sn号
     try {
         val c = Class.forName("android.os.SystemProperties")