|
@@ -134,8 +134,8 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
private var is011 = false
|
|
|
private var isResetZero = -1 //初始扭橙的值
|
|
|
private var sn = getSN()
|
|
|
- private var keep:Boolean =false
|
|
|
- private lateinit var baseMode :BaseDevMode
|
|
|
+ private var keep: Boolean = false
|
|
|
+ private lateinit var baseMode: BaseDevMode
|
|
|
private val deviceStateDialog by lazy {
|
|
|
CancelConfirmDialog()
|
|
|
}
|
|
@@ -258,7 +258,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
viewModel.modeType = intent.extras?.getString(MODE_TYPE, ModesType.CHOP.name) ?: ""
|
|
|
modeName = intent.extras?.getString("mode_name", "") ?: ""
|
|
|
opMode = intent.extras?.getString("OP_MODE", "HAND") ?: "HAND"
|
|
|
- keep = intent.extras?.getBoolean("keep",false) ?:false
|
|
|
+ keep = intent.extras?.getBoolean("keep", false) ?: false
|
|
|
viewModel.lastModeType = viewModel.modeType
|
|
|
lastModeType = viewModel.modeType
|
|
|
modeType = lastModeType
|
|
@@ -350,11 +350,11 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
/**
|
|
|
* 当后台点进来模式页面,currentTemp为0故在这重新set值
|
|
|
* */
|
|
|
- if (currentTemp==0&&keep){
|
|
|
+ if (currentTemp == 0 && keep) {
|
|
|
// temp 当前温度 目标温度 targetTemp
|
|
|
- currentTemp = if (CofarSDK.devInfo().temp>baseMode.minTemp){
|
|
|
+ currentTemp = if (CofarSDK.devInfo().temp > baseMode.minTemp) {
|
|
|
CofarSDK.devInfo().temp.toInt()
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
baseMode.minTemp
|
|
|
}
|
|
|
}
|
|
@@ -421,12 +421,12 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
* 当后台点进来模式页面,currentTemp为0故在这重新set值
|
|
|
* */
|
|
|
|
|
|
- if (currentTemp==0&&keep){
|
|
|
+ if (currentTemp == 0 && keep) {
|
|
|
// temp 当前温度 目标温度 targetTemp
|
|
|
- currentTemp = if (CofarSDK.devInfo().temp>baseMode.minTemp){
|
|
|
+ currentTemp = if (CofarSDK.devInfo().temp > baseMode.minTemp) {
|
|
|
CofarSDK.devInfo().temp.toInt()
|
|
|
- }else{
|
|
|
- baseMode.minTemp+CofarSDK.getTempInterval()
|
|
|
+ } else {
|
|
|
+ baseMode.minTemp + CofarSDK.getTempInterval()
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -703,6 +703,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
ThreadUtils.runOnMainThread({
|
|
|
//currDevInfo.targetTime,
|
|
|
// currDevInfo.targetTime.toLong()
|
|
@@ -775,12 +776,12 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
|
|
|
//devInfo.potCloverStatus 0是合盖,1是没盒盖
|
|
|
//处理扭橙逻辑 一进来是扭橙盖,重新打开,重新闭合 没办法跳转到扭橙页面
|
|
|
- if (event.devInfo.potCloverStatus.toInt() == 1){
|
|
|
+ if (event.devInfo.potCloverStatus.toInt() == 1) {
|
|
|
isResetZero = event.devInfo.resetZero.toInt()
|
|
|
}
|
|
|
|
|
|
//处理扭橙运行过程中打开盖子还倒计时,估要调用SDK stop方法
|
|
|
- if (modeType==WorkModes.CITRUS_JUICER&&isClickType == DevStatus.RUNNING.toInt() &&event.devInfo.potCloverStatus.toInt() == 1){
|
|
|
+ if (modeType == WorkModes.CITRUS_JUICER && isClickType == DevStatus.RUNNING.toInt() && event.devInfo.potCloverStatus.toInt() == 1) {
|
|
|
stopClick()
|
|
|
}
|
|
|
|
|
@@ -791,8 +792,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
if (event.devInfo.resetZero.toInt() == 1 && event.devInfo.resetZero.toInt() != isResetZero) {
|
|
|
|
|
|
|
|
|
-
|
|
|
- var modeName = if (sn.startsWith("011")) {
|
|
|
+ var modeName = if (sn.startsWith("011")) {
|
|
|
resources.getString(com.develop.common.R.string.citrus_juicer_011)
|
|
|
} else {
|
|
|
resources.getString(com.develop.common.R.string.citrus_juicer)
|
|
@@ -890,6 +890,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
}
|
|
|
}
|
|
|
currDevInfo.mode.apply {
|
|
|
+
|
|
|
updateTempUI(
|
|
|
minTemp.toFloat(),
|
|
|
maxTemp.toFloat(),
|
|
@@ -1011,30 +1012,12 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
var configLock = false;
|
|
|
|
|
|
|
|
|
- private fun initModeData(type: String, keep: Boolean?= false) {
|
|
|
+ private fun initModeData(type: String, keep: Boolean? = false) {
|
|
|
|
|
|
- Log.d("TAG initModeData", "viewModel.modeType:" + viewModel.modeType+ " keep:"+keep)
|
|
|
+ Log.d("TAG initModeData", "viewModel.modeType:" + viewModel.modeType + " keep:" + keep)
|
|
|
viewModel.modeType.apply {
|
|
|
- baseMode = CofarSDK.devMode(this)
|
|
|
- //处理5/7/10寸屏,默认转速不同
|
|
|
- if (baseMode is Knead && !sn.startsWith("011")){
|
|
|
- var defMotorGear = when(StringUtils.getScreenSize(this@ModesDetailActivity)){
|
|
|
- 5->{
|
|
|
- 1
|
|
|
- }
|
|
|
- 7->{
|
|
|
- 3
|
|
|
- }
|
|
|
- 10->{
|
|
|
- 3
|
|
|
- }
|
|
|
- else->{
|
|
|
- 1
|
|
|
- }
|
|
|
- }
|
|
|
- baseMode.defaultMotorGear = defMotorGear
|
|
|
- }
|
|
|
-
|
|
|
+ baseMode = CofarSDK.devMode(this)
|
|
|
+ setKneadMotorGear(false)
|
|
|
|
|
|
|
|
|
//显示对应模式UI
|
|
@@ -1075,11 +1058,11 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
motorDirection = restoreConfig.motorDirection;
|
|
|
motorGear = restoreConfig.motorGear;
|
|
|
targetTime = restoreConfig.targetTime;
|
|
|
- }else{
|
|
|
- targetTemp = baseMode.defaultTemp.toShort()
|
|
|
- motorDirection = baseMode.motorDirection.toByte()
|
|
|
- motorGear = baseMode.defaultMotorGear.toByte()
|
|
|
- targetTime = baseMode.defaultTime.toInt()
|
|
|
+ } else {
|
|
|
+ targetTemp = baseMode.defaultTemp.toShort()
|
|
|
+ motorDirection = baseMode.motorDirection.toByte()
|
|
|
+ motorGear = baseMode.defaultMotorGear.toByte()
|
|
|
+ targetTime = baseMode.defaultTime.toInt()
|
|
|
}
|
|
|
} else {
|
|
|
CofarSDK.changeMode(type, baseMode)
|
|
@@ -1095,7 +1078,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
|
|
|
baseMode.apply {
|
|
|
currentTemp = targetTemp.toInt()
|
|
|
- Log.d("TAG currentTemp","currentTemp:"+currentTemp)
|
|
|
+ Log.d("TAG currentTemp", "currentTemp:" + currentTemp)
|
|
|
updateTempUI(
|
|
|
minTemp.toFloat(),
|
|
|
maxTemp.toFloat(),
|
|
@@ -1289,6 +1272,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
ModesType.TURBO.name -> {
|
|
|
CofarSDK.stop(false)
|
|
|
}
|
|
|
+
|
|
|
ModesType.SM_WIGHT.name -> {
|
|
|
CofarSDK.stop(false)
|
|
|
CofarSDK.startWeight()
|
|
@@ -1297,6 +1281,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
ModesType.SM_TURBO.name -> {
|
|
|
CofarSDK.stop(false)
|
|
|
}
|
|
|
+
|
|
|
else -> {
|
|
|
userChanging = false
|
|
|
CofarSDK.startRunning(viewModel.modeType)
|
|
@@ -1357,7 +1342,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
MotionEvent.ACTION_DOWN -> {
|
|
|
if (modeType != WorkModes.CITRUS_JUICER && CofarSDK.devInfo().resetZero.toInt() == 1) {
|
|
|
showMsgDialog(resources.getString(com.develop.common.R.string.dev_remove_orange_parts))
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
Log.d("dddddd", "按下(${motionEvent.x},${motionEvent.y})")
|
|
|
turboDownEvent()
|
|
|
}
|
|
@@ -1400,7 +1385,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
if (viewModel.modeType == ModesType.TURBO.name) {
|
|
|
binding.llTurboView.visibility = View.VISIBLE
|
|
|
}
|
|
|
- }else if (viewModel.modeType == ModesType.CITRUS_JUICER.name){
|
|
|
+ } else if (viewModel.modeType == ModesType.CITRUS_JUICER.name) {
|
|
|
binding.ivTurbo.visibility = View.GONE
|
|
|
} else {
|
|
|
// isWidget = true
|
|
@@ -1735,7 +1720,6 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
binding.apply {
|
|
|
|
|
|
|
|
|
-
|
|
|
clCookTemp.updateChangeValue("${FoodSdkUtils.parseTemp(currDevInfo.temp)}°C")
|
|
|
tempRingView.setRange(minTemp, maxTemp)
|
|
|
tempRingView.setCanTouch(isTempChange)
|
|
@@ -1756,7 +1740,6 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
var tempBuffer = CofarSDK.devInfo().targetTempBuffer
|
|
|
steamFire.configNum(
|
|
|
CofarUtils.parseTemp(if (tempBuffer.toInt() != -1) tempBuffer else targetTemp.toShort())
|
|
@@ -1960,7 +1943,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
//当前用户正在修改不更新按钮状态
|
|
|
if (userChanging) return
|
|
|
//切碎功能隐藏按钮
|
|
|
- if (viewModel.modeType == ModesType.TURBO.name||viewModel.modeType == ModesType.SM_TURBO.name) {
|
|
|
+ if (viewModel.modeType == ModesType.TURBO.name || viewModel.modeType == ModesType.SM_TURBO.name) {
|
|
|
binding.apply {
|
|
|
btnStart.visibility = View.GONE
|
|
|
btnResume.visibility = View.GONE
|
|
@@ -1972,7 +1955,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if (viewModel.modeType == ModesType.WIGHT.name||viewModel.modeType == ModesType.SM_WIGHT.name) {
|
|
|
+ if (viewModel.modeType == ModesType.WIGHT.name || viewModel.modeType == ModesType.SM_WIGHT.name) {
|
|
|
binding.apply {
|
|
|
btnStart.visibility = View.GONE
|
|
|
btnResume.visibility = View.GONE
|
|
@@ -2027,13 +2010,13 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
DevStatus.STOP -> {
|
|
|
binding.apply {
|
|
|
ivWeight.visibility = View.VISIBLE
|
|
|
- if (viewModel.modeType == ModesType.CITRUS_JUICER.name){
|
|
|
+ if (viewModel.modeType == ModesType.CITRUS_JUICER.name) {
|
|
|
binding.ivTurbo.visibility = View.GONE
|
|
|
- }else{
|
|
|
- if (isModelNum == "5067"&&viewModel.modeType == ModesType.SM_WIGHT.name){
|
|
|
+ } else {
|
|
|
+ if (isModelNum == "5067" && viewModel.modeType == ModesType.SM_WIGHT.name) {
|
|
|
ivWeight.visibility = View.GONE
|
|
|
ivTurbo.visibility = View.GONE
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
ivTurbo.visibility = View.VISIBLE
|
|
|
}
|
|
|
}
|
|
@@ -2075,6 +2058,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
* 点击开始操作
|
|
|
*/
|
|
|
private fun startClick(showStopTips: Boolean = true) {
|
|
|
+
|
|
|
var devInfo = CofarSDK.devInfo()
|
|
|
//判断是否是空炸错误,由于汤锅错误SDK 已经做了
|
|
|
if (ConfigUtils.getBooleanErrCode(devInfo.errCode.toInt()) && devInfo.devMode == DevModes.AIR_FRYER) {
|
|
@@ -2186,10 +2170,12 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
* 点击停止操作
|
|
|
*/
|
|
|
private fun stopClick(tips: Boolean = true) {
|
|
|
+
|
|
|
userChanging = false
|
|
|
//中途系统出现故障记录
|
|
|
isClickType = 0
|
|
|
|
|
|
+
|
|
|
//结束
|
|
|
CofarSDK.stop(tips)
|
|
|
try {
|
|
@@ -2269,7 +2255,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
*/
|
|
|
private fun backClick() {
|
|
|
if (modeChange) {
|
|
|
- if (modeType == ModesType.TURBO.name||modeType == ModesType.SM_TURBO.name) { //TURBO未停止之前不能退出
|
|
|
+ if (modeType == ModesType.TURBO.name || modeType == ModesType.SM_TURBO.name) { //TURBO未停止之前不能退出
|
|
|
CofarSDK.stop(false)
|
|
|
if (DevStatus.STOP != CofarSDK.devInfo().status.toByte()) {
|
|
|
return
|
|
@@ -2424,7 +2410,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
viewModel.stopTurbo()
|
|
|
}
|
|
|
|
|
|
- private fun init011Mode(obj :Any){
|
|
|
+ private fun init011Mode(obj: Any) {
|
|
|
|
|
|
|
|
|
}
|
|
@@ -2632,16 +2618,18 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
when (event.isType) {
|
|
|
0 -> {
|
|
|
//模式
|
|
|
- if (CofarSDK.devInfo().runningStatus != DevStatus.STOP){
|
|
|
+ if (CofarSDK.devInfo().runningStatus != DevStatus.STOP) {
|
|
|
showMsgOKDialog(getString(com.develop.common.R.string.running_block_tips))
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
1 -> {
|
|
|
//食谱
|
|
|
- if (CofarSDK.devInfo().runningStatus != DevStatus.STOP){
|
|
|
+ if (CofarSDK.devInfo().runningStatus != DevStatus.STOP) {
|
|
|
var backDialog = CancelConfirmDialog()
|
|
|
backDialog.apply {
|
|
|
- title = ctx.getString(com.develop.common.R.string.keep_cooking_in_the_background)
|
|
|
+ title =
|
|
|
+ ctx.getString(com.develop.common.R.string.keep_cooking_in_the_background)
|
|
|
onDialogClickListener = object : CancelConfirmDialog.OnDialogClickListener {
|
|
|
override fun onConfirm() {
|
|
|
if (CofarSDK.devInfo().status == DevStatus.STOP.toInt()) {
|
|
@@ -2670,7 +2658,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
FloatWindowManager.showStepFlowWindow(cookStepEvent)
|
|
|
|
|
|
|
|
|
- getRecipe(event.recipeNumber?:"")
|
|
|
+ getRecipe(event.recipeNumber ?: "")
|
|
|
|
|
|
finish()
|
|
|
}
|
|
@@ -2681,7 +2669,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
runOnMainThread {
|
|
|
FloatWindowManager.hideStepFlowWindow()
|
|
|
CofarSDK.stop()
|
|
|
- getRecipe(event.recipeNumber?:"")
|
|
|
+ getRecipe(event.recipeNumber ?: "")
|
|
|
finish()
|
|
|
}
|
|
|
}
|
|
@@ -2693,13 +2681,53 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
else -> {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private fun getRecipe(number:String){
|
|
|
+ private fun setKneadMotorGear(isStop :Boolean) {
|
|
|
+ //处理5/7/10寸屏,默认转速不同
|
|
|
+ if (baseMode is Knead && !sn.startsWith("011")) {
|
|
|
+ var defMotorGear = when (StringUtils.getScreenSize(this@ModesDetailActivity)) {
|
|
|
+ 5 -> {
|
|
|
+ 1
|
|
|
+ }
|
|
|
+
|
|
|
+ 7 -> {
|
|
|
+ 3
|
|
|
+ }
|
|
|
+
|
|
|
+ 10 -> {
|
|
|
+ 3
|
|
|
+ }
|
|
|
+
|
|
|
+ else -> {
|
|
|
+ 1
|
|
|
+ }
|
|
|
+ }
|
|
|
+ baseMode.defaultMotorGear = defMotorGear
|
|
|
+// if (isStop){
|
|
|
+//// baseMode.isMotorGearChange = true
|
|
|
+// CofarSDK.devInfo().motorGear = defMotorGear.toByte()
|
|
|
+//// CofarSDK.cfgMotorGear(defMotorGear.toByte())
|
|
|
+// }
|
|
|
+
|
|
|
+// CofarSDK.cfgMotorGearNative((byte)this.initMotorGear);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //程序运行完以后回调
|
|
|
+ override fun onDevStop() {
|
|
|
+ setKneadMotorGear(true)
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun getRecipe(number: String) {
|
|
|
FoodDataProvider.getDatabase().recipeDao().apply {
|
|
|
var recipeNumber = number
|
|
|
if (recipeNumber.contains("@")) {
|
|
@@ -2729,4 +2757,6 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|