|
@@ -6,6 +6,7 @@ import android.util.Log
|
|
|
import android.view.KeyEvent
|
|
|
import android.view.View
|
|
|
import android.widget.Toast
|
|
|
+import androidx.core.graphics.drawable.DrawableCompat
|
|
|
import androidx.core.view.isInvisible
|
|
|
import com.alibaba.android.arouter.facade.annotation.Autowired
|
|
|
import com.develop.base.ext.load
|
|
@@ -99,17 +100,16 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
super.onCreate(savedInstanceState)
|
|
|
|
|
|
- //隐藏称重与电动
|
|
|
- if (!isNightTheme()) {
|
|
|
- binding.viewChangeCrush.setGone()
|
|
|
- binding.viewChangeWeight.setGone()
|
|
|
- }
|
|
|
-
|
|
|
if (!isNightTheme()) {
|
|
|
binding.viewChangeCrush.setBgColor(R.color.view_change)
|
|
|
binding.viewChangeWeight.setBgColor(R.color.view_change)
|
|
|
binding.viewRemark.setBgColor(R.color.view_change)
|
|
|
binding.viewNote.setVisible()
|
|
|
+ binding.viewChangeWeight.src = R.drawable.ic_detail_tab_1_normal
|
|
|
+ binding.viewChangeCrush.src = R.drawable.ic_cooking_weight_normal
|
|
|
+ binding.viewWeightClose.drawable?.apply {
|
|
|
+ DrawableCompat.setTint(this, resources.getColor(R.color.white))
|
|
|
+ }
|
|
|
} else {
|
|
|
binding.viewChangeCrush.setBgColor(R.color.white)
|
|
|
binding.viewChangeWeight.setBgColor(R.color.white)
|
|
@@ -162,38 +162,10 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
}
|
|
|
|
|
|
binding.viewChangeWeight.setOnClickListener {
|
|
|
- if (isNightTheme()) {
|
|
|
- //此主题下,点击显示食材
|
|
|
- navigateTo(Screens.Cook.COOK_SOURCE) {
|
|
|
- withString("cook_step_detail", cookStepDetail)
|
|
|
- withString("portionSizelJson", portionSizelJson)
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (currModes != "WIGHT" && currModes != "WEIGH" && currModes != "WEIGHT") {
|
|
|
- binding.viewWeightClose1.setVisible()
|
|
|
- binding.viewChangeWeight.visibility = View.INVISIBLE
|
|
|
- }
|
|
|
- if (CofarSDK.devInfo().status == DevStatus.RUNNING.toInt()) {
|
|
|
- Toast.makeText(this, "Step is running!", Toast.LENGTH_SHORT).show()
|
|
|
- return@setOnClickListener
|
|
|
- }
|
|
|
- val weightSelected = binding.viewChangeWeight.isSelected
|
|
|
- if (weightSelected) {
|
|
|
- CofarSDK.stoptWeight()
|
|
|
- viewModel.setDisplayStep(viewModel.stepIndex, force = true)
|
|
|
- } else {
|
|
|
- if (!isNightTheme()) {
|
|
|
- binding.ivPrevStep.setGone()
|
|
|
- binding.ivNextStep.setGone()
|
|
|
- }
|
|
|
- CofarSDK.changeMode(
|
|
|
- "$recipeNumber:${viewModel.stepIndex}",
|
|
|
- CofarSDK.devMode("WEIGHT")
|
|
|
- )
|
|
|
- changeWeightPanel()
|
|
|
- CofarSDK.stoptWeight()
|
|
|
- CofarSDK.startWeight()
|
|
|
- }
|
|
|
+ //此主题下,点击显示食材
|
|
|
+ navigateTo(Screens.Cook.COOK_SOURCE) {
|
|
|
+ withString("cook_step_detail", cookStepDetail)
|
|
|
+ withString("portionSizelJson", portionSizelJson)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -245,56 +217,27 @@ class CookStepActivity : CookStepBaseActivity() {
|
|
|
|
|
|
|
|
|
binding.viewChangeCrush.setOnClickListener {
|
|
|
- if (isNightTheme()) {
|
|
|
- if (currModes != "WIGHT" && currModes != "WEIGH" && currModes != "WEIGHT") {
|
|
|
- binding.viewWeightClose.setVisible()
|
|
|
- binding.viewChangeCrush.visibility = View.INVISIBLE
|
|
|
- }
|
|
|
- //此主题下,点餐是称重
|
|
|
- if (CofarSDK.devInfo().status == DevStatus.RUNNING.toInt()) {
|
|
|
- Toast.makeText(this, "Step is running!", Toast.LENGTH_SHORT).show()
|
|
|
- return@setOnClickListener
|
|
|
- }
|
|
|
- val weightSelected = binding.viewChangeWeight.isSelected
|
|
|
- if (weightSelected) {
|
|
|
- CofarSDK.stoptWeight()
|
|
|
- viewModel.setDisplayStep(viewModel.stepIndex, force = true)
|
|
|
- } else {
|
|
|
- if (!isNightTheme()) {
|
|
|
- binding.ivPrevStep.setGone()
|
|
|
- binding.ivNextStep.setGone()
|
|
|
- }
|
|
|
+ if (currModes != "WIGHT" && currModes != "WEIGH" && currModes != "WEIGHT") {
|
|
|
+ binding.viewWeightClose.setVisible()
|
|
|
+ binding.viewChangeCrush.visibility = View.INVISIBLE
|
|
|
+ }
|
|
|
+ //此主题下,点餐是称重
|
|
|
+ if (CofarSDK.devInfo().status == DevStatus.RUNNING.toInt()) {
|
|
|
+ Toast.makeText(this, "Step is running!", Toast.LENGTH_SHORT).show()
|
|
|
+ return@setOnClickListener
|
|
|
+ }
|
|
|
+ val weightSelected = binding.viewChangeWeight.isSelected
|
|
|
+ if (weightSelected) {
|
|
|
+ CofarSDK.stoptWeight()
|
|
|
+ viewModel.setDisplayStep(viewModel.stepIndex, force = true)
|
|
|
+ } else {
|
|
|
// CofarSDK.changeMode(
|
|
|
// "$recipeNumber:${viewModel.stepIndex}",
|
|
|
// CofarSDK.devMode("WEIGHT")
|
|
|
// )
|
|
|
- changeWeightPanel()
|
|
|
- CofarSDK.stoptWeight()
|
|
|
- CofarSDK.startWeight()
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (CofarSDK.devInfo().status == DevStatus.RUNNING.toInt()) {
|
|
|
- Toast.makeText(this, "Step is running!", Toast.LENGTH_SHORT).show()
|
|
|
- return@setOnClickListener
|
|
|
- }
|
|
|
- val turboSelected = binding.viewChangeCrush.isSelected
|
|
|
- if (turboSelected) {
|
|
|
- CofarSDK.stoptWeight()
|
|
|
- viewModel.setDisplayStep(viewModel.stepIndex, force = true)
|
|
|
- } else {
|
|
|
- if (!isNightTheme()) {
|
|
|
- binding.ivPrevStep.setGone()
|
|
|
- binding.ivNextStep.setGone()
|
|
|
- }
|
|
|
- CofarSDK.changeMode(
|
|
|
- "$recipeNumber:${viewModel.stepIndex}",
|
|
|
- CofarSDK.devMode("TURBO")
|
|
|
- )
|
|
|
- CofarSDK.stoptWeight()
|
|
|
- changeTurboPanel()
|
|
|
- }
|
|
|
- binding.viewChangeWeight.isSelected = false
|
|
|
- binding.viewChangeCrush.isSelected = !turboSelected
|
|
|
+ changeWeightPanel()
|
|
|
+ CofarSDK.stoptWeight()
|
|
|
+ CofarSDK.startWeight()
|
|
|
}
|
|
|
|
|
|
}
|