|
@@ -103,24 +103,28 @@ class CookStepActivity2 : CookStepToolActivity() {
|
|
|
initData()
|
|
|
|
|
|
binding.viewRemark.setOnClickListener {
|
|
|
- Log.i("dd",CURRENT_USER_ID.toString() + recipeNumber.toString() + currentStepIndex.toString());
|
|
|
+ Log.i(
|
|
|
+ "dd",
|
|
|
+ CURRENT_USER_ID.toString() + recipeNumber.toString() + currentStepIndex.toString()
|
|
|
+ );
|
|
|
var data = FoodDataProvider.getUserDatabase().userInfoDao().queryUserRecipeStepRemark(
|
|
|
- CURRENT_USER_ID,recipeNumber.toString(),viewModel.stepIndex.toString());
|
|
|
+ CURRENT_USER_ID, recipeNumber.toString(), viewModel.stepIndex.toString()
|
|
|
+ );
|
|
|
var dialog = NoteEditDialog();
|
|
|
dialog.text = data?.remark
|
|
|
- dialog.listener = object :NoteEditDialog.OnDialogClickListener{
|
|
|
- override fun onComplete(remark:String) {
|
|
|
+ dialog.listener = object : NoteEditDialog.OnDialogClickListener {
|
|
|
+ override fun onComplete(remark: String) {
|
|
|
viewModel.recipe?.let {
|
|
|
|
|
|
|
|
|
- if(data == null){
|
|
|
- data = UserRecipeStepRemark(
|
|
|
+ if (data == null) {
|
|
|
+ data = UserRecipeStepRemark(
|
|
|
recipeNumber = it.number.toString(),
|
|
|
stepNumber = viewModel.stepIndex.toString(),
|
|
|
userId = CURRENT_USER_ID,
|
|
|
remark = remark
|
|
|
)
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
data!!.remark = remark;
|
|
|
}
|
|
|
|
|
@@ -141,10 +145,14 @@ class CookStepActivity2 : CookStepToolActivity() {
|
|
|
|
|
|
}
|
|
|
|
|
|
- ThreadUtils.runOnMainThread({
|
|
|
- CofarSDK.resetLastPotStatus()
|
|
|
- },1000)
|
|
|
+ ThreadUtils.runOnMainThread({
|
|
|
+ CofarSDK.resetLastPotStatus()
|
|
|
+ }, 1000)
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
+ override fun showDeviceStateDialog(): Boolean {
|
|
|
+ return false
|
|
|
}
|
|
|
|
|
|
private fun initData() {
|
|
@@ -152,17 +160,15 @@ class CookStepActivity2 : CookStepToolActivity() {
|
|
|
viewModel.stepDisplay.observe(this) { it ->
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
coverPath = FoodDataProvider.getImagePath(it.source.photoVideoFilePath)
|
|
|
currModes = it.workMode
|
|
|
- if(it.workMode == "FINISH_DESC"){
|
|
|
+ if (it.workMode == "FINISH_DESC") {
|
|
|
|
|
|
val stepCount = viewModel.getStepCount()
|
|
|
val stepIndex = viewModel.allSteps.indexOf(it)
|
|
|
changeDescription()
|
|
|
cookProgressDrawable.setStepState(stepIndex, stepCount)
|
|
|
- binding.tvStepName.text =getText(R.string.engjoy_your_meal)
|
|
|
+ binding.tvStepName.text = getText(R.string.engjoy_your_meal)
|
|
|
binding.tvTitleStep.text = getText(R.string.recipe_complete)
|
|
|
|
|
|
if (stepCount == 1) {
|
|
@@ -180,7 +186,7 @@ class CookStepActivity2 : CookStepToolActivity() {
|
|
|
}
|
|
|
|
|
|
var photoPath = it.source.photoVideoFilePath;
|
|
|
- if(photoPath == null || photoPath == ""){
|
|
|
+ if (photoPath == null || photoPath == "") {
|
|
|
photoPath = viewModel.recipe?.photoPath;
|
|
|
}
|
|
|
|
|
@@ -189,7 +195,7 @@ class CookStepActivity2 : CookStepToolActivity() {
|
|
|
.transition(DrawableTransitionOptions.withCrossFade())
|
|
|
.error(R.drawable.bg_cook_session)
|
|
|
.into(binding.ivCookBg)
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
binding.tvTitleStep.text = titleName
|
|
|
if (CofarSDK.devInfo().status == DevStatus.STOP.toInt()) {
|
|
|
CofarSDK.changeModeWithoutCfg(
|
|
@@ -223,31 +229,32 @@ class CookStepActivity2 : CookStepToolActivity() {
|
|
|
// )
|
|
|
// )
|
|
|
cookProgressDrawable.setStepState(stepIndex, stepCount)
|
|
|
- if(it.source.description == null || it.source.description == ""){
|
|
|
+ if (it.source.description == null || it.source.description == "") {
|
|
|
var minute = "0"
|
|
|
var second = "0"
|
|
|
var temperature = "0"
|
|
|
var rotateSpeed = "0"
|
|
|
var rotateDirection = MotorDirections.FORWARD.toString()
|
|
|
- if(it.source.minute != null){
|
|
|
+ if (it.source.minute != null) {
|
|
|
minute = it.source.minute.toString();
|
|
|
}
|
|
|
- if(it.source.second != null){
|
|
|
+ if (it.source.second != null) {
|
|
|
second = it.source.second.toString();
|
|
|
}
|
|
|
- if(it.source.temperature != null){
|
|
|
- temperature = CofarUtils.parseTemp(it.source.temperature!!.toShort()).toString();
|
|
|
+ if (it.source.temperature != null) {
|
|
|
+ temperature =
|
|
|
+ CofarUtils.parseTemp(it.source.temperature!!.toShort()).toString();
|
|
|
}
|
|
|
- if(it.source.rotateSpeed != null ){
|
|
|
+ if (it.source.rotateSpeed != null) {
|
|
|
rotateSpeed = it.source.rotateSpeed.toString();
|
|
|
}
|
|
|
- if(it.source.rotateDirection != null && it.source.rotateDirection != ""){
|
|
|
+ if (it.source.rotateDirection != null && it.source.rotateDirection != "") {
|
|
|
rotateDirection = it.source.rotateDirection.toString();
|
|
|
}
|
|
|
//var description = "${temperature}°C/${minute}m${second}s/V${rotateSpeed}/${if(rotateDirection == MotorDirections.FORWARD.toString()) "R" else "L"}";
|
|
|
- binding.tvStepName.text =""
|
|
|
+ binding.tvStepName.text = ""
|
|
|
// binding.tvTitleStep.text = description
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
binding.tvStepName.text = it.source.description
|
|
|
// binding.tvTitleStep.text = it.source.description
|
|
|
}
|
|
@@ -267,7 +274,7 @@ class CookStepActivity2 : CookStepToolActivity() {
|
|
|
}
|
|
|
|
|
|
var photoPath = it.source.photoVideoFilePath;
|
|
|
- if(photoPath == null || photoPath == ""){
|
|
|
+ if (photoPath == null || photoPath == "") {
|
|
|
photoPath = viewModel.recipe?.photoPath;
|
|
|
}
|
|
|
|
|
@@ -373,7 +380,11 @@ class CookStepActivity2 : CookStepToolActivity() {
|
|
|
CofarSDK.cfgHeat(it.uiData.targetTemp.toShort(), 0)
|
|
|
CofarSDK.cfgTime(it.uiData.targetTime)
|
|
|
|
|
|
- CofarSDK.cfgMotor(it.uiData.currentSpeed.toByte(),it.uiData.direction.toByte(),1);
|
|
|
+ CofarSDK.cfgMotor(
|
|
|
+ it.uiData.currentSpeed.toByte(),
|
|
|
+ it.uiData.direction.toByte(),
|
|
|
+ 1
|
|
|
+ );
|
|
|
|
|
|
}
|
|
|
ThreadUtils.runOnMainThread({
|
|
@@ -488,7 +499,7 @@ class CookStepActivity2 : CookStepToolActivity() {
|
|
|
initStepData();
|
|
|
ThreadUtils.runOnMainThread({
|
|
|
configing = false
|
|
|
- },1000);
|
|
|
+ }, 1000);
|
|
|
} else if (tag == BUTTON_TAG_CANCEL) {
|
|
|
CofarSDK.cancel()
|
|
|
binding.controller.btnStart.setGone()
|
|
@@ -550,14 +561,19 @@ class CookStepActivity2 : CookStepToolActivity() {
|
|
|
mRunningInstId = devInfo.runningInstId
|
|
|
mSettingInstId = devInfo.settingInstId
|
|
|
it.uiData.runningStatus = devInfo.status
|
|
|
- if(!viewModel.stepUiData.doingModify) it.uiData.targetTemp = CofarUtils.parseTemp(devInfo.targetTemp).toInt()
|
|
|
- if(!viewModel.stepUiData.doingModify) it.uiData.targetTime = devInfo.targetTime.toInt()
|
|
|
- if(!viewModel.stepUiData.doingModify) it.uiData.currentSpeed = devInfo.motorGear.toInt()
|
|
|
+ if (!viewModel.stepUiData.doingModify) it.uiData.targetTemp =
|
|
|
+ CofarUtils.parseTemp(devInfo.targetTemp).toInt()
|
|
|
+ if (!viewModel.stepUiData.doingModify) it.uiData.targetTime =
|
|
|
+ devInfo.targetTime.toInt()
|
|
|
+ if (!viewModel.stepUiData.doingModify) it.uiData.currentSpeed =
|
|
|
+ devInfo.motorGear.toInt()
|
|
|
it.uiData.weightNum = devInfo.weight.toInt()
|
|
|
- if(!viewModel.stepUiData.doingModify) it.uiData.direction = devInfo.motorDirection.toInt()
|
|
|
+ if (!viewModel.stepUiData.doingModify) it.uiData.direction =
|
|
|
+ devInfo.motorDirection.toInt()
|
|
|
it.uiData.currentTemp = CofarUtils.parseTemp(devInfo.temp).toInt()
|
|
|
it.uiData.remainTime = devInfo.remainTime.toInt()
|
|
|
- if(!viewModel.stepUiData.doingModify) it.uiData.targetTimeBuffer = devInfo.targetTimeBuffer.toInt()
|
|
|
+ if (!viewModel.stepUiData.doingModify) it.uiData.targetTimeBuffer =
|
|
|
+ devInfo.targetTimeBuffer.toInt()
|
|
|
it.uiData.isTimeChange = devInfo.mode.isTimeChange
|
|
|
it.uiData.isTempChange = devInfo.mode.isTempChange
|
|
|
it.uiData.isMotorDirectionChange = devInfo.mode.isMotorDirectionChange
|
|
@@ -585,7 +601,7 @@ class CookStepActivity2 : CookStepToolActivity() {
|
|
|
viewModel.cookingStep?.let {
|
|
|
updateUiSetting(it)
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
viewModel.displayStep()?.let {
|
|
|
it.uiData.currentTemp = CofarUtils.parseTemp(devInfo.temp).toInt() //回显实时温度
|
|
|
updateUiSetting(it);
|
|
@@ -657,6 +673,7 @@ class CookStepActivity2 : CookStepToolActivity() {
|
|
|
TURN_UP_KEY_CODE -> {
|
|
|
operateByPhysical(true)
|
|
|
}
|
|
|
+
|
|
|
TURN_DOWN_KEY_CODE -> {
|
|
|
operateByPhysical(false)
|
|
|
}
|
|
@@ -842,9 +859,9 @@ class CookStepActivity2 : CookStepToolActivity() {
|
|
|
if (keyCode == PRESS_DOWN_KEY_CODE) {
|
|
|
Log.d("QQQQ", "catch key down")
|
|
|
|
|
|
- if(!viewModel.isCurrentOnCookingStep()){
|
|
|
- return false
|
|
|
- }
|
|
|
+ if (!viewModel.isCurrentOnCookingStep()) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
|
|
|
//当前是turbo模式下
|
|
|
if (viewModel.cookingStep?.isTurboMode() != true && viewModel.cookingStep?.isWeightMode() != true && viewModel.cookingStep?.isDescription() != true) {
|
|
@@ -876,12 +893,12 @@ class CookStepActivity2 : CookStepToolActivity() {
|
|
|
}
|
|
|
|
|
|
|
|
|
- } else if(viewModel.cookingStep?.isTurboMode() == true){
|
|
|
+ } else if (viewModel.cookingStep?.isTurboMode() == true) {
|
|
|
turboUpEvent();
|
|
|
- } else if(viewModel.cookingStep?.isWeightMode() == true){
|
|
|
+ } else if (viewModel.cookingStep?.isWeightMode() == true) {
|
|
|
clickWeightTare();
|
|
|
}
|
|
|
- if (currModes == "FINISH_DESC"){
|
|
|
+ if (currModes == "FINISH_DESC") {
|
|
|
hideCommonDialog()
|
|
|
}
|
|
|
}
|
|
@@ -967,8 +984,8 @@ class CookStepActivity2 : CookStepToolActivity() {
|
|
|
}
|
|
|
|
|
|
|
|
|
- //蒸汽模式特殊处理
|
|
|
- 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);
|
|
|
}
|
|
@@ -1056,17 +1073,17 @@ class CookStepActivity2 : CookStepToolActivity() {
|
|
|
}
|
|
|
|
|
|
|
|
|
- if(CommonEventTypes.CONFIRM_STOP == event.type){
|
|
|
+ if (CommonEventTypes.CONFIRM_STOP == event.type) {
|
|
|
clickNextStep();
|
|
|
}
|
|
|
|
|
|
|
|
|
- if (CommonEventTypes.MOTOR_REVERSE_CAN_NOT_RATHER_THEN_3 == event.type ) {
|
|
|
+ if (CommonEventTypes.MOTOR_REVERSE_CAN_NOT_RATHER_THEN_3 == event.type) {
|
|
|
CofarSDK.cfgMotorGear(3)
|
|
|
viewModel.cookingStep?.let { updateUiSetting(it, true) }
|
|
|
}
|
|
|
|
|
|
- if (CommonEventTypes.MOTOR_GEAR_RATHER_THEN_4_WITH_TEMP == event.type ) {
|
|
|
+ if (CommonEventTypes.MOTOR_GEAR_RATHER_THEN_4_WITH_TEMP == event.type) {
|
|
|
CofarSDK.cfgMotorGear(4)
|
|
|
viewModel.cookingStep?.let { updateUiSetting(it, true) }
|
|
|
}
|