|
@@ -133,111 +133,208 @@ class ModeEntranceActivity : CommonBindingActivity<ActivityModeEntranceBinding>(
|
|
|
}
|
|
|
|
|
|
if (isNightTheme()) {
|
|
|
- binding.entranceRecycle.apply {
|
|
|
- linear(RecyclerView.HORIZONTAL)
|
|
|
- setup {
|
|
|
- addType<EntranceData>(com.develop.common.R.layout.item_entrance_night_view)
|
|
|
- onBind {
|
|
|
- val model = getModel<EntranceData>()
|
|
|
- findView<ImageView>(com.develop.common.R.id.iv_bg).src = model.bgResId
|
|
|
- findView<AppCompatTextView>(com.develop.common.R.id.tv_title).setText(model.titleStrId)
|
|
|
- }
|
|
|
- R.id.content_view.onClick {
|
|
|
- val clickModel = getModel<EntranceData>()
|
|
|
- title = getString(clickModel.title2StrId)
|
|
|
- when (clickModel.type) {
|
|
|
- EntranceType.automatic_recipes -> {
|
|
|
- if (FoodDataProvider.checkDataExit()) {
|
|
|
- val bundle = Bundle()
|
|
|
- bundle.putInt(MODE_ENTRANCE, Recipes)
|
|
|
- bundle.putInt(RECIPES_TYPE, LocalFood)
|
|
|
- bundle.putString(HOME_TITLE, title)
|
|
|
- navigateTo(Screens.Main.HOME) {
|
|
|
- with(bundle)
|
|
|
- }
|
|
|
- } else {
|
|
|
- showLoading()
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- EntranceType.automatic_programmes -> {
|
|
|
- if (FoodDataProvider.checkDataExit()) {
|
|
|
- val bundle = Bundle()
|
|
|
- bundle.putInt(MODE_ENTRANCE, Mode)
|
|
|
- bundle.putString(HOME_TITLE, title)
|
|
|
- navigateTo(Screens.Main.HOME) {
|
|
|
- with(bundle)
|
|
|
- }
|
|
|
- } else {
|
|
|
- showLoading()
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- EntranceType.manual_cooking -> {
|
|
|
- if (FoodDataProvider.checkDataExit()) {
|
|
|
-
|
|
|
-
|
|
|
- var modeName =
|
|
|
- if (sn.startsWith("011")) resources.getString(com.develop.common.R.string.manual_cooking_011)
|
|
|
- .replace(
|
|
|
- "\n",
|
|
|
- " "
|
|
|
- ) else resources.getString(com.develop.common.R.string.adapted_cooking)
|
|
|
- navigateTo(Screens.Cook.COOK_MODES) {
|
|
|
-
|
|
|
- if (DevModes.SOUP == CofarSDK.devInfo().devMode) {
|
|
|
- val bundle = Bundle()
|
|
|
- bundle.putString(MODE_TYPE, WorkModes.ADAPTED_COOKING)
|
|
|
- bundle.putString(
|
|
|
- "mode_name",
|
|
|
- modeName
|
|
|
- )
|
|
|
- with(bundle)
|
|
|
- } else {
|
|
|
- val bundle = Bundle()
|
|
|
- bundle.putString(MODE_TYPE, WorkModes.AF_DIY)
|
|
|
- with(bundle)
|
|
|
- }
|
|
|
+ if (sn.startsWith("053")) {
|
|
|
+ binding.entranceRecycle.apply {
|
|
|
+ grid(2)
|
|
|
+ setup {
|
|
|
+ addType<EntranceData>(R.layout.item_entrance)
|
|
|
+ onBind {
|
|
|
+ val itemView = findView<EntranceItemView>(R.id.entrance_item)
|
|
|
+ val params = itemView.layoutParams as LayoutParams
|
|
|
+ params.height = (ScreenUtil.getScreenSize(this@ModeEntranceActivity)[1] / 2)
|
|
|
+ itemView.layoutParams = params
|
|
|
+ itemView.setEntranceData(getModel())
|
|
|
+ }
|
|
|
+ R.id.entrance_item.onClick {
|
|
|
+ val clickModel = getModel<EntranceData>()
|
|
|
+ title = getString(clickModel.title2StrId)
|
|
|
+ when (clickModel.type) {
|
|
|
+ EntranceType.automatic_recipes -> {
|
|
|
+ if (FoodDataProvider.checkDataExit()) {
|
|
|
+ val bundle = Bundle()
|
|
|
+ bundle.putInt(MODE_ENTRANCE, Recipes)
|
|
|
+ bundle.putInt(RECIPES_TYPE, LocalFood)
|
|
|
+ bundle.putString(HOME_TITLE, title)
|
|
|
+ navigateTo(Screens.Main.HOME) {
|
|
|
+ with(bundle)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ showLoading()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ EntranceType.automatic_programmes -> {
|
|
|
+ if (FoodDataProvider.checkDataExit()) {
|
|
|
+ val bundle = Bundle()
|
|
|
+ bundle.putInt(MODE_ENTRANCE, Mode)
|
|
|
+ bundle.putString(HOME_TITLE, title)
|
|
|
+ navigateTo(Screens.Main.HOME) {
|
|
|
+ with(bundle)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ showLoading()
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ EntranceType.manual_cooking -> {
|
|
|
+ if (FoodDataProvider.checkDataExit()) {
|
|
|
+
|
|
|
+ navigateTo(Screens.Cook.COOK_MODES) {
|
|
|
+ if (CofarSDK.devInfo().devMode == DevModes.SOUP) {
|
|
|
+ val bundle = Bundle()
|
|
|
+ bundle.putString(MODE_TYPE, WorkModes.ADAPTED_COOKING)
|
|
|
+ bundle.putString(
|
|
|
+ "mode_name",
|
|
|
+ resources.getString(com.develop.common.R.string.adapted_cooking)
|
|
|
+ )
|
|
|
+ with(bundle)
|
|
|
+ } else if (CofarSDK.devInfo().devMode == DevModes.STAND_MIXER) {
|
|
|
+ val bundle = Bundle()
|
|
|
+ bundle.putString(MODE_TYPE, WorkModes.SM_DIY)
|
|
|
+ bundle.putString(
|
|
|
+ "mode_name",
|
|
|
+ resources.getString(com.develop.common.R.string.sm_diy)
|
|
|
+ )
|
|
|
+ with(bundle)
|
|
|
+ } else {
|
|
|
+ val bundle = Bundle()
|
|
|
+ bundle.putString(MODE_TYPE, WorkModes.AF_DIY)
|
|
|
+ with(bundle)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ showLoading()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ EntranceType.download_new_recipes -> {
|
|
|
+ if (FoodDataProvider.checkDataExit()) {
|
|
|
+ val bundle = Bundle()
|
|
|
+ bundle.putInt(MODE_ENTRANCE, Recipes)
|
|
|
+ bundle.putInt(RECIPES_TYPE, NetFood)
|
|
|
+ bundle.putString(HOME_TITLE, title)
|
|
|
+ navigateTo(Screens.Main.HOME) {
|
|
|
+ with(bundle)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ showLoading()
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.models = DataFactory.get053AEntranceData()
|
|
|
+ }else{
|
|
|
+ binding.entranceRecycle.apply {
|
|
|
+ linear(RecyclerView.HORIZONTAL)
|
|
|
+ setup {
|
|
|
+ addType<EntranceData>(com.develop.common.R.layout.item_entrance_night_view)
|
|
|
+ onBind {
|
|
|
+ val model = getModel<EntranceData>()
|
|
|
+ findView<ImageView>(com.develop.common.R.id.iv_bg).src = model.bgResId
|
|
|
+ findView<AppCompatTextView>(com.develop.common.R.id.tv_title).setText(model.titleStrId)
|
|
|
+ }
|
|
|
+ R.id.content_view.onClick {
|
|
|
+ val clickModel = getModel<EntranceData>()
|
|
|
+ title = getString(clickModel.title2StrId)
|
|
|
+ when (clickModel.type) {
|
|
|
+ EntranceType.automatic_recipes -> {
|
|
|
+ if (FoodDataProvider.checkDataExit()) {
|
|
|
+ val bundle = Bundle()
|
|
|
+ bundle.putInt(MODE_ENTRANCE, Recipes)
|
|
|
+ bundle.putInt(RECIPES_TYPE, LocalFood)
|
|
|
+ bundle.putString(HOME_TITLE, title)
|
|
|
+ navigateTo(Screens.Main.HOME) {
|
|
|
+ with(bundle)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ showLoading()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ EntranceType.automatic_programmes -> {
|
|
|
+ if (FoodDataProvider.checkDataExit()) {
|
|
|
+ val bundle = Bundle()
|
|
|
+ bundle.putInt(MODE_ENTRANCE, Mode)
|
|
|
+ bundle.putString(HOME_TITLE, title)
|
|
|
+ navigateTo(Screens.Main.HOME) {
|
|
|
+ with(bundle)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ showLoading()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ EntranceType.manual_cooking -> {
|
|
|
+ if (FoodDataProvider.checkDataExit()) {
|
|
|
+
|
|
|
+
|
|
|
+ var modeName =
|
|
|
+ if (sn.startsWith("011")) resources.getString(com.develop.common.R.string.manual_cooking_011)
|
|
|
+ .replace(
|
|
|
+ "\n",
|
|
|
+ " "
|
|
|
+ ) else resources.getString(com.develop.common.R.string.adapted_cooking)
|
|
|
+ navigateTo(Screens.Cook.COOK_MODES) {
|
|
|
+
|
|
|
+ if (DevModes.SOUP == CofarSDK.devInfo().devMode) {
|
|
|
+ val bundle = Bundle()
|
|
|
+ bundle.putString(MODE_TYPE, WorkModes.ADAPTED_COOKING)
|
|
|
+ bundle.putString(
|
|
|
+ "mode_name",
|
|
|
+ modeName
|
|
|
+ )
|
|
|
+ with(bundle)
|
|
|
+ } else {
|
|
|
+ val bundle = Bundle()
|
|
|
+ bundle.putString(MODE_TYPE, WorkModes.AF_DIY)
|
|
|
+ with(bundle)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ showLoading()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ EntranceType.download_new_recipes -> {
|
|
|
+ if (sn.startsWith("011")) {
|
|
|
+ if (NetworkUtils.isWifiConnected()) {
|
|
|
+ if (!AppVersionUtil.dialogRecipeUpdate.isShow) {
|
|
|
+ AppVersionUtil.checkAboutRecipeUpdate(true)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ GlobalToast.showToast(getString(com.develop.common.R.string.network_error))
|
|
|
+
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (FoodDataProvider.checkDataExit()) {
|
|
|
+ val bundle = Bundle()
|
|
|
+ bundle.putInt(MODE_ENTRANCE, Recipes)
|
|
|
+ bundle.putInt(RECIPES_TYPE, NetFood)
|
|
|
+ bundle.putString(HOME_TITLE, title)
|
|
|
+ navigateTo(Screens.Main.HOME) {
|
|
|
+ with(bundle)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ showLoading()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.models =
|
|
|
+ if (sn.startsWith("011")) DataFactory.get011NightEntranceData()
|
|
|
+ else if (sn.startsWith("054")) DataFactory.get054NightEntranceData()
|
|
|
+ else DataFactory.getNightEntranceData()
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- }
|
|
|
- } else {
|
|
|
- showLoading()
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- EntranceType.download_new_recipes -> {
|
|
|
- if (sn.startsWith("011")) {
|
|
|
- if (NetworkUtils.isWifiConnected()) {
|
|
|
- if (!AppVersionUtil.dialogRecipeUpdate.isShow) {
|
|
|
- AppVersionUtil.checkAboutRecipeUpdate(true)
|
|
|
- }
|
|
|
- } else {
|
|
|
- GlobalToast.showToast(getString(com.develop.common.R.string.network_error))
|
|
|
-
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (FoodDataProvider.checkDataExit()) {
|
|
|
- val bundle = Bundle()
|
|
|
- bundle.putInt(MODE_ENTRANCE, Recipes)
|
|
|
- bundle.putInt(RECIPES_TYPE, NetFood)
|
|
|
- bundle.putString(HOME_TITLE, title)
|
|
|
- navigateTo(Screens.Main.HOME) {
|
|
|
- with(bundle)
|
|
|
- }
|
|
|
- } else {
|
|
|
- showLoading()
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }.models =
|
|
|
- if (sn.startsWith("011")) DataFactory.get011NightEntranceData()
|
|
|
- else if (sn.startsWith("054")) DataFactory.get054NightEntranceData()
|
|
|
- else DataFactory.getNightEntranceData()
|
|
|
} else if (sn.startsWith("002D")) {
|
|
|
binding.entranceRecycle.apply {
|
|
|
grid(2)
|
|
@@ -408,7 +505,7 @@ class ModeEntranceActivity : CommonBindingActivity<ActivityModeEntranceBinding>(
|
|
|
}
|
|
|
}
|
|
|
}.models = DataFactory.get032DEntranceData()
|
|
|
- } else if (getSN().startsWith("029C")) {
|
|
|
+ } else if (sn.startsWith("029C")) {
|
|
|
binding.entranceRecycle.apply {
|
|
|
grid(2)
|
|
|
divider {
|
|
@@ -697,8 +794,8 @@ class ModeEntranceActivity : CommonBindingActivity<ActivityModeEntranceBinding>(
|
|
|
if (isBrand036I()) DataFactory.get036IEntranceData()
|
|
|
// else if (isBrand011A()) DataFactory.get011A5037EntranceData()
|
|
|
// else if (isBrand054A()) DataFactory.get054AEntranceData()
|
|
|
- else if (getSN().startsWith("045")) DataFactory.get045AEntranceData()
|
|
|
- else if (getSN().startsWith("032")) DataFactory.get032DEntranceData()
|
|
|
+ else if (sn.startsWith("045")) DataFactory.get045AEntranceData()
|
|
|
+ else if (sn.startsWith("032")) DataFactory.get032DEntranceData()
|
|
|
else DataFactory.getEntranceData()
|
|
|
}
|
|
|
|