Kaynağa Gözat

提交人:jtm
提交内容:bug fixed

江天明 1 yıl önce
ebeveyn
işleme
9441f8052a

+ 4 - 4
BusinessAuth/src/main/java/com/develop/auth/ui/MemberProfileFragment.kt

@@ -139,10 +139,10 @@ class MemberProfileFragment : CommonBVMFragment<FragmentMemberProfileBinding, Me
             showToast("Please fill in nickname")
             return
         }
-        if (age == 0) {
-            showToast("Please fill in age")
-            return
-        }
+//        if (age == 0) {
+//            showToast("Please fill in age")
+//            return
+//        }
         showPlainDialog(true)
         viewModel.perfectInfo(nickname, sex.toString(), portrait.toString(), age.toString())
     }

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


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


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

@@ -19,6 +19,7 @@ import com.develop.common.data_repo.FoodDataProvider
 import com.develop.base.util.MMkvUtils
 import com.develop.common.data_repo.db.DataFactory
 import com.develop.common.data_repo.db.RecipesType
+import com.develop.common.data_repo.db.entity.UserInfo
 import com.develop.common.dialog.LoadingDialog
 import com.develop.common.router.Screens
 import com.develop.common.tag.*
@@ -291,6 +292,11 @@ class ModeEntranceActivity : CommonBindingActivity<ActivityModeEntranceBinding>(
         super.onResume()
         AppVersionUtil.checkRecipeUpdate(false)
 //        UpdateUtil.checkApkVersion(false)
+        val userInfo = FoodDataProvider
+            .getUserDatabase()
+            .userInfoDao()
+            .queryUserInfoByUserId(CURRENT_USER_ID)
+        updateUserInfoUi(userInfo)
     }
 
 
@@ -299,6 +305,42 @@ class ModeEntranceActivity : CommonBindingActivity<ActivityModeEntranceBinding>(
         loadingDialog.removeSelf()
     }
 
