Browse Source

提交人:江天明
提交内容:优化

江天明 1 year ago
parent
commit
552f2c8fe9
29 changed files with 339 additions and 36 deletions
  1. 3 0
      BusinessMain/src/main/java/com/develop/main/init/ui/viewmodel/HomeViewModel.kt
  2. 45 1
      BusinessStep/src/main/java/com/develop/step/CookStepActivity2.kt
  3. 85 9
      BusinessStep/src/main/java/com/develop/step/CookStepToolActivity.kt
  4. 11 0
      BusinessStep/src/main/java/com/develop/step/details/CookDetailActivity.kt
  5. 4 2
      BusinessStep/src/main/java/com/develop/step/details/CookDetailSourceAdapter.kt
  6. 16 6
      BusinessStep/src/main/java/com/develop/step/modes/ModesDetailActivity.kt
  7. 54 8
      BusinessStep/src/main/res/layout/activity_food_step2.xml
  8. 27 0
      BusinessStep/src/main/res/layout/item_cook_source_1.xml
  9. 1 1
      app/build.gradle
  10. BIN
      app/src/main/assets/skins/night.skin
  11. 2 0
      libBase/src/main/java/com/develop/food/base/repo/db/dao/FoodRecipeDao.kt
  12. 13 1
      libBase/src/main/java/com/develop/food/base/utils/AppVerUtils.kt
  13. 34 2
      libBase/src/main/java/com/develop/food/base/utils/FileKit.kt
  14. 1 1
      libBase/src/main/java/com/develop/food/base/utils/GlobalExt.kt
  15. 3 4
      libBase/src/main/java/com/develop/food/base/utils/LogRequestUtil.kt
  16. 34 0
      libBase/src/main/java/com/develop/food/base/widgets/CircleBgImageView.kt
  17. BIN
      libBase/src/main/res/drawable-xxxhdpi/ic_cook_source.png
  18. BIN
      libBase/src/main/res/drawable-xxxhdpi/ic_cook_weight.png
  19. BIN
      libBase/src/main/res/drawable-xxxhdpi/ic_remark.png
  20. BIN
      libBase/src/main/res/drawable-xxxhdpi/view_step.png
  21. BIN
      libBase/src/main/res/drawable-xxxhdpi/view_weight.png
  22. BIN
      libBase/src/main/res/drawable-xxxhdpi/view_weight_close.png
  23. 3 0
      libBase/src/main/res/values/colors.xml
  24. 3 1
      libBase/src/main/res/values/styles.xml
  25. BIN
      libThirdParty/libs/cofar-cooking-device-sdk-0.0.1-SNAPSHOT.jar
  26. BIN
      skin-support/src/main/res/drawable/ic_cook_source.png
  27. BIN
      skin-support/src/main/res/drawable/view_remark.png
  28. BIN
      skin-support/src/main/res/drawable/view_weight.png
  29. BIN
      skin-support/src/main/res/drawable/view_weight_close.png

+ 3 - 0
BusinessMain/src/main/java/com/develop/main/init/ui/viewmodel/HomeViewModel.kt

@@ -68,6 +68,9 @@ class HomeViewModel : ViewModel() {
                     size.toString()
                 }
             }
+            result.sortBy {
+                it.name
+            }
             categorySizeList.forEach {
                 allSize += it.value.toInt()
             }

+ 45 - 1
BusinessStep/src/main/java/com/develop/step/CookStepActivity2.kt

@@ -100,6 +100,35 @@ class CookStepActivity2 : CookStepToolActivity() {
                 binding.viewAlarm.setBackgroundResource(R.drawable.ic_alarm)
             }
         }
