|
@@ -76,16 +76,17 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
private var titleName = ""
|
|
|
private var currModes = ""
|
|
|
|
|
|
- private fun turnDevModeUI(){
|
|
|
|
|
|
- if(CofarSDK.devInfo().devMode == DevModes.AIR_FRYER){
|
|
|
+ private fun turnDevModeUI() {
|
|
|
+
|
|
|
+ if (CofarSDK.devInfo().devMode == DevModes.AIR_FRYER) {
|
|
|
//隐藏点击
|
|
|
binding.controller.clCookDirection.visibility = View.GONE;
|
|
|
binding.controller.clCookSpeed.visibility = View.GONE;
|
|
|
binding.controller.clCookWater.visibility = View.VISIBLE
|
|
|
}
|
|
|
|
|
|
- if(CofarSDK.devInfo().devMode == DevModes.SOUP){
|
|
|
+ if (CofarSDK.devInfo().devMode == DevModes.SOUP) {
|
|
|
//隐藏点击
|
|
|
binding.controller.clCookDirection.visibility = View.VISIBLE;
|
|
|
binding.controller.clCookSpeed.visibility = View.VISIBLE;
|
|
@@ -99,12 +100,12 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
super.onCreate(savedInstanceState)
|
|
|
|
|
|
//隐藏称重与电动
|
|
|
- if (!isNightTheme()){
|
|
|
+ if (!isNightTheme()) {
|
|
|
binding.viewChangeCrush.setGone()
|
|
|
binding.viewChangeWeight.setGone()
|
|
|
}
|
|
|
|
|
|
- if (!isNightTheme()){
|
|
|
+ if (!isNightTheme()) {
|
|
|
binding.viewChangeCrush.setBgColor(R.color.view_change)
|
|
|
binding.viewChangeWeight.setBgColor(R.color.view_change)
|
|
|
binding.viewRemark.setBgColor(R.color.view_change)
|
|
@@ -136,7 +137,8 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- override fun onTimePickerTouchFirst() {
|
|
|
+ override fun onTimePickerTouchFirst(where: Int) {
|
|
|
+ whereIndex = where
|
|
|
viewModel.stepUiData.doingModify = true
|
|
|
}
|
|
|
}
|
|
@@ -151,22 +153,22 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
}
|
|
|
|
|
|
|
|
|
- binding.controller.jiahao.setOnClickListener{
|
|
|
+ binding.controller.jiahao.setOnClickListener {
|
|
|
operateByPhysical(true)
|
|
|
}
|
|
|
|
|
|
- binding.controller.jianhao.setOnClickListener{
|
|
|
+ binding.controller.jianhao.setOnClickListener {
|
|
|
operateByPhysical(false)
|
|
|
}
|
|
|
|
|
|
binding.viewChangeWeight.setOnClickListener {
|
|
|
- if (isNightTheme()){
|
|
|
+ if (isNightTheme()) {
|
|
|
//此主题下,点击显示食材
|
|
|
- navigateTo(Screens.Cook.COOK_SOURCE){
|
|
|
+ navigateTo(Screens.Cook.COOK_SOURCE) {
|
|
|
withString("cook_step_detail", cookStepDetail)
|
|
|
- withString("portionSizelJson",portionSizelJson)
|
|
|
+ withString("portionSizelJson", portionSizelJson)
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
if (currModes != "WIGHT" && currModes != "WEIGH" && currModes != "WEIGHT") {
|
|
|
binding.viewWeightClose1.setVisible()
|
|
|
binding.viewChangeWeight.visibility = View.INVISIBLE
|
|
@@ -180,10 +182,10 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
CofarSDK.stoptWeight()
|
|
|
viewModel.setDisplayStep(viewModel.stepIndex, force = true)
|
|
|
} else {
|
|
|
- if (!isNightTheme()){
|
|
|
- binding.ivPrevStep.setGone()
|
|
|
- binding.ivNextStep.setGone()
|
|
|
- }
|
|
|
+ if (!isNightTheme()) {
|
|
|
+ binding.ivPrevStep.setGone()
|
|
|
+ binding.ivNextStep.setGone()
|
|
|
+ }
|
|
|
CofarSDK.changeMode(
|
|
|
"$recipeNumber:${viewModel.stepIndex}",
|
|
|
CofarSDK.devMode("WEIGHT")
|
|
@@ -243,7 +245,7 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
|
|
|
|
|
|
binding.viewChangeCrush.setOnClickListener {
|
|
|
- if (isNightTheme()){
|
|
|
+ if (isNightTheme()) {
|
|
|
if (currModes != "WIGHT" && currModes != "WEIGH" && currModes != "WEIGHT") {
|
|
|
binding.viewWeightClose.setVisible()
|
|
|
binding.viewChangeCrush.visibility = View.INVISIBLE
|
|
@@ -258,7 +260,7 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
CofarSDK.stoptWeight()
|
|
|
viewModel.setDisplayStep(viewModel.stepIndex, force = true)
|
|
|
} else {
|
|
|
- if (!isNightTheme()){
|
|
|
+ if (!isNightTheme()) {
|
|
|
binding.ivPrevStep.setGone()
|
|
|
binding.ivNextStep.setGone()
|
|
|
}
|
|
@@ -280,7 +282,7 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
CofarSDK.stoptWeight()
|
|
|
viewModel.setDisplayStep(viewModel.stepIndex, force = true)
|
|
|
} else {
|
|
|
- if (!isNightTheme()){
|
|
|
+ if (!isNightTheme()) {
|
|
|
binding.ivPrevStep.setGone()
|
|
|
binding.ivNextStep.setGone()
|
|
|
}
|
|
@@ -340,7 +342,7 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
)
|
|
|
if (!isNightTheme()) {
|
|
|
binding.ivCookBg.setVisible()
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
binding.ivCookBg.setGone()
|
|
|
}
|
|
|
} else {
|
|
@@ -429,7 +431,7 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
FoodDataProvider.getResourcePath(photoPath),
|
|
|
R.drawable.bg_cook_session
|
|
|
)
|
|
|
- if (!isNightTheme()){
|
|
|
+ if (!isNightTheme()) {
|
|
|
binding.ivCookBg.setVisible()
|
|
|
} else {
|
|
|
binding.ivCookBg.setGone()
|
|
@@ -493,8 +495,9 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
}
|
|
|
}
|
|
|
viewModel.recipeLiveData.observe(this) {
|
|
|
- val result = FoodDataProvider.getUserDatabase().userInfoDao().queryFavoriteRecipes(CURRENT_USER_ID,it.number?:"")
|
|
|
- if (result.isNotEmpty()){
|
|
|
+ val result = FoodDataProvider.getUserDatabase().userInfoDao()
|
|
|
+ .queryFavoriteRecipes(CURRENT_USER_ID, it.number ?: "")
|
|
|
+ if (result.isNotEmpty()) {
|
|
|
binding.ivAddToFav.src = R.drawable.ic_like
|
|
|
} else {
|
|
|
binding.ivAddToFav.src = R.drawable.ic_cook_fav
|
|
@@ -523,7 +526,7 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
private fun initStepData() {
|
|
|
if (CofarSDK.devInfo().status == DevStatus.STOP.toInt()) {
|
|
|
configing = true;
|
|
|
- if (viewModel.allSteps.isNotEmpty()){
|
|
|
+ if (viewModel.allSteps.isNotEmpty()) {
|
|
|
viewModel.allSteps.get(viewModel.stepIndex)?.let {
|
|
|
if (it.workMode == "Final Step") {
|
|
|
//享用美食页面
|
|
@@ -531,7 +534,7 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
notifyAllCookStepComplete()
|
|
|
return
|
|
|
} else {
|
|
|
- if (isNightTheme()){
|
|
|
+ if (isNightTheme()) {
|
|
|
binding.ivCookBg.setGone()
|
|
|
}
|
|
|
binding.llStepFinish.setGone()
|
|
@@ -543,10 +546,14 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
CofarSDK.cfgMotorGear(0)
|
|
|
CofarSDK.cfgTime(0)
|
|
|
ThreadUtils.runOnMainThread({
|
|
|
- CofarSDK.cfgMotor(it.uiData.currentSpeed.toByte(),it.uiData.direction.toByte(),1);
|
|
|
+ CofarSDK.cfgMotor(
|
|
|
+ it.uiData.currentSpeed.toByte(),
|
|
|
+ it.uiData.direction.toByte(),
|
|
|
+ 1
|
|
|
+ );
|
|
|
CofarSDK.cfgTime(it.uiData.targetTime)
|
|
|
CofarSDK.cfgHeat(it.uiData.targetTemp.toShort(), 0)
|
|
|
- },200)
|
|
|
+ }, 200)
|
|
|
|
|
|
|
|
|
}
|
|
@@ -570,6 +577,8 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
viewModel.nextStep()
|
|
|
|
|
|
initStepData() //初始化步骤参数
|
|
|
+ whereIndex = -1
|
|
|
+ binding.controller.clSetTime.stopAlphaAnim()
|
|
|
binding.controller.llStepComplete.setGone()
|
|
|
binding.controller.jiahao.setVisible()
|
|
|
binding.controller.jianhao.setVisible()
|
|
@@ -583,6 +592,8 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
// 当前为手动步骤, 上一个步骤切换会设置为当前烹饪步骤
|
|
|
pendingCookStep = true
|
|
|
}
|
|
|
+ whereIndex = -1
|
|
|
+ binding.controller.clSetTime.stopAlphaAnim()
|
|
|
viewModel.prevStep()
|
|
|
initStepData()
|
|
|
}
|
|
@@ -621,6 +632,8 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
}
|
|
|
|
|
|
private fun handleButtonState(tag: String) {
|
|
|
+ whereIndex = -1
|
|
|
+ binding.controller.clSetTime.stopAlphaAnim()
|
|
|
if (tag == BUTTON_TAG_START) {
|
|
|
if (CofarSDK.devInfo().potCloverStatus.toInt() == 1) {
|
|
|
showPotCloverDialog()
|
|
@@ -821,6 +834,8 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
CofarSDK.start("${recipeNumber}:${viewModel.stepIndex}")
|
|
|
}
|
|
|
//通知当前运行的菜谱的ID和当前步骤索引
|
|
|
+ whereIndex = -1
|
|
|
+ binding.controller.clSetTime.stopAlphaAnim()
|
|
|
CofarSDK.startRecipe(recipeNumber, viewModel.stepIndex.toString())
|
|
|
}
|
|
|
|
|
@@ -830,6 +845,7 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
TURN_UP_KEY_CODE -> {
|
|
|
operateByPhysical(true)
|
|
|
}
|
|
|
+
|
|
|
TURN_DOWN_KEY_CODE -> {
|
|
|
operateByPhysical(false)
|
|
|
}
|
|
@@ -904,7 +920,7 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
binding.controller.speedRingView.updateProgress(it.currentSpeed)
|
|
|
onUserChangeSpeed(it.currentSpeed)
|
|
|
}
|
|
|
- } else if(tabType == CookSettingType.WATER_SPRY){
|
|
|
+ } else if (tabType == CookSettingType.WATER_SPRY) {
|
|
|
cookStep?.uiData?.let {
|
|
|
if (!it.isWaterGearChange) {
|
|
|
return
|
|
@@ -924,31 +940,43 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
binding.controller.waterRingView.updateProgress(it.currentWaterGear)
|
|
|
onUserWaterGear(it.currentWaterGear)
|
|
|
}
|
|
|
- }else if (tabType == CookSettingType.TIME_SETTING) {
|
|
|
+ } else if (tabType == CookSettingType.TIME_SETTING) {
|
|
|
cookStep?.uiData?.let {
|
|
|
if (!it.isTimeChange) {
|
|
|
return
|
|
|
}
|
|
|
dealWithTimeByOperation(it, increase)
|
|
|
}
|
|
|
- }else if (tabType == CookSettingType.DIRECTION_SETTING) {
|
|
|
+ } else if (tabType == CookSettingType.DIRECTION_SETTING) {
|
|
|
cookStep?.uiData?.let {
|
|
|
- if(increase){
|
|
|
- onSettingDirection(MotorDirections.FORWARD.toInt())
|
|
|
- }else{
|
|
|
- onSettingDirection(MotorDirections.REVERSE.toInt())
|
|
|
- }
|
|
|
+ if (increase) {
|
|
|
+ onSettingDirection(MotorDirections.FORWARD.toInt())
|
|
|
+ } else {
|
|
|
+ onSettingDirection(MotorDirections.REVERSE.toInt())
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private fun dealWithTimeByOperation(uiData: CookStepUiData, increase: Boolean) {
|
|
|
//当前调节时间
|
|
|
- var targetTime = uiData.targetTime
|
|
|
+ var targetTime = if (uiData.runningStatus != DevStatus.RUNNING.toInt()) {
|
|
|
+ uiData.targetTime
|
|
|
+ } else if (uiData.targetTimeBuffer > 0) {
|
|
|
+ uiData.targetTimeBuffer
|
|
|
+ } else {
|
|
|
+ uiData.targetTime
|
|
|
+ }
|
|
|
+ var step = 0
|
|
|
+ if (whereIndex == 1) {
|
|
|
+ step += 60
|
|
|
+ } else {
|
|
|
+ step = rotateStep()
|
|
|
+ }
|
|
|
if (increase) {
|
|
|
- targetTime += rotateStep()
|
|
|
+ targetTime += step
|
|
|
} else {
|
|
|
- targetTime -= rotateStep()
|
|
|
+ targetTime -= step
|
|
|
}
|
|
|
if (targetTime > uiData.limitMaxTime) {
|
|
|
targetTime = uiData.limitMaxTime
|
|
@@ -986,6 +1014,7 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
}
|
|
|
}
|
|
|
uiData.isTimeChange = true
|
|
|
+ Log.d("eeeeeee", "${uiData.targetTime} == ${targetTime} === $step")
|
|
|
uiData.targetTime = targetTime
|
|
|
binding.controller.clSetTime.isTimeCanChange(true)
|
|
|
// 回调到上面那个地方来设置时间
|
|
@@ -1034,16 +1063,19 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
clickFirstButton(BUTTON_TAG_PAUSE)
|
|
|
Log.d("QQQQ", "click stop")
|
|
|
}
|
|
|
+
|
|
|
DevStatus.PAUSE.toInt() -> {
|
|
|
viewModel.stepUiData.doingModify = false
|
|
|
clickFirstButton(BUTTON_TAG_RESUME)
|
|
|
Log.d("QQQQ", "click stop")
|
|
|
}
|
|
|
+
|
|
|
DevStatus.STOP.toInt() -> {
|
|
|
viewModel.stepUiData.doingModify = false
|
|
|
clickFirstButton(BUTTON_TAG_START)
|
|
|
Log.d("QQQQ", "click start")
|
|
|
}
|
|
|
+
|
|
|
else -> {
|
|
|
Log.d("QQQQ", "nothing to do")
|
|
|
}
|
|
@@ -1106,7 +1138,7 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
FoodDataProvider.getUserDatabase().userInfoDao().removeFavoriteRecipe(
|
|
|
CURRENT_USER_ID, recipeNumber ?: ""
|
|
|
)
|
|
|
- EventBus.getDefault().post(RefreshLikeDataEvent(false,recipeNumber?:""))
|
|
|
+ EventBus.getDefault().post(RefreshLikeDataEvent(false, recipeNumber ?: ""))
|
|
|
}
|
|
|
binding.ivAddToFav.src = R.drawable.ic_cook_fav
|
|
|
} else {
|
|
@@ -1116,7 +1148,7 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
FoodDataProvider.getUserDatabase().userInfoDao().insertFavoriteRecipe(
|
|
|
UserFavoriteRecipes(CURRENT_USER_ID, recipeNumber ?: "")
|
|
|
)
|
|
|
- EventBus.getDefault().post(RefreshLikeDataEvent(true,recipeNumber?:""))
|
|
|
+ EventBus.getDefault().post(RefreshLikeDataEvent(true, recipeNumber ?: ""))
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1182,9 +1214,8 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
)
|
|
|
|
|
|
|
|
|
-
|
|
|
//蒸汽模式特殊处理
|
|
|
- if(viewModel.displayStep()?.workMode == ModesType.STEAM.name){
|
|
|
+ if (viewModel.displayStep()?.workMode == ModesType.STEAM.name) {
|
|
|
binding.controller.steamFire.configNum(uiData.targetTemp);
|
|
|
binding.controller.steamFireSmall.configNum(uiData.targetTemp);
|
|
|
}
|
|
@@ -1238,9 +1269,15 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
|
|
|
// 喷水设置
|
|
|
if (!viewModel.stepUiData.doingModify || focusUpdate) {
|
|
|
- binding.controller.waterRingView.updateProgress(CofarSDK.devInfo().waterGear?:0) // 圆环设置-当前运行速度
|
|
|
- binding.controller.waterSprayShow.updateGear(CofarSDK.devInfo().waterGear?:0) // 圆环设置-当前运行速度
|
|
|
- binding.controller.clCookWater.binding.waterSprayShow.updateGear(CofarSDK.devInfo().waterGear?:0) // 圆环设置-当前运行速度
|
|
|
+ binding.controller.waterRingView.updateProgress(
|
|
|
+ CofarSDK.devInfo().waterGear ?: 0
|
|
|
+ ) // 圆环设置-当前运行速度
|
|
|
+ binding.controller.waterSprayShow.updateGear(
|
|
|
+ CofarSDK.devInfo().waterGear ?: 0
|
|
|
+ ) // 圆环设置-当前运行速度
|
|
|
+ binding.controller.clCookWater.binding.waterSprayShow.updateGear(
|
|
|
+ CofarSDK.devInfo().waterGear ?: 0
|
|
|
+ ) // 圆环设置-当前运行速度
|
|
|
}
|
|
|
|
|
|
// 方向设置
|
|
@@ -1254,7 +1291,6 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
fun onDevCommonEvent(event: DevCommonEvent) {
|
|
|
|
|
|
|
|
|
-
|
|
|
ThreadUtils.runOnMainThread({
|
|
|
|
|
|
val mode = CofarSDK.devMode(viewModel.cookingStep?.workMode)
|
|
@@ -1267,7 +1303,7 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
|
|
|
|
|
|
//2023年06月22日10:55:55 增加步骤程序自动完成的时候自动跳转下一步
|
|
|
- if(CommonEventTypes.CONFIRM_STOP == event.type || CommonEventTypes.AUTO_STOP == event.type){
|
|
|
+ if (CommonEventTypes.CONFIRM_STOP == event.type || CommonEventTypes.AUTO_STOP == event.type) {
|
|
|
clickNextStep();
|
|
|
}
|
|
|
|