+
+    private fun updateUserInfoUi(userInfo: UserInfo?) {
+        if (userInfo?.userName != null) {
+            binding.tvUserName.text = userInfo.userName ?: ""
+            val icon = when (userInfo.userAvatar?.toInt() ?: 0) {
+                0 -> {
+                    com.develop.common.R.drawable.ic_icon1
+                }
+
+                1 -> {
+                    com.develop.common.R.drawable.ic_icon2
+                }
+
+                2 -> {
+                    com.develop.common.R.drawable.ic_icon3
+                }
+
+                3 -> {
+                    com.develop.common.R.drawable.ic_icon4
+                }
+
+                4 -> {
+                    com.develop.common.R.drawable.ic_icon5
+                }
+
+                else -> {
+                    com.develop.common.R.drawable.ic_icon6
+                }
+            }
+            binding.ivAvatar.src = icon
+        } else {
+            binding.ivAvatar.src = com.develop.common.R.drawable.ic_user
+            binding.tvUserName.text = getString(com.develop.common.R.string.login)
+        }
+    }
+
     private fun showLoading() {
         isShowLoading = true
         loadingDialog.showDialog(supportFragmentManager, "Loading")

+ 27 - 84
BusinessStep/src/main/java/com/develop/step/ui/cook_step/CookStepActivity.kt

@@ -6,6 +6,7 @@ import android.util.Log
 import android.view.KeyEvent
 import android.view.View
 import android.widget.Toast
+import androidx.core.graphics.drawable.DrawableCompat
 import androidx.core.view.isInvisible
 import com.alibaba.android.arouter.facade.annotation.Autowired
 import com.develop.base.ext.load
@@ -99,17 +100,16 @@ class CookStepActivity : CookStepBaseActivity() {
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
 
-        //隐藏称重与电动
-        if (!isNightTheme()) {
-            binding.viewChangeCrush.setGone()
-            binding.viewChangeWeight.setGone()
-        }
-
         if (!isNightTheme()) {
             binding.viewChangeCrush.setBgColor(R.color.view_change)
             binding.viewChangeWeight.setBgColor(R.color.view_change)
             binding.viewRemark.setBgColor(R.color.view_change)
             binding.viewNote.setVisible()
+            binding.viewChangeWeight.src = R.drawable.ic_detail_tab_1_normal
+            binding.viewChangeCrush.src = R.drawable.ic_cooking_weight_normal
+            binding.viewWeightClose.drawable?.apply {
+                DrawableCompat.setTint(this, resources.getColor(R.color.white))
+            }
         } else {
             binding.viewChangeCrush.setBgColor(R.color.white)
             binding.viewChangeWeight.setBgColor(R.color.white)
@@ -162,38 +162,10 @@ class CookStepActivity : CookStepBaseActivity() {
         }
 
         binding.viewChangeWeight.setOnClickListener {
-            if (isNightTheme()) {
-                //此主题下,点击显示食材
-                navigateTo(Screens.Cook.COOK_SOURCE) {
-                    withString("cook_step_detail", cookStepDetail)
-                    withString("portionSizelJson", portionSizelJson)
-                }
-            } else {
-                if (currModes != "WIGHT" && currModes != "WEIGH" && currModes != "WEIGHT") {
-                    binding.viewWeightClose1.setVisible()
-                    binding.viewChangeWeight.visibility = View.INVISIBLE
-                }
-                if (CofarSDK.devInfo().status == DevStatus.RUNNING.toInt()) {
-                    Toast.makeText(this, "Step is running!", Toast.LENGTH_SHORT).show()
-                    return@setOnClickListener
-                }
-                val weightSelected = binding.viewChangeWeight.isSelected
-                if (weightSelected) {
-                    CofarSDK.stoptWeight()
-                    viewModel.setDisplayStep(viewModel.stepIndex, force = true)
-                } else {
-                    if (!isNightTheme()) {
-                        binding.ivPrevStep.setGone()
-                        binding.ivNextStep.setGone()
-                    }
-                    CofarSDK.changeMode(
-                        "$recipeNumber:${viewModel.stepIndex}",
-                        CofarSDK.devMode("WEIGHT")
-                    )
-                    changeWeightPanel()
-                    CofarSDK.stoptWeight()
-                    CofarSDK.startWeight()
-                }
+            //此主题下,点击显示食材
+            navigateTo(Screens.Cook.COOK_SOURCE) {
+                withString("cook_step_detail", cookStepDetail)
+                withString("portionSizelJson", portionSizelJson)
             }
         }
 
@@ -245,56 +217,27 @@ class CookStepActivity : CookStepBaseActivity() {
 
 
         binding.viewChangeCrush.setOnClickListener {
-            if (isNightTheme()) {
-                if (currModes != "WIGHT" && currModes != "WEIGH" && currModes != "WEIGHT") {
-                    binding.viewWeightClose.setVisible()
-                    binding.viewChangeCrush.visibility = View.INVISIBLE
-                }
-                //此主题下,点餐是称重
-                if (CofarSDK.devInfo().status == DevStatus.RUNNING.toInt()) {
-                    Toast.makeText(this, "Step is running!", Toast.LENGTH_SHORT).show()
-                    return@setOnClickListener
-                }
-                val weightSelected = binding.viewChangeWeight.isSelected
-                if (weightSelected) {
-                    CofarSDK.stoptWeight()
-                    viewModel.setDisplayStep(viewModel.stepIndex, force = true)
-                } else {
-                    if (!isNightTheme()) {
-                        binding.ivPrevStep.setGone()
-                        binding.ivNextStep.setGone()
-                    }
+            if (currModes != "WIGHT" && currModes != "WEIGH" && currModes != "WEIGHT") {
+                binding.viewWeightClose.setVisible()
+                binding.viewChangeCrush.visibility = View.INVISIBLE
+            }
+            //此主题下,点餐是称重
+            if (CofarSDK.devInfo().status == DevStatus.RUNNING.toInt()) {
+                Toast.makeText(this, "Step is running!", Toast.LENGTH_SHORT).show()
+                return@setOnClickListener
+            }
+            val weightSelected = binding.viewChangeWeight.isSelected
+            if (weightSelected) {
+                CofarSDK.stoptWeight()
+                viewModel.setDisplayStep(viewModel.stepIndex, force = true)
+            } else {
 //                    CofarSDK.changeMode(
 //                        "$recipeNumber:${viewModel.stepIndex}",
 //                        CofarSDK.devMode("WEIGHT")
 //                    )
-                    changeWeightPanel()
-                    CofarSDK.stoptWeight()
-                    CofarSDK.startWeight()
-                }
-            } else {
-                if (CofarSDK.devInfo().status == DevStatus.RUNNING.toInt()) {
-                    Toast.makeText(this, "Step is running!", Toast.LENGTH_SHORT).show()
-                    return@setOnClickListener
-                }
-                val turboSelected = binding.viewChangeCrush.isSelected
-                if (turboSelected) {
-                    CofarSDK.stoptWeight()
-                    viewModel.setDisplayStep(viewModel.stepIndex, force = true)
-                } else {
-                    if (!isNightTheme()) {
-                        binding.ivPrevStep.setGone()
-                        binding.ivNextStep.setGone()
-                    }
-                    CofarSDK.changeMode(
-                        "$recipeNumber:${viewModel.stepIndex}",
-                        CofarSDK.devMode("TURBO")
-                    )
-                    CofarSDK.stoptWeight()
-                    changeTurboPanel()
-                }
-                binding.viewChangeWeight.isSelected = false
-                binding.viewChangeCrush.isSelected = !turboSelected
+                changeWeightPanel()
+                CofarSDK.stoptWeight()
+                CofarSDK.startWeight()
             }
 
         }

+ 7 - 0
BusinessStep/src/main/java/com/develop/step/ui/recipes_detail/CookSourceActivity.kt

@@ -2,9 +2,11 @@ package com.develop.step.ui.recipes_detail
 
 import android.os.Bundle
 import android.view.LayoutInflater
+import androidx.core.graphics.drawable.DrawableCompat
 import com.alibaba.android.arouter.facade.annotation.Autowired
 import com.alibaba.android.arouter.facade.annotation.Route
 import com.alibaba.android.arouter.launcher.ARouter
+import com.develop.base.ext.isNightTheme
 import com.develop.base.mvvm.BaseBVMActivity
 import com.develop.common.data_repo.db.entity.DevRecipePortionSize
 import com.develop.common.router.Screens
@@ -48,5 +50,10 @@ class CookSourceActivity:BaseBVMActivity<ActivityCookSourceBinding, CookDetailVi
         binding.ivClose.setOnClickListener {
             finish()
         }
+        if (!isNightTheme()) {
+            binding.ivClose.drawable?.apply {
+                DrawableCompat.setTint(this, resources.getColor(com.develop.common.R.color.black))
+            }
+        }
     }
 }

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

@@ -188,8 +188,26 @@ fun getBrandNum(): String {
  */
 fun getSN(): String {
     var serial: String
-
-    return "036I21060020123010190001"
+//    //通过android.os获取sn号
+////    val append = "03403015"
+//    var append = "01703015"
+//    val plInfo = GlobalApp().applicationContext.packageManager.getPackageInfo(
+//        GlobalApp().applicationContext.packageName,
+//        PackageManager.GET_META_DATA
+//    )
+//    var vi = plInfo.versionName.split(".");
+//    append = (vi[1] + vi[0])
+//    try {
+//        serial = getWifiMacAddress(globalApp().applicationContext).uppercase()
+//        return if (serial != "" && serial != "unknown") "${append}${
+//            serial.replace3
+//                ":",
+//                ""
+//            )
+//        }" else "${append}8888"
+//    } catch (e: java.lang.Exception) {
+//        serial = "${append}8888"
+//    }
 
     //通过反射获取sn号
     try {
@@ -203,7 +221,7 @@ fun getSN(): String {
     } catch (e: java.lang.Exception) {
         serial = "unknown"
     }
-    return "036I21060020123010190001"
+    return serial
 }
 
 fun ImageView.load(data: Any?) {