|
@@ -12,11 +12,13 @@ import android.view.View
|
|
|
import androidx.core.graphics.drawable.DrawableCompat
|
|
|
import com.alibaba.android.arouter.facade.annotation.Route
|
|
|
import com.bumptech.glide.Glide
|
|
|
+import com.develop.base.ext.getSN
|
|
|
import com.develop.base.ext.isNightTheme
|
|
|
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.ThreadUtils
|
|
|
import com.develop.common.bean.TuyaEvent
|
|
|
import com.develop.common.data_repo.db.ModesType
|
|
@@ -37,8 +39,10 @@ import com.develop.common.widget.DirectionView
|
|
|
import com.develop.common.widget.RingControlView
|
|
|
import com.develop.common.widget.TimePickerView
|
|
|
import com.develop.step.CookSettingType
|
|
|
+import com.develop.step.R
|
|
|
import com.develop.step.databinding.ActivityModeDetailBinding
|
|
|
import com.develop.step.viewmodel.ModesViewMode
|
|
|
+import com.drake.net.time.Interval
|
|
|
import com.kuyuntech.cofarcooking.device.sdk.constant.core.CommonEventTypes
|
|
|
import com.kuyuntech.cofarcooking.device.sdk.constant.core.DevModes
|
|
|
import com.kuyuntech.cofarcooking.device.sdk.constant.core.DevStatus
|
|
@@ -51,6 +55,7 @@ import com.kuyuntech.cofarcooking.device.sdk.util.core.CofarSDK
|
|
|
import org.greenrobot.eventbus.EventBus
|
|
|
import org.greenrobot.eventbus.Subscribe
|
|
|
import java.util.Objects
|
|
|
+import java.util.concurrent.TimeUnit
|
|
|
|
|
|
/**
|
|
|
* 模式详情页
|
|
@@ -93,6 +98,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
private var modeName = ""
|
|
|
private var opMode = "HAND"
|
|
|
lateinit var ctx: Context
|
|
|
+ private var potCloverInterval: Interval? = null
|
|
|
|
|
|
private val backRequestDialog by lazy {
|
|
|
CancelConfirmDialog()
|
|
@@ -116,7 +122,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
binding.clCookDirection.visibility = View.GONE;
|
|
|
binding.clCookSpeed.visibility = View.GONE;
|
|
|
binding.clCookWater.visibility = View.VISIBLE
|
|
|
- binding.ivTurbo.visibility = View.GONE
|
|
|
+ binding.ivTurbo.visibility = View.INVISIBLE
|
|
|
|
|
|
|
|
|
}
|
|
@@ -146,6 +152,11 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if (!getSN().startsWith("000")) {
|
|
|
+ binding.tvCount.setGone()
|
|
|
+ binding.ivPotCover.setGone()
|
|
|
+ }
|
|
|
+
|
|
|
turnDevModeUI();
|
|
|
viewModel.modeType = intent.extras?.getString(MODE_TYPE, ModesType.CHOP.name) ?: ""
|
|
|
modeName = intent.extras?.getString("mode_name", "") ?: ""
|
|
@@ -553,6 +564,10 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
}, 500)
|
|
|
}
|
|
|
|
|
|
+ private var potCloverEleStatus = 0
|
|
|
+
|
|
|
+ private var currentBgId = com.develop.common.R.drawable.pot_clover_ele_unlock //0是开锁图,1上锁图
|
|
|
+
|
|
|
@Subscribe
|
|
|
fun onDevStateEvent(event: DevStatusEvent) {
|
|
|
if (!initModeData) {
|
|
@@ -561,7 +576,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
Log.d(
|
|
|
"dddddddd", "targetTime==${event.devInfo.targetTime}" +
|
|
|
"==remainTime==${event.devInfo.remainTime}==targetTimeBuffer==${event.devInfo.targetTimeBuffer}" +
|
|
|
- "==minTime==${event.devInfo.mode.minTime}==maxTime==${event.devInfo.mode.maxTime}"
|
|
|
+ "==minTime==${event.devInfo.mode.minTime}==maxTime==${event.devInfo.mode.maxTime}===potCloverEleStatus==${currDevInfo.potCloverEleStatus}"
|
|
|
)
|
|
|
ThreadUtils.runOnMainThread {
|
|
|
currDevInfo = event.devInfo
|
|
@@ -569,6 +584,44 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
mRunningInstId = currDevInfo.runningInstId
|
|
|
mSettingInstId = currDevInfo.settingInstId
|
|
|
updateStatusBtn(currDevInfo.status.toByte())
|
|
|
+ if (getSN().startsWith("000")) {
|
|
|
+ if (!CofarSDK.devInfo().isWeightStatus && currDevInfo.mode.mode != "TURBO") {
|
|
|
+ //电磁阀在非称重/切碎下显示开锁和上锁
|
|
|
+ if (currDevInfo.potCloverEleStatus.toInt() == 0 && potCloverEleStatus != 0) {
|
|
|
+ potCloverEleStatus = 0
|
|
|
+ potCloverInterval?.cancel()
|
|
|
+ if (currentBgId == com.develop.common.R.drawable.pot_clover_ele_unlock) {
|
|
|
+ binding.tvCount.setGone()
|
|
|
+ } else {
|
|
|
+ binding.tvCount.setVisible()
|
|
|
+ potCloverInterval = Interval(0, 1, TimeUnit.SECONDS, 5).life(this)
|
|
|
+ .subscribe {
|
|
|
+ binding.tvCount.updateText(it.toString())
|
|
|
+ }.finish {
|
|
|
+ binding.tvCount.setGone()
|
|
|
+ currentBgId =
|
|
|
+ com.develop.common.R.drawable.pot_clover_ele_unlock
|
|
|
+ binding.ivPotCover.setBackgroundResource(com.develop.common.R.drawable.pot_clover_ele_unlock)
|
|
|
+ }
|
|
|
+ .start()
|
|
|
+ }
|
|
|
+ } else if (currDevInfo.potCloverEleStatus.toInt() == 1 && potCloverEleStatus != 1) {
|
|
|
+ potCloverEleStatus = 1
|
|
|
+ potCloverInterval?.cancel()
|
|
|
+ if (currentBgId == com.develop.common.R.drawable.pot_clover_ele_lock) {
|
|
|
+ binding.tvCount.setGone()
|
|
|
+ } else {
|
|
|
+ binding.tvCount.setGone()
|
|
|
+ currentBgId = com.develop.common.R.drawable.pot_clover_ele_lock
|
|
|
+ binding.ivPotCover.setBackgroundResource(com.develop.common.R.drawable.pot_clover_ele_lock)
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if (currDevInfo.potCloverEleStatus.toInt() == 2 && potCloverEleStatus != 2) {
|
|
|
+ potCloverEleStatus = 2
|
|
|
+ binding.tvCount.setGone()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
currDevInfo.mode.apply {
|
|
|
updateTempUI(
|
|
|
minTemp.toFloat(),
|
|
@@ -1029,9 +1082,10 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
binding.clSetTime.stopAlphaAnim()
|
|
|
binding.functionLayout.visibility = View.VISIBLE
|
|
|
binding.llWeightView.visibility = View.GONE
|
|
|
+ binding.ivPotCover.setVisible()
|
|
|
if (viewModel.modeType == ModesType.WIGHT.name || viewModel.modeType == ModesType.TURBO.name) {
|
|
|
- binding.ivWeight.visibility = View.GONE
|
|
|
- binding.ivTurbo.visibility = View.GONE
|
|
|
+ binding.ivWeight.visibility = View.INVISIBLE
|
|
|
+ binding.ivTurbo.visibility = View.INVISIBLE
|
|
|
if (viewModel.modeType == ModesType.TURBO.name) {
|
|
|
Log.d("dddddd", "llTurboView===VISIBLE")
|
|
|
binding.llTurboView.visibility = View.VISIBLE
|
|
@@ -1050,8 +1104,8 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
whereIndex = -1
|
|
|
binding.clSetTime.stopAlphaAnim()
|
|
|
isWidget = false
|
|
|
- binding.ivWeight.visibility = View.GONE
|
|
|
- binding.ivTurbo.visibility = View.GONE
|
|
|
+ binding.ivWeight.visibility = View.INVISIBLE
|
|
|
+ binding.ivTurbo.visibility = View.INVISIBLE
|
|
|
binding.functionLayout.visibility = View.GONE
|
|
|
binding.llWeightView.visibility = View.VISIBLE
|
|
|
Log.d("dddddd", "llTurboView===GONE")
|
|
@@ -1065,8 +1119,8 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
whereIndex = -1
|
|
|
binding.clSetTime.stopAlphaAnim()
|
|
|
isWidget = false
|
|
|
- binding.ivWeight.visibility = View.GONE
|
|
|
- binding.ivTurbo.visibility = View.GONE
|
|
|
+ binding.ivWeight.visibility = View.INVISIBLE
|
|
|
+ binding.ivTurbo.visibility = View.INVISIBLE
|
|
|
binding.functionLayout.visibility = View.GONE
|
|
|
Log.d("dddddd", "llTurboView===VISIBLE")
|
|
|
binding.llTurboView.visibility = View.VISIBLE
|
|
@@ -1728,9 +1782,11 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
modeType = viewModel.modeType
|
|
|
initModeData(viewModel.modeType)
|
|
|
viewModel.changeStep(CookSettingType.WEIGHT)
|
|
|
- binding.ivTurbo.visibility = View.GONE
|
|
|
+ binding.ivTurbo.visibility = View.INVISIBLE
|
|
|
+ binding.ivPotCover.setGone()
|
|
|
+ binding.tvCount.setGone()
|
|
|
isWidget = false
|
|
|
- binding.ivWeight.visibility = View.GONE
|
|
|
+ binding.ivWeight.visibility = View.INVISIBLE
|
|
|
binding.tvModeName.text = viewModel.getModeTitle(resources)
|
|
|
|
|
|
}
|
|
@@ -1739,6 +1795,8 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
* 点击turbo操作
|
|
|
*/
|
|
|
private fun turboClick() {
|
|
|
+ binding.ivPotCover.setGone()
|
|
|
+ binding.tvCount.setGone()
|
|
|
CofarSDK.stop(false)
|
|
|
whereIndex = -1
|
|
|
binding.clSetTime.stopAlphaAnim()
|
|
@@ -1748,9 +1806,9 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
|
|
|
initModeData(viewModel.modeType)
|
|
|
viewModel.changeStep(CookSettingType.TURBO)
|
|
|
binding.tvModeName.text = viewModel.getModeTitle(resources)
|
|
|
- binding.ivTurbo.visibility = View.GONE
|
|
|
+ binding.ivTurbo.visibility = View.INVISIBLE
|
|
|
isWidget = false
|
|
|
- binding.ivWeight.visibility = View.GONE
|
|
|
+ binding.ivWeight.visibility = View.INVISIBLE
|
|
|
Log.d("dddddd", "llTurboView===VISIBLE")
|
|
|
binding.llTurboView.visibility = View.VISIBLE
|
|
|
}
|