|
@@ -1,6 +1,7 @@
|
|
|
package com.develop.step.ui
|
|
|
|
|
|
import android.annotation.SuppressLint
|
|
|
+import android.graphics.BitmapFactory
|
|
|
import android.os.Bundle
|
|
|
import android.util.Log
|
|
|
import android.view.KeyEvent
|
|
@@ -9,6 +10,7 @@ import android.view.KeyEvent.ACTION_UP
|
|
|
import android.view.LayoutInflater
|
|
|
import android.view.MotionEvent
|
|
|
import android.view.View
|
|
|
+import android.widget.ImageView
|
|
|
import com.alibaba.android.arouter.facade.annotation.Route
|
|
|
import com.develop.base.util.ThreadUtils
|
|
|
import com.develop.common.data_repo.db.ModesType
|
|
@@ -113,7 +115,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
binding.clCookDirection.visibility = View.VISIBLE;
|
|
|
binding.clCookSpeed.visibility = View.VISIBLE;
|
|
|
binding.clCookWater.visibility = View.GONE
|
|
|
- binding.ivTurbo.visibility = View.VISIBLE
|
|
|
+ // binding.ivTurbo.visibility = View.VISIBLE
|
|
|
|
|
|
}
|
|
|
|
|
@@ -370,8 +372,22 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (CommonEventTypes.MOTOR_GEAR_RATHER_THEN_3_WITH_TEMP == event.type || CommonEventTypes.MOTOR_REVERSE_CAN_NOT_RATHER_THEN_3 == event.type) {
|
|
|
- CofarSDK.cfgMotorGear(3);
|
|
|
+ if (CommonEventTypes.MAX_MOTOR_GEAR_RATHER_THEN_WITH_TEMP == event.type ) {
|
|
|
+ CofarSDK.cfgMotorGear(CofarSDK.devInfo().mode.maxMotorWithTemp.toByte())
|
|
|
+ currDevInfo.mode.apply {
|
|
|
+ updateMotorGearUI(
|
|
|
+ minMotorGear.toFloat(),
|
|
|
+ maxMotorGear.toFloat(),
|
|
|
+ CofarSDK.devInfo().mode.maxMotorWithTemp,
|
|
|
+ isMotorGearChange
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if ( CommonEventTypes.MOTOR_REVERSE_CAN_NOT_RATHER_THEN_3 == event.type) {
|
|
|
+ CofarSDK.cfgMotorGear(3)
|
|
|
currDevInfo.mode.apply {
|
|
|
updateMotorGearUI(
|
|
|
minMotorGear.toFloat(),
|
|
@@ -435,7 +451,8 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
isWaterGearChange
|
|
|
)
|
|
|
|
|
|
- updateMotorDirectionUI(currDevInfo.motorDirection.toInt(), isMotorDirectionChange)
|
|
|
+ updateMotorDirectionUI(if(currDevInfo.motorDirectionBuffer.toInt() == -1) currDevInfo.motorDirection.toInt() else currDevInfo.motorDirectionBuffer.toInt(), isMotorDirectionChange)
|
|
|
+
|
|
|
updateWeightUI(currDevInfo.weight.toFloat())
|
|
|
}
|
|
|
}
|
|
@@ -447,7 +464,19 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
private fun initData() {
|
|
|
var workMode = ConfigUtils.getMode(modeType)
|
|
|
binding.tvModeName.text = getString(resources.getIdentifier(workMode?.name,"string",this.packageName))
|
|
|
- binding.ivBanner.setBackgroundResource(resources.getIdentifier(workMode?.bg,"drawable",this.packageName))
|
|
|
+ binding.ivBanner.setImageResource(resources.getIdentifier(workMode?.bg,"drawable",this.packageName))
|
|
|
+// // 获取ImageView的宽度和高度
|
|
|
+// val imageViewWidth = binding.ivBanner.width
|
|
|
+// val imageViewHeight = binding.ivBanner.height
|
|
|
+//
|
|
|
+// // 设置ImageView的尺寸和scaleType属性
|
|
|
+// binding.ivBanner.layoutParams.width = imageViewWidth
|
|
|
+// binding.ivBanner.layoutParams.height = imageViewHeight
|
|
|
+// binding.ivBanner.scaleType = ImageView.ScaleType.FIT_CENTER
|
|
|
+//
|
|
|
+// // 设置ImageView的图片
|
|
|
+// val bitmap = BitmapFactory.decodeResource(resources, resources.getIdentifier(workMode?.bg,"drawable",this.packageName))
|
|
|
+// binding.ivBanner.setImageBitmap(bitmap)
|
|
|
//点击切换的模式来显示对应的UI
|
|
|
viewModel.currentStep.observe(this) {
|
|
|
if (it == null) {
|
|
@@ -1121,6 +1150,11 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
private fun updateMotorGearUI(
|
|
|
minMotorGear: Float, maxMotorGear: Float, currentMotorGer: Int, isMotorGearChange: Boolean,focusUpdate: Boolean = false
|
|
|
) {
|
|
|
+
|
|
|
+ if(CofarSDK.devInfo().devMode != DevModes.SOUP){
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
this.minMotorGear = minMotorGear.toInt()
|
|
|
this.maxMotorGear = maxMotorGear.toInt()
|
|
|
this.isMotorGearChange = isMotorGearChange
|
|
@@ -1128,7 +1162,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
clCookSpeed.updateChangeValue(currentMotorGer.toString())
|
|
|
speedRingView.setRange(minMotorGear, maxMotorGear)
|
|
|
speedRingView.setCanTouch(isMotorGearChange)
|
|
|
- if (!userChanging) {
|
|
|
+ if (!userChanging || focusUpdate) {
|
|
|
speedRingView.updateProgress(currentMotorGer)
|
|
|
speedRingText.text = currentMotorGer.toString()
|
|
|
}
|
|
@@ -1147,6 +1181,10 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
minWaterGear: Float, maxWaterGear: Float, currentMotorGer: Int, isWaterGearChange: Boolean,focusUpdate: Boolean = false
|
|
|
) {
|
|
|
|
|
|
+ if(CofarSDK.devInfo().devMode != DevModes.AIR_FRYER){
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
this.minWaterGear = minWaterGear.toInt()
|
|
|
this.maxWaterGear = maxWaterGear.toInt()
|
|
|
this.isWaterGearChange = isWaterGearChange
|
|
@@ -1259,9 +1297,9 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
if (currDevInfo.status.toByte() != DevStatus.STOP) {
|
|
|
binding.btnCancel.visibility = View.VISIBLE
|
|
|
binding.btnConfirm.visibility = View.VISIBLE
|
|
|
- binding.btnStop.visibility = View.INVISIBLE
|
|
|
- binding.btnPause.visibility = View.INVISIBLE
|
|
|
- binding.btnResume.visibility = View.INVISIBLE
|
|
|
+ binding.btnStop.visibility = View.GONE
|
|
|
+ binding.btnPause.visibility = View.GONE
|
|
|
+ binding.btnResume.visibility = View.GONE
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1450,7 +1488,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
* 点击电机方向事件
|
|
|
*/
|
|
|
private fun motorGearDirectionClick(direction: DirectionView.Direction) {
|
|
|
- userChanging = false
|
|
|
+ userChanging = true
|
|
|
binding.clCookDirection.updateChangeValue(
|
|
|
viewModel.getDirectionStr(
|
|
|
direction == DirectionView.Direction.LEFT, resources
|
|
@@ -1458,11 +1496,14 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
)
|
|
|
if (direction != DirectionView.Direction.RIGHT) {
|
|
|
CofarSDK.cfgMotorDirection(MotorDirections.REVERSE);
|
|
|
+ updateMotorDirectionUI(MotorDirections.REVERSE.toInt(), true);
|
|
|
+
|
|
|
|
|
|
} else {
|
|
|
CofarSDK.cfgMotorDirection(MotorDirections.FORWARD);
|
|
|
+ updateMotorDirectionUI(MotorDirections.FORWARD.toInt(), true);
|
|
|
+
|
|
|
}
|
|
|
- updateMotorDirectionUI(currDevInfo.motorDirection.toInt(), true);
|
|
|
|
|
|
showConfirmAndCancelBtn()
|
|
|
}
|