|
@@ -18,12 +18,17 @@ import com.develop.base.ext.getSN
|
|
|
import com.develop.base.ext.isBrand062
|
|
|
import com.develop.base.ext.isNightTheme
|
|
|
import com.develop.base.ext.navigateTo
|
|
|
+import com.develop.base.ext.runOnMainThread
|
|
|
import com.develop.base.ext.setGone
|
|
|
import com.develop.base.ext.setVisible
|
|
|
import com.develop.base.ext.src
|
|
|
import com.develop.base.ext.updateText
|
|
|
+import com.develop.base.util.AppActivityManager
|
|
|
+import com.develop.base.util.GlobalToast
|
|
|
import com.develop.base.util.MusicBackPlayerUtil
|
|
|
import com.develop.base.util.ThreadUtils
|
|
|
+import com.develop.base.util.TopResumedAtyHolder
|
|
|
+import com.develop.base.util.TuyaEventEntity
|
|
|
import com.develop.common.router.Screens
|
|
|
import com.develop.common.widget.TimePickerView
|
|
|
import com.develop.step.CookSettingType
|
|
@@ -34,6 +39,7 @@ import com.develop.common.data_repo.FoodDataProvider
|
|
|
import com.develop.common.data_repo.db.ModesType
|
|
|
import com.develop.common.data_repo.db.entity.UserFavoriteRecipes
|
|
|
import com.develop.common.data_repo.db.entity.UserHistoryRecipes
|
|
|
+import com.develop.common.data_repo.net.TokenInvalidateEvent
|
|
|
import com.develop.common.dialog.CancelConfirmDialog
|
|
|
import com.develop.common.dialog.PotCoverUnlockedDialog
|
|
|
import com.develop.common.event.CookStepEvent
|
|
@@ -43,7 +49,9 @@ import com.develop.common.food_sdk.FoodSdkUtils
|
|
|
import com.develop.common.food_sdk.GlobalDevEvent
|
|
|
import com.develop.common.tag.CURRENT_USER_ID
|
|
|
import com.develop.common.tag.MODE_TYPE
|
|
|
+import com.develop.common.tag.NUMBER_TAG
|
|
|
import com.develop.common.tag.PRESS_DOWN_KEY_CODE
|
|
|
+import com.develop.common.tag.SOURCE_TAG
|
|
|
import com.develop.common.tag.TURN_DOWN_KEY_CODE
|
|
|
import com.develop.common.tag.TURN_UP_KEY_CODE
|
|
|
import com.develop.common.utils.CofarUtils
|
|
@@ -131,17 +139,24 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
//做食谱步骤判断 由于可能对应的 cofig 缺少程序,故用总文件来 config.json
|
|
|
configJson = ConfigUtils.loadCookConfig()
|
|
|
isModelNum = getModelNum()
|
|
|
+
|
|
|
+
|
|
|
+ for (activity in AppActivityManager.getInstance().activityList()) {
|
|
|
+
|
|
|
+ Log.e("TAG ASDASD", "ACITIVITY :" + activity.localClassName)
|
|
|
+
|
|
|
+ }
|
|
|
if (!isNightTheme()) {
|
|
|
if (is062) {
|
|
|
binding.viewChangeCrush.setBgColor(R.color.view_change_062)
|
|
|
binding.viewChangeWeight.setBgColor(R.color.view_change_062)
|
|
|
binding.viewRemark.setBgColor(R.color.white)
|
|
|
- } else if(is011){
|
|
|
+ } else if (is011) {
|
|
|
binding.viewChangeCrush.setBgColor(R.color.view_change_011)
|
|
|
binding.viewChangeWeight.setBgColor(R.color.view_change_011)
|
|
|
binding.viewRemark.setBgColor(R.color.white)
|
|
|
binding.viewWeightClose.setBgColor(R.color.view_change_011)
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
binding.viewChangeCrush.setBgColor(R.color.view_change)
|
|
|
binding.viewChangeWeight.setBgColor(R.color.view_change)
|
|
|
binding.viewRemark.setBgColor(R.color.view_change)
|
|
@@ -236,10 +251,10 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
} else if (viewModel.displayStep()?.isDescription() == true) {
|
|
|
CofarSDK.stoptWeight()
|
|
|
changeDescription()
|
|
|
- } else if (viewModel.displayStep()?.isWarning() == true) {
|
|
|
+ } else if (viewModel.displayStep()?.isWarning() == true) {
|
|
|
CofarSDK.stoptWeight()
|
|
|
changeWarning()
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
CofarSDK.stoptWeight()
|
|
|
changeTempSettingPanel()
|
|
|
}
|
|
@@ -373,10 +388,10 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
} else if (it.isDescription()) {
|
|
|
CofarSDK.stoptWeight()
|
|
|
changeDescription()
|
|
|
- } else if (it.isWarning()) {
|
|
|
+ } else if (it.isWarning()) {
|
|
|
CofarSDK.stoptWeight()
|
|
|
changeWarning()
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
CofarSDK.stoptWeight()
|
|
|
changeTempSettingPanel()
|
|
|
}
|
|
@@ -561,7 +576,7 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
currentMotorGer = it.uiData.currentSpeed
|
|
|
currentWaterGear = it.uiData.currentWaterGear
|
|
|
currTime = it.uiData.targetTime
|
|
|
- if (!it.isWeightMode() && !it.isDescription()&&!it.isWarning()) {
|
|
|
+ if (!it.isWeightMode() && !it.isDescription() && !it.isWarning()) {
|
|
|
//设置初始参数
|
|
|
CofarSDK.cfgMotorGear(0)
|
|
|
CofarSDK.cfgTime(0)
|
|
@@ -601,7 +616,7 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
getString(com.develop.common.R.string.confirm), workDevMode
|
|
|
)
|
|
|
}
|
|
|
- modeType = workModes?.type ?:"ADAPTED_COOKING"
|
|
|
+ modeType = workModes?.type ?: "ADAPTED_COOKING"
|
|
|
turnDevModeUI(workDevMode)
|
|
|
|
|
|
}
|
|
@@ -681,23 +696,6 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
|
|
|
isClickType = 1
|
|
|
|
|
|
- /**
|
|
|
- * 需求:扭橙模式一打开,如果没有扭橙汁配件时需要提示
|
|
|
- * CofarSDK.devInfo().resetZero.toInt()==1 代表已经是扭橙汁配件
|
|
|
- * */
|
|
|
- if (modeType==WorkModes.CITRUS_JUICER&&CofarSDK.devInfo().resetZero.toInt()!=1){
|
|
|
- showMsgDialog(resources.getString(com.develop.common.R.string.dev_not_orange_parts))
|
|
|
- return
|
|
|
- }
|
|
|
- /**
|
|
|
- * 需求:非扭橙模式打开点击运行,且是扭橙的配件时需要提示用户
|
|
|
- * CofarSDK.devInfo().resetZero.toInt()==1 代表已经是扭橙汁配件
|
|
|
- * */
|
|
|
- if (modeType!=WorkModes.CITRUS_JUICER&&CofarSDK.devInfo().resetZero.toInt()==1){
|
|
|
- showMsgDialog(resources.getString(com.develop.common.R.string.dev_remove_orange_parts))
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
//判断是否是空炸错误,由于汤锅错误SDK 已经做了 ;
|
|
|
if (ConfigUtils.getBooleanErrCode(CofarSDK.devInfo().errCode.toInt()) && CofarSDK.devInfo().devMode == DevModes.AIR_FRYER) {
|
|
@@ -707,7 +705,8 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
//没有菜谱步骤
|
|
|
return
|
|
|
}
|
|
|
- var workModes = configJson?.workModes?.find { it.type == viewModel.allSteps[viewModel.stepIndex].workMode }
|
|
|
+ var workModes =
|
|
|
+ configJson?.workModes?.find { it.type == viewModel.allSteps[viewModel.stepIndex].workMode }
|
|
|
var wrokDevMode = workModes?.devMode
|
|
|
//由于菜谱内包含汤锅和空炸估做判断当前步骤是否是所需要得锅
|
|
|
if (wrokDevMode != CofarSDK.devInfo().devMode) {
|
|
@@ -724,6 +723,20 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
showPotCloverDialog()
|
|
|
} else if (CofarSDK.devInfo().runningInstId != "${recipeNumber}:${viewModel.stepIndex}") {
|
|
|
overrideModeDialog.showDialog(supportFragmentManager, "overrideModeDialog")
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 需求:扭橙模式一打开,如果没有扭橙汁配件时需要提示
|
|
|
+ * CofarSDK.devInfo().resetZero.toInt()==1 代表已经是扭橙汁配件
|
|
|
+ * */
|
|
|
+ else if (workModes?.type == WorkModes.CITRUS_JUICER && CofarSDK.devInfo().resetZero.toInt() != 1) {
|
|
|
+ showMsgDialog(resources.getString(com.develop.common.R.string.dev_not_orange_parts))
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 需求:非扭橙模式打开点击运行,且是扭橙的配件时需要提示用户
|
|
|
+ * CofarSDK.devInfo().resetZero.toInt()==1 代表已经是扭橙汁配件
|
|
|
+ * */
|
|
|
+ else if (workModes?.type != WorkModes.CITRUS_JUICER && CofarSDK.devInfo().resetZero.toInt() == 1) {
|
|
|
+ showMsgDialog(resources.getString(com.develop.common.R.string.dev_remove_orange_parts))
|
|
|
} else {
|
|
|
viewModel.displayStep()?.let {
|
|
|
viewModel.setTargetCookingStep(it)
|
|
@@ -1644,5 +1657,103 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ override fun onTuyaMsg(event: TuyaEventEntity) {
|
|
|
+ //处理 2577 bug问题
|
|
|
+ when (event.isType) {
|
|
|
+ 0 -> {
|
|
|
+ //模式
|
|
|
+ if (CofarSDK.devInfo().runningStatus != DevStatus.STOP) {
|
|
|
+ showMsgOKDialog(getString(R.string.running_block_tips))
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ 1 -> {
|
|
|
+ //食谱
|
|
|
+ if (CofarSDK.devInfo().runningStatus != DevStatus.STOP) {
|
|
|
+ showBackDilaog(event.recipeNumber ?: "")
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ else -> {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun showBackDilaog(number: String) {
|
|
|
+ var backDialog = CancelConfirmDialog()
|
|
|
+ backDialog.apply {
|
|
|
+ title = this@CookStepActivity.getString(R.string.keep_cooking_in_the_background)
|
|
|
+ onDialogClickListener = object : CancelConfirmDialog.OnDialogClickListener {
|
|
|
+ override fun onConfirm() {
|
|
|
+ if (CofarSDK.devInfo().runningInstId != null) {
|
|
|
+ val info = CofarSDK.devInfo().runningInstId.split(":");
|
|
|
+ val cookStepEvent = CookStepEvent(
|
|
|
+ recipeNumber = info[0],
|
|
|
+ coverPath = photoPath!!,
|
|
|
+ step = info[1].toInt(),
|
|
|
+ isMode = false,
|
|
|
+ modeName = this@CookStepActivity.binding.tvTitleStep.text.toString()
|
|
|
+
|
|
|
+
|
|
|
+ )
|
|
|
+ FloatWindowManager.showStepFlowWindow(cookStepEvent)
|
|
|
+ getRecipe(number)
|
|
|
+ finish()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onCancel() {
|
|
|
+ FloatWindowManager.hideStepFlowWindow()
|
|
|
+ CofarSDK.stop(false)
|
|
|
+ getRecipe(number)
|
|
|
+ finish()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ backDialog.showDialog(supportFragmentManager, "backRequestDialog")
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private fun getRecipe(number: String) {
|
|
|
+ FoodDataProvider.getDatabase().recipeDao().apply {
|
|
|
+ var recipeNumber = number
|
|
|
+ if (recipeNumber.contains("@")) {
|
|
|
+ var (numbers, language) = recipeNumber.split("@")
|
|
|
+ recipeNumber = numbers
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ val recipeBean = queryRecipe(recipeNumber)
|
|
|
|
|
|
+ //需要关闭的页面
|
|
|
+ for (activity in AppActivityManager.getInstance().activityList()) {
|
|
|
+ if (activity.localClassName.contains("CookDetailActivity")) {
|
|
|
+ activity.finish()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (recipeBean != null) {
|
|
|
+
|
|
|
+ navigateTo(Screens.Cook.COOK_DETAIL) {
|
|
|
+ withString(
|
|
|
+ SOURCE_TAG, "local"
|
|
|
+ )
|
|
|
+ withString(NUMBER_TAG, number)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ navigateTo(Screens.Cook.COOK_DETAIL) {
|
|
|
+ withString(
|
|
|
+ SOURCE_TAG, "remote"
|
|
|
+ )
|
|
|
+ withString(NUMBER_TAG, number)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|