wbspool 1 year ago
parent
commit
7155b4e2a3

+ 2 - 1
BusinessCommon/src/main/java/com/develop/common/event/CommonEvent.kt

@@ -10,6 +10,7 @@ data class CookStepEvent(
     var coverPath: Any,
     var step: Int = 0,
     var isMode: Boolean = false,
-    var modeName: String = ""
+    var modeName: String = "",
+    var modeType: String = "",
 ) {
 }

+ 11 - 3
BusinessCommon/src/main/java/com/develop/common/food_sdk/FloatWindowManager.kt

@@ -63,6 +63,7 @@ object FloatWindowManager {
     }
 
     fun showStepFlowWindow(event: CookStepEvent) {
+        hideStepFlowWindow()
         recipeNumber = event.recipeNumber
         coverPath = event.coverPath
         step = event.step
@@ -77,7 +78,13 @@ object FloatWindowManager {
             .setLayout(R.layout.step_float_window) {
                 ivFood = it.findViewById(R.id.iv_food)
                 tvStep = it.findViewById(R.id.tv_step_count)
-                ivFood?.load(coverPath)
+
+                if(coverPath is Int){
+                    ivFood?.setImageResource(coverPath as Int)
+                }else{
+                    ivFood?.load(coverPath)
+                }
+
                 if (isMode) {
                     //当前是模式
                     tvStep?.text = modeName
@@ -88,7 +95,7 @@ object FloatWindowManager {
                 it.findViewById<RelativeLayout>(R.id.content_layout).setOnClickListener {
                     if (isMode) {
                         globalApp().navigateTo(Screens.Cook.COOK_MODES) {
-                            withString(MODE_TYPE, modeName)
+                            withString(MODE_TYPE, event.modeType)
                         }
                     } else {
                         globalApp().navigateTo(Screens.Cook.COOK_STEP2) {
@@ -122,9 +129,10 @@ object FloatWindowManager {
                 if (runningRecipeId != null && runningRecipeId?.isNotEmpty() == true) {
                     recipeNumber = runningRecipeId
                     tvStep?.text = modeName
-                } else {
                     step = if (runningRecipeExt == "") 0 else runningRecipeExt.toInt()
                     tvStep?.text = "Step ${step + 1}"
+                } else {
+                    //ivFood?.load(coverPath)
                 }
                 if (status.toByte() == DevStatus.STOP) {
                     hideStepFlowWindow()

+ 6 - 3
BusinessStep/src/main/java/com/develop/step/ui/ModesDetailActivity.kt

@@ -700,15 +700,18 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
                 tempRingEvent(pg)
             }
         }
-
+        val packageName = this.packageName;
         backRequestDialog.apply {
             title = "Keep cooking in the background?"
             onDialogClickListener = object : CancelConfirmDialog.OnDialogClickListener {
                 override fun onConfirm() {
+                    var workMode = ConfigUtils.getMode(modeType)
+
                     val cookStepEvent = CookStepEvent(
-                        coverPath = viewModel.getBanner(),
+                        coverPath = resources.getIdentifier(workMode?.bg,"drawable",packageName),
                         isMode = true,
-                        modeName = viewModel.modeType
+                        modeType = viewModel.modeType,
+                        modeName =  getString(resources.getIdentifier(workMode?.name,"string",packageName))
                     )
                     FloatWindowManager.showStepFlowWindow(cookStepEvent)
                     finish()