|
@@ -30,6 +30,7 @@ import com.develop.common.dialog.DownloadFailedDialog
|
|
|
import com.develop.common.dialog.ShareQRCodeDialog
|
|
|
import com.develop.common.event.RefreshDataEvent
|
|
|
import com.develop.common.event.RefreshLikeDataEvent
|
|
|
+import com.develop.common.food_sdk.FloatWindowManager
|
|
|
import com.develop.common.tag.CURRENT_LANGUAGE
|
|
|
import com.develop.common.tag.LOGIN_TAG
|
|
|
import com.develop.common.tag.MODE_TYPE
|
|
@@ -40,6 +41,7 @@ import java.util.*
|
|
|
import com.develop.step.R
|
|
|
import com.develop.step.ui.recipes_detail.model.CookDetailInfo
|
|
|
import com.kuyuntech.cofarcooking.device.sdk.constant.core.DevModes
|
|
|
+import com.kuyuntech.cofarcooking.device.sdk.constant.core.DevStatus
|
|
|
import com.kuyuntech.cofarcooking.device.sdk.constant.core.WorkModes
|
|
|
import com.kuyuntech.cofarcooking.device.sdk.eventbus.event.DevStatusEvent
|
|
|
import com.kuyuntech.cofarcooking.device.sdk.util.core.CofarSDK
|
|
@@ -166,16 +168,16 @@ class CookDetailActivity : CommonBVMActivity<ActivityCookDetailBinding, CookDeta
|
|
|
binding.tvMoreScore.visibility = View.GONE
|
|
|
binding.viewMore.visibility = View.INVISIBLE
|
|
|
}
|
|
|
- if (sn.startsWith("011")){
|
|
|
+ if (sn.startsWith("011")) {
|
|
|
binding.startLayout.visibility = View.INVISIBLE
|
|
|
binding.viewMore.visibility = View.INVISIBLE
|
|
|
binding.viewHide.visibility = View.INVISIBLE
|
|
|
binding.tvEasy.visibility = View.VISIBLE
|
|
|
}
|
|
|
- if (sn.startsWith("017A") || sn.startsWith("062A")||sn.startsWith("029")) {
|
|
|
- if (sn.startsWith("029")){
|
|
|
+ if (sn.startsWith("017A") || sn.startsWith("062A") || sn.startsWith("029")) {
|
|
|
+ if (sn.startsWith("029")) {
|
|
|
binding.viewIcon3.visibility = View.VISIBLE
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
binding.viewIcon3.visibility = View.INVISIBLE
|
|
|
}
|
|
|
binding.tvJarCount.visibility = View.VISIBLE
|
|
@@ -234,9 +236,9 @@ class CookDetailActivity : CommonBVMActivity<ActivityCookDetailBinding, CookDeta
|
|
|
if (cookSource == "local") {
|
|
|
binding.tvDownload.setText(com.develop.common.R.string.start_cooking)
|
|
|
if (isNightTheme()) {
|
|
|
- if (getSN().startsWith("011")){
|
|
|
+ if (getSN().startsWith("011")) {
|
|
|
binding.viewProgress.setButtonColor(Color.parseColor("#D51317"))
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
binding.viewProgress.setButtonColor(Color.parseColor("#E03E52"))
|
|
|
}
|
|
|
} else if (is062) {
|
|
@@ -274,10 +276,10 @@ class CookDetailActivity : CommonBVMActivity<ActivityCookDetailBinding, CookDeta
|
|
|
allTabViews.add(binding.ivTab2)
|
|
|
allTabViews.add(binding.ivTab3)
|
|
|
binding.ivTab4.setGone()
|
|
|
- if (!sn.startsWith("033")){
|
|
|
+ if (!sn.startsWith("033")) {
|
|
|
binding.ivTab5.setGone()
|
|
|
- }else{
|
|
|
- allTabViews.add(binding.ivTab5)
|
|
|
+ } else {
|
|
|
+ allTabViews.add(binding.ivTab5)
|
|
|
}
|
|
|
selectTab(TAB_SOURCE)
|
|
|
if (is062) {
|
|
@@ -285,7 +287,7 @@ class CookDetailActivity : CommonBVMActivity<ActivityCookDetailBinding, CookDeta
|
|
|
} else {
|
|
|
binding.tvMoreDelete.setGone()
|
|
|
}
|
|
|
- if (sn.startsWith("010F")||sn.startsWith("011")||sn.startsWith("033")) {
|
|
|
+ if (sn.startsWith("010F") || sn.startsWith("011") || sn.startsWith("033")) {
|
|
|
binding.tvMoreShare.setGone()
|
|
|
}
|
|
|
}
|
|
@@ -310,22 +312,49 @@ class CookDetailActivity : CommonBVMActivity<ActivityCookDetailBinding, CookDeta
|
|
|
binding.clStartCooking.setOnClickListener {
|
|
|
if (cookSource == "remote") {
|
|
|
if (viewModel.isDownloadSuccess()) {
|
|
|
+ var step = 0
|
|
|
+ if (FloatWindowManager.isStepShow()){
|
|
|
+ var runingId = CofarSDK.devInfo().runningInstId
|
|
|
+ if (runingId.contains(":")) {
|
|
|
+ var (numbers, steps) = runingId.split(":")
|
|
|
+ if (recipeNumber == numbers) {
|
|
|
+ step = steps.toInt()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
navigateTo(Screens.Cook.COOK_STEP2) {
|
|
|
withString("number", recipeNumber)
|
|
|
withBoolean("isLike", isLike)
|
|
|
withString("cook_step_detail", cookDetailJson)
|
|
|
withString("portionSizelJson", portionSizelJson)
|
|
|
+ withInt("stepIndex", step)
|
|
|
}
|
|
|
} else if (!viewModel.isDownloading()) {
|
|
|
binding.tvDownload.setText(com.develop.common.R.string.downloading)
|
|
|
viewModel.downloadRecipe()
|
|
|
}
|
|
|
} else {
|
|
|
+ //处理后台点击
|
|
|
+ var step = 0
|
|
|
+ if (FloatWindowManager.isStepShow()){
|
|
|
+ var runingId = CofarSDK.devInfo().runningInstId
|
|
|
+ if (runingId.contains(":")) {
|
|
|
+ var (numbers, steps) = runingId.split(":")
|
|
|
+ if (recipeNumber == numbers) {
|
|
|
+ step = steps.toInt()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
navigateTo(Screens.Cook.COOK_STEP2) {
|
|
|
withString("number", recipeNumber)
|
|
|
withBoolean("isLike", isLike)
|
|
|
withString("cook_step_detail", cookDetailJson)
|
|
|
withString("portionSizelJson", portionSizelJson)
|
|
|
+ withInt("stepIndex", step)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -448,7 +477,7 @@ class CookDetailActivity : CommonBVMActivity<ActivityCookDetailBinding, CookDeta
|
|
|
* */
|
|
|
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)
|
|
@@ -516,42 +545,74 @@ class CookDetailActivity : CommonBVMActivity<ActivityCookDetailBinding, CookDeta
|
|
|
binding.tvFoodName.movementMethod = ScrollingMovementMethod.getInstance()
|
|
|
binding.tvFoodName.isScrollbarFadingEnabled = false
|
|
|
val timeDescBuilder = StringBuilder()
|
|
|
- timeDescBuilder.append(if (sn.startsWith("011")) " "+getString(com.develop.common.R.string.preparation_011)else getString(com.develop.common.R.string.preparation))
|
|
|
+ timeDescBuilder.append(
|
|
|
+ if (sn.startsWith("011")) " " + getString(com.develop.common.R.string.preparation_011) else getString(
|
|
|
+ com.develop.common.R.string.preparation
|
|
|
+ )
|
|
|
+ )
|
|
|
timeDescBuilder.append(" ")
|
|
|
if (detail.recipe.prepareHours.isPositive()) {
|
|
|
timeDescBuilder.append(detail.recipe.prepareHours)
|
|
|
- timeDescBuilder.append(if (sn.startsWith("011"))" "+getString(com.develop.common.R.string.hours_011) else getString(com.develop.common.R.string.hours))
|
|
|
+ timeDescBuilder.append(
|
|
|
+ if (sn.startsWith("011")) " " + getString(com.develop.common.R.string.hours_011) else getString(
|
|
|
+ com.develop.common.R.string.hours
|
|
|
+ )
|
|
|
+ )
|
|
|
timeDescBuilder.append(" ")
|
|
|
}
|
|
|
if (detail.recipe.prepareMinutes.isPositive()) {
|
|
|
timeDescBuilder.append(detail.recipe.prepareMinutes)
|
|
|
- timeDescBuilder.append(if (sn.startsWith("011")) " "+getString(com.develop.common.R.string.min_011) else getString(com.develop.common.R.string.min))
|
|
|
+ timeDescBuilder.append(
|
|
|
+ if (sn.startsWith("011")) " " + getString(com.develop.common.R.string.min_011) else getString(
|
|
|
+ com.develop.common.R.string.min
|
|
|
+ )
|
|
|
+ )
|
|
|
|
|
|
}
|
|
|
timeDescBuilder.append("\n")
|
|
|
- timeDescBuilder.append(if (sn.startsWith("011")) getString(com.develop.common.R.string.ready_in_011) else getString(com.develop.common.R.string.ready_in))
|
|
|
+ timeDescBuilder.append(
|
|
|
+ if (sn.startsWith("011")) getString(com.develop.common.R.string.ready_in_011) else getString(
|
|
|
+ com.develop.common.R.string.ready_in
|
|
|
+ )
|
|
|
+ )
|
|
|
timeDescBuilder.append(" ")
|
|
|
if (detail.recipe.makeHours.isPositive()) {
|
|
|
timeDescBuilder.append(detail.recipe.makeHours)
|
|
|
- timeDescBuilder.append(if (sn.startsWith("011"))" "+getString(com.develop.common.R.string.hours_011) else getString(com.develop.common.R.string.hours))
|
|
|
+ timeDescBuilder.append(
|
|
|
+ if (sn.startsWith("011")) " " + getString(com.develop.common.R.string.hours_011) else getString(
|
|
|
+ com.develop.common.R.string.hours
|
|
|
+ )
|
|
|
+ )
|
|
|
timeDescBuilder.append(" ")
|
|
|
}
|
|
|
if (detail.recipe.makeMinutes.isPositive()) {
|
|
|
timeDescBuilder.append(detail.recipe.makeMinutes)
|
|
|
- timeDescBuilder.append(if (sn.startsWith("011")) " "+getString(com.develop.common.R.string.min_011) else getString(com.develop.common.R.string.min))
|
|
|
+ timeDescBuilder.append(
|
|
|
+ if (sn.startsWith("011")) " " + getString(com.develop.common.R.string.min_011) else getString(
|
|
|
+ com.develop.common.R.string.min
|
|
|
+ )
|
|
|
+ )
|
|
|
}
|
|
|
- if (sn.startsWith("033")){
|
|
|
+ if (sn.startsWith("033")) {
|
|
|
timeDescBuilder.append("\n")
|
|
|
timeDescBuilder.append(getString(com.develop.common.R.string.rest_time))
|
|
|
timeDescBuilder.append(" ")
|
|
|
if (detail.recipe.restHours.isPositive()) {
|
|
|
timeDescBuilder.append(detail.recipe.restHours)
|
|
|
- timeDescBuilder.append(if (sn.startsWith("011"))" "+getString(com.develop.common.R.string.hours_011) else getString(com.develop.common.R.string.hours))
|
|
|
+ timeDescBuilder.append(
|
|
|
+ if (sn.startsWith("011")) " " + getString(com.develop.common.R.string.hours_011) else getString(
|
|
|
+ com.develop.common.R.string.hours
|
|
|
+ )
|
|
|
+ )
|
|
|
timeDescBuilder.append(" ")
|
|
|
}
|
|
|
if (detail.recipe.restMinutes.isPositive()) {
|
|
|
timeDescBuilder.append(detail.recipe.restMinutes)
|
|
|
- timeDescBuilder.append(if (sn.startsWith("011")) " "+getString(com.develop.common.R.string.min_011) else getString(com.develop.common.R.string.min))
|
|
|
+ timeDescBuilder.append(
|
|
|
+ if (sn.startsWith("011")) " " + getString(com.develop.common.R.string.min_011) else getString(
|
|
|
+ com.develop.common.R.string.min
|
|
|
+ )
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
|
|
@@ -560,15 +621,21 @@ class CookDetailActivity : CommonBVMActivity<ActivityCookDetailBinding, CookDeta
|
|
|
|
|
|
|
|
|
binding.tvFoodTime.text = timeDescBuilder.toString()
|
|
|
- if (binding.tvEasy.visibility == View.VISIBLE){
|
|
|
+ if (binding.tvEasy.visibility == View.VISIBLE) {
|
|
|
detail.recipe.difficultyLevel?.let {
|
|
|
- var difficultyLevel = if (it.isEmpty()){
|
|
|
+ var difficultyLevel = if (it.isEmpty()) {
|
|
|
"easy"
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
it
|
|
|
}
|
|
|
|
|
|
- binding.tvEasy.text = resources.getString(resources.getIdentifier(difficultyLevel, "string", this.packageName))
|
|
|
+ binding.tvEasy.text = resources.getString(
|
|
|
+ resources.getIdentifier(
|
|
|
+ difficultyLevel,
|
|
|
+ "string",
|
|
|
+ this.packageName
|
|
|
+ )
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -633,9 +700,9 @@ class CookDetailActivity : CommonBVMActivity<ActivityCookDetailBinding, CookDeta
|
|
|
binding.tvDownload.setText(com.develop.common.R.string.start_cooking)
|
|
|
binding.viewProgress.setProgress(1f)
|
|
|
if (isNightTheme()) {
|
|
|
- if (getSN().startsWith("011")){
|
|
|
+ if (getSN().startsWith("011")) {
|
|
|
binding.viewProgress.setButtonColor(Color.parseColor("#D51317"))
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
binding.viewProgress.setButtonColor(Color.parseColor("#E03E52"))
|
|
|
}
|
|
|
} else {
|