+
+        binding.viewWeight.setOnClickListener {
+            changeWeightPanel()
+            CofarSDK.stoptWeight()
+            CofarSDK.startWeight()
+            binding.viewWeightClose.setVisible()
+            binding.viewWeight.setGone()
+        }
+
+        binding.viewWeightClose.setOnClickListener {
+            CofarSDK.stoptWeight()
+            binding.viewWeightClose.setGone()
+            binding.viewWeight.setVisible()
+            if (viewModel.displayStep()?.isWeightMode() == true) {
+                changeWeightPanel()
+                CofarSDK.stoptWeight()
+                CofarSDK.startWeight()
+            } else if (viewModel.displayStep()?.isTurboMode() == true) {
+                CofarSDK.stoptWeight()
+                changeTurboPanel()
+            } else if (viewModel.displayStep()?.isDescription() == true) {
+                CofarSDK.stoptWeight()
+                changeDescription()
+            } else {
+                CofarSDK.stoptWeight()
+                changeTempSettingPanel()
+            }
+        }
+
         initData()
 
         binding.viewRemark.setOnClickListener {
@@ -170,7 +199,7 @@ class CookStepActivity2 : CookStepToolActivity() {
                 cookProgressDrawable.setStepState(stepIndex, stepCount)
                 binding.tvStepName.text = getText(R.string.engjoy_your_meal)
                 binding.tvTitleStep.text = getText(R.string.recipe_complete)
-
+                binding.viewWeight.setGone()
                 if (stepCount == 1) {
                     binding.ivPrevStep.setGone()
                     binding.ivNextStep.setGone()
@@ -203,17 +232,23 @@ class CookStepActivity2 : CookStepToolActivity() {
                         CofarSDK.devMode(it.workMode)
                     )
                 }
+                binding.viewWeight.setVisible()
                 if (it.isWeightMode()) {
+                    binding.viewWeight.setGone()
+                    binding.viewWeightClose.setGone()
                     changeWeightPanel()
                     CofarSDK.stoptWeight()
                     CofarSDK.startWeight()
                 } else if (it.isTurboMode()) {
+                    binding.viewWeight.setGone()
+                    binding.viewWeightClose.setGone()
                     CofarSDK.stoptWeight()
                     changeTurboPanel()
                 } else if (it.isDescription()) {
                     CofarSDK.stoptWeight()
                     changeDescription()
                 } else {
+                    binding.viewWeight.setVisible()
                     CofarSDK.stoptWeight()
                     changeTempSettingPanel()
                 }
@@ -504,6 +539,11 @@ class CookStepActivity2 : CookStepToolActivity() {
             CofarSDK.cancel()
             binding.controller.btnStart.setGone()
             binding.controller.btnReset.setGone()
+        } else if (tag == BUTTON_TAG_NEXT_STEP) {
+            viewModel.cookingStep?.let {
+                val nextStep = viewModel.getNextStep(it) ?: return@let
+                viewModel.setTargetCookingStep(nextStep)
+            }
         }
     }
 
@@ -1101,6 +1141,10 @@ class CookStepActivity2 : CookStepToolActivity() {
                 viewModel.cookingStep?.let { updateUiSetting(it, true) }
             }
 
+            if (CommonEventTypes.CONFIRM_STOP == event.type || CommonEventTypes.AUTO_STOP == event.type) {
+                clickNextStep();
+            }
+
             if (CommonEventTypes.MOTOR_GEAR_RATHER_THEN_4_WITH_TEMP == event.type) {
                 CofarSDK.cfgMotorGear(4)
                 viewModel.cookingStep?.let { updateUiSetting(it, true) }

+ 85 - 9
BusinessStep/src/main/java/com/develop/step/CookStepToolActivity.kt

@@ -10,10 +10,12 @@ import android.view.View
 import android.view.animation.LinearInterpolator
 import android.widget.TextView
 import androidx.activity.viewModels
+import androidx.recyclerview.widget.RecyclerView
 import com.alibaba.android.arouter.facade.annotation.Autowired
 import com.alibaba.android.arouter.launcher.ARouter
 import com.develop.food.base.data.ModesType
 import com.develop.food.base.data.model.CookSettingType
+import com.develop.food.base.repo.entity.DevRecipePortionSize
 import com.develop.food.base.ui.BaseActivity
 import com.develop.food.base.utils.ThreadUtils
 import com.develop.food.base.utils.updateText
@@ -21,13 +23,18 @@ import com.develop.food.base.widgets.BCustomerLinearLayout
 import com.develop.food.base.widgets.CancelConfirmDialog
 import com.develop.food.base.widgets.CookProgressDrawable
 import com.develop.step.databinding.ActivityFoodStep2Binding
+import com.develop.step.details.CookDetailSourceAdapter
+import com.develop.step.details.CookSourceItem
+import com.develop.step.model.CookDetailInfo
 import com.develop.step.viewmodel.CookStepViewModel
 import com.develop.step.widgets.NoteEditDialog
 import com.develop.step.widgets.RingControlView
+import com.google.gson.Gson
 import com.kuyuntech.cofarcooking.device.sdk.eventbus.core.DevInfo
 import com.kuyuntech.cofarcooking.device.sdk.eventbus.event.DevStatusEvent
 import com.kuyuntech.cofarcooking.device.sdk.util.core.CofarSDK
 import org.greenrobot.eventbus.Subscribe
+import java.math.BigDecimal
 import java.util.*
 
 abstract class CookStepToolActivity : BaseActivity<ActivityFoodStep2Binding>() {
@@ -56,9 +63,19 @@ abstract class CookStepToolActivity : BaseActivity<ActivityFoodStep2Binding>() {
     protected var whereIndex = -1
 
     private var isCookDetailDialogShow = false
+    private var isCookStepDialogShow = false
     private var rotateAnimator: ObjectAnimator? = null
     private var rotateAnimDir = -1
 
+    @JvmField
+    @Autowired(name = "cook_step_detail")
+    var cookStepDetail: String? = null
+
+
+    @JvmField
+    @Autowired(name = "portionSizelJson")
+    var portionSizelJson: String? = null
+
     abstract fun clickNextStep()
 
     abstract fun clickPrevStep()
@@ -89,10 +106,10 @@ abstract class CookStepToolActivity : BaseActivity<ActivityFoodStep2Binding>() {
 //        EventBus.getDefault().register(this)
         binding.viewProgress.background = cookProgressDrawable
         binding.tvTitleStep.setOnClickListener {
-            showCookDetailDialog()
+            //showCookDetailDialog()
         }
         binding.tvStepName.setOnClickListener {
-            showCookDetailDialog()
+            showCookStepDetailDialog()
         }
         binding.viewRemark.setOnClickListener {
             NoteEditDialog().showDialog(supportFragmentManager, "NoteEditDialog")
@@ -131,6 +148,15 @@ abstract class CookStepToolActivity : BaseActivity<ActivityFoodStep2Binding>() {
                 finish()
             }
         }
+
+        binding.viewSource.setOnClickListener {
+            showCookSourceDialog()
+        }
+
+        binding.viewStepMark.setOnClickListener {
+            showCookStepDetailDialog()
+        }
+
         binding.controller.btnStart.setOnClickListener {
             clickFirstButton((it.tag as? String) ?: BUTTON_TAG_START)
             viewModel.stepUiData.doingModify = false
@@ -166,6 +192,7 @@ abstract class CookStepToolActivity : BaseActivity<ActivityFoodStep2Binding>() {
                 MotionEvent.ACTION_DOWN -> {
                     turboDownEvent()
                 }
+
                 MotionEvent.ACTION_CANCEL, MotionEvent.ACTION_UP -> {
                     turboUpEvent()
                 }
@@ -223,7 +250,7 @@ abstract class CookStepToolActivity : BaseActivity<ActivityFoodStep2Binding>() {
             binding.controller.ivDirection.rotationY = 0f
             binding.controller.tvTurnRight.setTextColor(0xffE60012.toInt())
             binding.controller.tvTurnLeft.setTextColor(0xffE5E5E5.toInt())
-            binding.controller.tvSetDirection.updateText(getString(R.string.turn_left ))
+            binding.controller.tvSetDirection.updateText(getString(R.string.turn_left))
         }
     }
 
@@ -233,7 +260,7 @@ abstract class CookStepToolActivity : BaseActivity<ActivityFoodStep2Binding>() {
         binding.ivTurboView.visibility = View.GONE
     }
 
-    fun changeDescription(){
+    fun changeDescription() {
         binding.controller.root.visibility = View.GONE
         binding.llWeightView.visibility = View.GONE
         binding.ivTurboView.visibility = View.GONE
@@ -258,12 +285,12 @@ abstract class CookStepToolActivity : BaseActivity<ActivityFoodStep2Binding>() {
         }
 
         //蒸汽模式特殊处理
-        if(viewModel.displayStep()?.workMode == ModesType.STEAM.name){
+        if (viewModel.displayStep()?.workMode == ModesType.STEAM.name) {
             binding.controller.steamFire.visibility = View.VISIBLE;
             binding.controller.tvRingTempText.visibility = View.GONE;
             binding.controller.steamFireSmall.visibility = View.VISIBLE;
             binding.controller.tvCookingTempTarget.visibility = View.GONE;
-        }else{
+        } else {
             binding.controller.steamFire.visibility = View.GONE;
             binding.controller.tvRingTempText.visibility = View.VISIBLE;
             binding.controller.steamFireSmall.visibility = View.GONE;
@@ -355,6 +382,7 @@ abstract class CookStepToolActivity : BaseActivity<ActivityFoodStep2Binding>() {
                     viewBackgroundTemp.isSelected = true
                     viewIconTemp.isSelected = true
                 }
+
                 CookSettingType.TIME_SETTING -> {
                     viewSelectTime.visibility = View.VISIBLE
                     tvSetTime.isSelected = true
@@ -362,6 +390,7 @@ abstract class CookStepToolActivity : BaseActivity<ActivityFoodStep2Binding>() {
                     viewBackgroundTime.isSelected = true
                     viewIconTime.isSelected = true
                 }
+
                 CookSettingType.SPEED_SETTING -> {
                     viewSelectSpeed.visibility = View.VISIBLE
                     tvSetSpeed.isSelected = true
@@ -369,6 +398,7 @@ abstract class CookStepToolActivity : BaseActivity<ActivityFoodStep2Binding>() {
                     viewBackgroundSpeed.isSelected = true
                     viewIconSpeed.isSelected = true
                 }
+
                 CookSettingType.DIRECTION_SETTING -> {
                     viewSelectDirection.visibility = View.VISIBLE
                     tvSetDirection.isSelected = true
@@ -376,6 +406,7 @@ abstract class CookStepToolActivity : BaseActivity<ActivityFoodStep2Binding>() {
                     viewBackgroundDirection.isSelected = true
                     viewIconDirection.isSelected = true
                 }
+
                 else -> {}
             }
         }
@@ -385,7 +416,7 @@ abstract class CookStepToolActivity : BaseActivity<ActivityFoodStep2Binding>() {
         return binding.controller.root.tag as? CookSettingType ?: CookSettingType.TEMP_SETTING
     }
 
-    private fun showCookDetailDialog() {
+    private fun showCookStepDetailDialog() {
         if (!isCookDetailDialogShow) {
             val dialogView = layoutInflater.inflate(
                 R.layout.item_cook_details, binding.flCookDetails, true
@@ -401,6 +432,50 @@ abstract class CookStepToolActivity : BaseActivity<ActivityFoodStep2Binding>() {
         }
     }
 
+    private val adapter = CookDetailSourceAdapter()
+
+    private fun showCookSourceDialog() {
+        if (!isCookStepDialogShow) {
+            adapter.colorResId = R.color.color_333333
+            val dialogView = layoutInflater.inflate(
+                R.layout.item_cook_source_1, binding.flCookDetails, true
+            )
+            val rlView = dialogView.findViewById<RecyclerView>(R.id.rv_list)
+            rlView.adapter = adapter
+
+            val cookDetailInfo = Gson().fromJson(cookStepDetail, CookDetailInfo::class.java)
+            val portionSize = Gson().fromJson(portionSizelJson, DevRecipePortionSize::class.java)
+
+            val sourceItems = mutableListOf<CookSourceItem>()
+            val originalList = mutableListOf<CookSourceItem>()
+            for (recipeFood in cookDetailInfo.material) {
+                val sourceItem = CookSourceItem(
+                    recipeFood.foodName ?: "",
+                    "${
+                        BigDecimal.valueOf(recipeFood.amount ?: 0f.toDouble()).stripTrailingZeros()
+                            .toPlainString()
+                    } ${recipeFood.unit}"
+                )
+                if (recipeFood.recipePortionSizeNumber == portionSize.portionSize) {
+                    sourceItems.add(sourceItem)
+                }
+                originalList.add(sourceItem)
+            }
+            if (sourceItems.isEmpty()) {
+                // 防止没有任何数据显示
+                sourceItems.addAll(originalList)
+            }
+            adapter.setNewInstance(sourceItems)
+            val closeView = dialogView.findViewById<View>(R.id.iv_close)
+            isCookStepDialogShow = true
+            closeView.setOnClickListener {
+                isCookStepDialogShow = false
+                binding.flCookDetails.removeAllViews()
+            }
+        }
+    }
+
+
     @Subscribe
     fun onDevStateEvent(event: DevStatusEvent) {
         ThreadUtils.runOnMainThread {
@@ -422,13 +497,13 @@ abstract class CookStepToolActivity : BaseActivity<ActivityFoodStep2Binding>() {
         if (rotateAnimator!!.isRunning) {
             if (direction == rotateAnimDir) {
                 return
-            }else {
+            } else {
                 rotateAnimator?.cancel()
             }
         }
         if (direction != 0) {
             rotateAnimator?.reverse()
-        }else {
+        } else {
             rotateAnimator?.start()
         }
         rotateAnimDir = direction
@@ -477,5 +552,6 @@ abstract class CookStepToolActivity : BaseActivity<ActivityFoodStep2Binding>() {
         const val BUTTON_TAG_RESET = "reset"
         const val BUTTON_TAG_CONFIRM = "confirm"
         const val BUTTON_TAG_CANCEL = "cancel"
+        const val BUTTON_TAG_NEXT_STEP = "next"
     }
 }

+ 11 - 0
BusinessStep/src/main/java/com/develop/step/details/CookDetailActivity.kt

@@ -58,6 +58,9 @@ class CookDetailActivity : BaseActivity<ActivityCookDetailBinding>() {
     @Autowired(name = "recipesEdition")
     var recipesEdition: String? = "1.0"
 
+    private var cookDetailJson: String? = null
+    private var portionSizelJson: String? = null
+
     private var hideDetail = false
     private val hideViews = mutableListOf<View>()
     private val allTabViews = mutableListOf<View>()
@@ -110,6 +113,9 @@ class CookDetailActivity : BaseActivity<ActivityCookDetailBinding>() {
                 if (viewModel.isDownloadSuccess()) {
                     navigateTo(Screens.Cook.COOK_STEP2) {
                         withString("number", recipeNumber)
+                        withBoolean("isLike", isLike)
+                        withString("cook_step_detail", cookDetailJson)
+                        withString("portionSizelJson", portionSizelJson)
                     }
                 } else if (!viewModel.isDownloading()) {
                     binding.tvDownload.setText(R.string.downloading)
@@ -118,6 +124,9 @@ class CookDetailActivity : BaseActivity<ActivityCookDetailBinding>() {
             } else {
                 navigateTo(Screens.Cook.COOK_STEP2) {
                     withString("number", recipeNumber)
+                    withBoolean("isLike", isLike)
+                    withString("cook_step_detail", cookDetailJson)
+                    withString("portionSizelJson", portionSizelJson)
                 }
             }
         }
@@ -300,6 +309,7 @@ class CookDetailActivity : BaseActivity<ActivityCookDetailBinding>() {
             if (it != null) {
                 val jarsCount = (it.portionSize ?: 1).toString() + " " + getString(R.string.jar)
                 binding.tvJarCount.text = jarsCount
+                portionSizelJson = it.toJson()
             }
         }
     }
@@ -521,6 +531,7 @@ class CookDetailActivity : BaseActivity<ActivityCookDetailBinding>() {
         )
         viewModel.getStarCount(recipeNumber ?: "")
         viewModel.getRecipeLiveData().observe(this) {
+            cookDetailJson = it.toJson()
             updateCookDetail(it)
         }
         isLike = FoodDataProvider

+ 4 - 2
BusinessStep/src/main/java/com/develop/step/details/CookDetailSourceAdapter.kt

@@ -10,10 +10,12 @@ import com.develop.step.R
 class CookDetailSourceAdapter: BaseQuickAdapter<CookSourceItem, BaseViewHolder>(
     R.layout.item_cook_source
 ) {
+
+    var colorResId = R.color.color_fff
     override fun convert(holder: BaseViewHolder, item: CookSourceItem) {
         if (isNightTheme()){
-            holder.getView<MarqueeTextView>(R.id.tv_source_name).setTextColor(context.resources.getColor(R.color.color_fff))
-            holder.getView<TextView>(R.id.tv_source_amount).setTextColor(context.resources.getColor(R.color.color_fff))
+            holder.getView<MarqueeTextView>(R.id.tv_source_name).setTextColor(context.resources.getColor(colorResId))
+            holder.getView<TextView>(R.id.tv_source_amount).setTextColor(context.resources.getColor(colorResId))
         }
         holder.setText(R.id.tv_source_name, item.name)
         holder.setText(R.id.tv_source_amount, item.amount)

+ 16 - 6
BusinessStep/src/main/java/com/develop/step/modes/ModesDetailActivity.kt

@@ -640,6 +640,11 @@ class ModesDetailActivity : BaseActivity<ActivityModeDetailBinding>() {
         if (!initModeData || turboLock) {
             return
         }
+        Log.d(
+            "dddddddd", "targetTime==${event.devInfo.targetTime}" +
+                    "==remainTime==${event.devInfo.remainTime}==targetTimeBuffer==${event.devInfo.targetTimeBuffer}" +
+                    "==minTime==${event.devInfo.mode.minTime}==maxTime==${event.devInfo.mode.maxTime}===potCloverEleStatus==${currDevInfo.potCloverEleStatus}"
+        )
         ThreadUtils.runOnMainThread {
             if (BuildConfig.DEBUG) {
                 //Log.d("ddddddddd", event.devInfo.toJson())
@@ -656,15 +661,17 @@ class ModesDetailActivity : BaseActivity<ActivityModeDetailBinding>() {
                 updateTempUI(
                     minTemp.toFloat(),
                     maxTemp.toFloat(),
-                    if (currDevInfo.status == DevStatus.STOP.toInt()) currDevInfo.targetTemp.toInt() else currDevInfo.temp.toInt(),
-                    currDevInfo.targetTemp.toString(),
+                    if (currDevInfo.status == DevStatus.STOP.toInt()) currDevInfo.targetTemp.toInt()
+                    else currDevInfo.temp.toInt(),
+                    if (currDevInfo.targetTempBuffer.toInt() != -1) currDevInfo.targetTempBuffer.toString() else currDevInfo.targetTemp.toString(),
                     isTempChange
                 )
                 updateTimeUI(
                     if (currDevInfo.status == DevStatus.STOP.toInt() || userChanging) minTime else 0,
                     maxTime,
-                    if (currDevInfo.targetTimeBuffer.toInt() != -1) currDevInfo.targetTimeBuffer.toInt() else (if (currDevInfo.status == DevStatus.STOP.toInt()) currDevInfo.targetTime.toInt() else currDevInfo.remainTime.toInt()),
-                    if (currDevInfo.targetTimeBuffer.toInt() != -1) currDevInfo.targetTimeBuffer.toLong() else currDevInfo.targetTime.toLong(),
+                    if (currDevInfo.status == DevStatus.STOP.toInt()) if (currDevInfo.targetTimeBuffer != -1) currDevInfo.targetTimeBuffer else currDevInfo.targetTime
+                    else currDevInfo.remainTime,
+                    if (currDevInfo.targetTimeBuffer != -1) currDevInfo.targetTimeBuffer.toLong() else currDevInfo.targetTime.toLong(),
                     isTimeChange
                 )
 
@@ -680,7 +687,10 @@ class ModesDetailActivity : BaseActivity<ActivityModeDetailBinding>() {
                     isMotorGearChange
                 )
 
-                updateMotorDirectionUI(currDevInfo.motorDirection.toInt(), isMotorDirectionChange)
+                updateMotorDirectionUI(
+                    if (currDevInfo.motorDirectionBuffer.toInt() == -1) currDevInfo.motorDirection.toInt() else currDevInfo.motorDirectionBuffer.toInt(),
+                    isMotorDirectionChange
+                )
 
                 updateWeightUI(currDevInfo.weight.toFloat())
             }
@@ -980,7 +990,7 @@ class ModesDetailActivity : BaseActivity<ActivityModeDetailBinding>() {
                                     currentTemp = minTemp
                                 }
 
-                                if (currentTemp < 37) { //小于37度置0
+                                if (currentTemp < 35) { //小于37度置0
                                     currentTemp = 0
                                 }
 

+ 54 - 8
BusinessStep/src/main/res/layout/activity_food_step2.xml

@@ -2,8 +2,8 @@
 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
-    android:background="@color/mode_bg_color"
-    android:layout_height="match_parent">
+    android:layout_height="match_parent"
+    android:background="@color/mode_bg_color">
 
     <androidx.constraintlayout.widget.ConstraintLayout
         android:id="@+id/cl_status_bar"
@@ -35,7 +35,7 @@
             android:layout_marginStart="@dimen/convert_51px"
             android:layout_marginEnd="@dimen/convert_70px"
             android:ellipsize="end"
-            android:gravity="center_vertical"
+            android:gravity="center"
             android:maxLines="1"
             android:text="Step1:Peel 3 onions(180g)and2..."
             android:textColor="#ffffff"
@@ -53,12 +53,23 @@
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintTop_toTopOf="parent" />
+        
+        <View
+            android:id="@+id/view_step_mark"
+            android:layout_marginEnd="@dimen/convert_62px"
+            android:background="@drawable/view_step"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            android:layout_width="@dimen/convert_50px"
+            android:layout_height="@dimen/convert_66px"
+            />
 
     </androidx.constraintlayout.widget.ConstraintLayout>
 
     <com.develop.food.base.widgets.BCustomerLinearLayout
-        android:layout_width="match_parent"
         android:id="@+id/scroll_layout"
+        android:layout_width="match_parent"
         android:layout_height="0dp"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintTop_toBottomOf="@id/cl_status_bar">
@@ -81,7 +92,6 @@
                 app:layout_constraintBottom_toBottomOf="parent" />
 
             <TextView
-                app:layout_constraintTop_toTopOf="parent"
                 android:id="@+id/tv_step_name"
                 android:layout_width="0dp"
                 android:layout_height="wrap_content"
@@ -93,17 +103,53 @@
                 android:textColor="#fff"
                 android:textSize="@dimen/convert_39px"
                 app:layout_constraintEnd_toStartOf="@+id/view_remark"
-                app:layout_constraintStart_toStartOf="parent" />
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent" />
 
             <View
-                app:layout_constraintTop_toTopOf="parent"
                 android:id="@+id/view_remark"
                 android:layout_width="@dimen/convert_122px"
                 android:layout_height="@dimen/convert_120px"
                 android:layout_marginTop="@dimen/convert_47px"
                 android:layout_marginEnd="@dimen/convert_45px"
                 android:background="@drawable/ic_remark"
-                app:layout_constraintEnd_toEndOf="parent" />
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintTop_toTopOf="parent" />
+
+            <View
+                android:id="@+id/view_source"
+                android:layout_width="@dimen/convert_122px"
+                android:layout_height="@dimen/convert_120px"
+                android:layout_marginTop="@dimen/convert_47px"
+                android:layout_marginEnd="@dimen/convert_45px"
+                android:background="@drawable/ic_cook_source"
+                android:visibility="visible"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintTop_toBottomOf="@id/view_remark" />
+
+
+            <View
+                android:id="@+id/view_weight"
+                android:layout_width="@dimen/convert_122px"
+                android:layout_height="@dimen/convert_120px"
+                android:layout_marginTop="@dimen/convert_47px"
+                android:layout_marginEnd="@dimen/convert_45px"
+                android:background="@drawable/ic_cook_weight"
+                android:visibility="visible"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintTop_toBottomOf="@id/view_source" />
+
+            <View
+                android:id="@+id/view_weight_close"
+                android:layout_width="@dimen/convert_122px"
+                android:layout_height="@dimen/convert_120px"
+                android:layout_marginTop="@dimen/convert_47px"
+                android:layout_marginEnd="@dimen/convert_45px"
+                android:background="@drawable/view_weight_close"
+                android:visibility="gone"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintTop_toBottomOf="@id/view_source" />
+
 
             <ImageView
                 android:id="@+id/iv_prev_step"

+ 27 - 0
BusinessStep/src/main/res/layout/item_cook_source_1.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="#80000000">
+
+    <androidx.recyclerview.widget.RecyclerView
+        android:id="@+id/rv_list"
+        android:paddingHorizontal="@dimen/convert_47px"
+        android:background="@drawable/bg_cook_detail_dialog"
+        android:layout_width="match_parent"
+        android:layout_height="906dp"
+        android:overScrollMode="never"
+        android:scrollbars="none"
+        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <ImageView
+        android:id="@+id/iv_close"
+        style="@style/CloseButton"
+        app:layout_constraintBottom_toBottomOf="@+id/rv_list"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/rv_list" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 1 - 1
app/build.gradle

@@ -23,7 +23,7 @@ static  int formatTime() {
 
 ext{
      versionCode=Integer.parseInt(new SimpleDateFormat("yyMMddHH").format(new Date()) + 1)
-     brandCode="012A"
+     brandCode="000A"
      brandVersionCode=versionCode
      model="3015"
 }

BIN
app/src/main/assets/skins/night.skin


+ 2 - 0
libBase/src/main/java/com/develop/food/base/repo/db/dao/FoodRecipeDao.kt

@@ -112,6 +112,8 @@ interface FoodRecipeDao {
     @Insert(onConflict = OnConflictStrategy.REPLACE)
     fun insertDevRecipeCategorys(data: List<DevRecipeCategory>)
 
+    @Query("select * from cc_dev_recipe_category")
+    fun queryAllCategory(): List<DevRecipeCategory>
 
     @Insert(onConflict = OnConflictStrategy.REPLACE)
     fun insertDevRecipeCookingSteps(data: List<DevRecipeCookingStep>)

+ 13 - 1
libBase/src/main/java/com/develop/food/base/utils/AppVerUtils.kt

@@ -6,6 +6,7 @@ import com.develop.food.base.api.FoodRepository
 import com.develop.food.base.api.response.RecipeDataConfig
 import com.develop.food.base.http.observeStatus
 import com.develop.food.base.repo.FoodDataProvider
+import com.develop.food.base.repo.entity.DevRecipeCategory
 import com.develop.food.base.repo.entity.DevVersion
 import com.develop.food.base.widgets.RecipeUpdateDialog
 import com.google.gson.Gson
@@ -126,7 +127,7 @@ object AppVerUtils {
             if (!jsonFile.exists()) {
                 return
             }
-            val jsonContent = FileKit.readFileToString(jsonFile)
+            val jsonContent = FileKit.readFileToStringB(jsonFile)
             val contentData = Gson().fromJson(jsonContent, RecipeDataConfig::class.java)
           //  contentData.resetAllCodes()
             FoodDataProvider.getDatabase().runInTransaction {
@@ -144,6 +145,17 @@ object AppVerUtils {
                     insertHotTags(contentData.devHotTags)
                     insertDevPortraits(contentData.devPortraits)
                     insertDevRecipeAccessorys(contentData.devRecipeAccessorys)
+                    val categorys = queryAllCategory()
+                    val categoryMap = HashMap<String, DevRecipeCategory>()
+                    for (category in categorys) {
+                        categoryMap[category.number + ":" + category.lang] = category
+                    }
+                    for (devRecipeCategory in contentData.devRecipeCategorys) {
+                        if (categoryMap.containsKey(devRecipeCategory.number + ":" + devRecipeCategory.lang)) {
+                            devRecipeCategory.code =
+                                categoryMap[devRecipeCategory.number + ":" + devRecipeCategory.lang]?.code.toString()
+                        }
+                    }
                     insertDevRecipeCategorys(contentData.devRecipeCategorys)
                     insertDevRecipeCookingSteps(contentData.devRecipeCookingSteps)
                     insertDevRecipeFoods(contentData.devRecipeFoods)

+ 34 - 2
libBase/src/main/java/com/develop/food/base/utils/FileKit.kt

@@ -4,11 +4,20 @@ import android.content.ContentUris
 import android.content.Context
 import android.database.Cursor
 import android.net.Uri
-import android.os.Build
 import android.os.Environment
 import android.provider.DocumentsContract
 import android.provider.MediaStore
-import java.io.*
+import java.io.BufferedReader
+import java.io.BufferedWriter
+import java.io.File
+import java.io.FileInputStream
+import java.io.FileOutputStream
+import java.io.FileWriter
+import java.io.IOException
+import java.io.InputStream
+import java.io.InputStreamReader
+import java.io.OutputStream
+import java.nio.charset.Charset
 
 
 object FileKit {
@@ -54,6 +63,29 @@ object FileKit {
         return sb.toString()
     }
 
+    fun readFileToStringB(file: File): String {
+        val sb = StringBuilder()
+        try {
+            //打开文件输入流
+            val inputStream = FileInputStream(file)
+            val inputStreamReader = InputStreamReader(inputStream, Charset.forName("utf-8"))
+            val bufferedReader = BufferedReader(inputStreamReader)
+            var str: String
+            while (bufferedReader.readLine().also { str = it } != null) {
+                println("====>字符流:$str")
+                sb.append(str)
+            }
+            bufferedReader.close()
+            //关闭输入流
+            inputStreamReader.close()
+            inputStream.close()
+        } catch (ex: Exception) {
+            ex.printStackTrace()
+        }
+        return sb.toString()
+    }
+
+
     fun writeToFile(file: File, content: String) {
         try {
             val out = BufferedWriter(FileWriter(file))

+ 1 - 1
libBase/src/main/java/com/develop/food/base/utils/GlobalExt.kt

@@ -269,7 +269,7 @@ fun timeStamp2Time(timeSeconds: Long, format: String = "yyyy/MM/dd HH:mm"): Stri
 fun getSN(): String {
     //通过反射获取sn号
     var serial: String
-   // return "000A30150020123010190001"
+    return "034A30150020123010190001"
     try {
         val c = Class.forName("android.os.SystemProperties")
         val get = c.getMethod("get", String::class.java)

+ 3 - 4
libBase/src/main/java/com/develop/food/base/utils/LogRequestUtil.kt

@@ -1,7 +1,6 @@
 package com.develop.food.base.utils
 
 import android.util.Log
-import com.develop.base.BuildConfig
 import okhttp3.Request
 import okhttp3.Response
 import okio.Buffer
@@ -13,9 +12,9 @@ class LogRequestUtil {
 
         // 输出http请求日志
         fun logHttpResponse(request: Request, response: Response) {
-            if (!BuildConfig.DEBUG) {
-                return
-            }
+//            if (!BuildConfig.DEBUG) {
+//                return
+//            }
             val builder = StringBuilder()
             builder.append("\n method:").append(request.method)
             builder.append("\n host:").append(request.url.host)

+ 34 - 0
libBase/src/main/java/com/develop/food/base/widgets/CircleBgImageView.kt

@@ -0,0 +1,34 @@
+package com.develop.food.base.widgets
+
+import android.content.Context
+import android.graphics.Canvas
+import android.graphics.Color
+import android.graphics.Paint
+import android.util.AttributeSet
+import androidx.appcompat.widget.AppCompatImageView
+import com.develop.base.R
+
+class CircleBgImageView @JvmOverloads constructor(
+    context: Context, attrs: AttributeSet? = null
+) : AppCompatImageView(context, attrs) {
+
+    private val paint = Paint(Paint.ANTI_ALIAS_FLAG)
+
+    init {
+        paint.style = Paint.Style.FILL
+        context.obtainStyledAttributes(attrs, R.styleable.CircleBgImageView).let {
+            paint.color = it.getColor(R.styleable.CircleBgImageView_bgColor, Color.TRANSPARENT)
+            it.recycle()
+        }
+    }
+
+    override fun onDraw(canvas: Canvas?) {
+        canvas?.drawCircle(width / 2f, height / 2f, width / 2f, paint)
+        super.onDraw(canvas)
+    }
+
+    fun setBgColor(color: Int) {
+        paint.color =context.resources.getColor(color)
+        invalidate()
+    }
+}

BIN
libBase/src/main/res/drawable-xxxhdpi/ic_cook_source.png


BIN
libBase/src/main/res/drawable-xxxhdpi/ic_cook_weight.png


BIN
libBase/src/main/res/drawable-xxxhdpi/ic_remark.png


BIN
libBase/src/main/res/drawable-xxxhdpi/view_step.png


BIN
libBase/src/main/res/drawable-xxxhdpi/view_weight.png


BIN
libBase/src/main/res/drawable-xxxhdpi/view_weight_close.png


+ 3 - 0
libBase/src/main/res/values/colors.xml

@@ -51,4 +51,7 @@
 
     <color name="restore_des_color">#EE0000</color>
     <color name="update_recipes_color">#92cf40</color>
+    <color name="view_change">#99000000</color>
+
+    <color name="color_333333">#333333</color>
 </resources>

+ 3 - 1
libBase/src/main/res/values/styles.xml

@@ -8,5 +8,7 @@
         <item name="android:src">@drawable/ic_cancel</item>
         <item name="android:padding">@dimen/convert_30px</item>
     </style>
-
+    <declare-styleable name="CircleBgImageView">
+        <attr name="bgColor" format="color"/>
+    </declare-styleable>
 </resources>

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


BIN
skin-support/src/main/res/drawable/ic_cook_source.png


BIN
skin-support/src/main/res/drawable/view_remark.png


BIN
skin-support/src/main/res/drawable/view_weight.png


BIN
skin-support/src/main/res/drawable/view_weight_close.png