refactor(ui): 对页面名称进行统一重命名

- 将 SelectDishActivity 重命名为 CookingModeActivity
- 将 PrepareCookActivity 重命名为 PrepareFoodActivity
- 将 SamplingListActivity 重命名为 SamplingModeActivity
- 更新 AndroidManifest.xml 中的活动声明
- 修改 DishListFragment 中的相关引用
- 注释掉 DishSamplingActivity 的完整实现代码
- 更新 DeviceConfigFragment 中的活动跳转逻辑
- 优化 CookingModeActivity 的视图绑定方式
- 更新相关导入包路径和类引用
This commit is contained in:
2026-04-28 18:13:50 +08:00
parent e8933fa578
commit 9a0b066490
18 changed files with 617 additions and 619 deletions
+8 -8
View File
@@ -58,23 +58,23 @@
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity
android:name=".ui.SelectDishActivity"
android:name=".ui.CookingModeActivity"
android:theme="@style/Theme.DishMatch.NoSplash"
android:launchMode="singleTask"
android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity
android:name=".ui.PrepareCookActivity"
android:name=".ui.PrepareFoodActivity"
android:theme="@style/Theme.DishMatch.NoSplash"
android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<!-- <activity-->
<!-- android:name=".ui.DishSamplingActivity"-->
<!-- android:theme="@style/Theme.DishMatch.NoSplash"-->
<!-- android:screenOrientation="portrait"-->
<!-- tools:ignore="DiscouragedApi,LockedOrientationActivity" />-->
<activity
android:name=".ui.DishSamplingActivity"
android:theme="@style/Theme.DishMatch.NoSplash"
android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity
android:name=".ui.SamplingListActivity"
android:name=".ui.SamplingModeActivity"
android:theme="@style/Theme.DishMatch.NoSplash"
android:launchMode="singleTask"
android:screenOrientation="portrait"
@@ -7,8 +7,7 @@ import androidx.lifecycle.lifecycleScope
import kotlinx.coroutines.launch
import com.shuwei.dish.match.R
import com.shuwei.dish.match.base.BaseActivity
import com.shuwei.dish.match.base.BaseApp
import com.shuwei.dish.match.databinding.ActivitySelectDishBinding
import com.shuwei.dish.match.databinding.ActivityCookingModeBinding
import com.shuwei.dish.match.dialog.CommonDialog
import com.shuwei.dish.match.ui.fragment.DishListFragment
import com.shuwei.dish.match.utils.KeyboardUtil
@@ -18,7 +17,10 @@ import com.shuwei.dish.match.utils.ext.startActivity
import com.shuwei.dish.match.utils.ext.toast
import com.shuwei.dish.match.utils.ext.visible
class SelectDishActivity : BaseActivity() {
/**
* 制作模式
*/
class CookingModeActivity : BaseActivity() {
companion object {
const val IS_COOKING = "isCooking"
@@ -26,7 +28,7 @@ class SelectDishActivity : BaseActivity() {
const val IS_CONFIG_PAGE = "isConfigPage"
}
private lateinit var binding: ActivitySelectDishBinding
private val binding by lazy { ActivityCookingModeBinding.inflate(layoutInflater) }
private var dinnerType: String = "1"
@@ -38,7 +40,6 @@ class SelectDishActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivitySelectDishBinding.inflate(layoutInflater)
setContentView(binding.root)
setHeaderBackground()
setTitleBar(titleBarAction = {
@@ -1,291 +1,291 @@
package com.shuwei.dish.match.ui
import android.annotation.SuppressLint
import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.activity.addCallback
import androidx.activity.viewModels
import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.LinearLayoutManager
import com.shuwei.dish.match.R
import com.shuwei.dish.match.adapter.DishPartAdapter
import com.shuwei.dish.match.base.BaseActivity
import com.shuwei.dish.match.base.BaseApp
import com.shuwei.dish.match.databinding.ActivityDishSamplingBinding
import com.shuwei.dish.match.dialog.FoodSearchDialog
import com.shuwei.dish.match.dialog.CommonDialog
import com.shuwei.dish.match.entity.CookFoodEntity
import com.shuwei.dish.match.entity.CookFoodGoodsEntity
import com.shuwei.dish.match.entity.FoodRecord
import com.shuwei.dish.match.net.NetViewModel
import com.shuwei.dish.match.utils.AddressUtil
import com.shuwei.dish.match.utils.KeyboardUtil
import com.shuwei.dish.match.utils.SwipeCallback
import com.shuwei.dish.match.utils.WeightUtil
import com.shuwei.dish.match.utils.ext.addOnActionSearchListener
import com.shuwei.dish.match.utils.ext.clickWithDebounce
import com.shuwei.dish.match.utils.ext.gone
import com.shuwei.dish.match.utils.ext.startActivity
import com.shuwei.dish.match.utils.ext.toJsonString
import com.shuwei.dish.match.utils.ext.toast
import com.shuwei.dish.match.utils.ext.visible
import java.io.Serializable
class DishSamplingActivity : BaseActivity() {
private lateinit var binding: ActivityDishSamplingBinding
var foodName: String? = null
private var foodId: String? = null
companion object {
private const val TAG = "DishSamplingActivity"
public const val FOOD_NAME = "foodName"
public const val PAGE_FROM = "pageFrom"
public const val HOME = "home"
}
private var pageFrom: String? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityDishSamplingBinding.inflate(layoutInflater)
setContentView(binding.root)
pageFrom = intent.getStringExtra(PAGE_FROM)
setTitleBar()
setHeaderBackground()
addViewClickListener()
foodName = intent.getStringExtra(FOOD_NAME)
binding.etInputDish.setText(foodName)
WeightUtil.addWeightListener(
weightKey = TAG,
getWeight = { address, state, weight ->
//Log.d(TAG, "addViewClickListener: address=$address,state=$state,weight=$weight")
if (address == AddressUtil.ONE) {
tempDishEntity?.useWeight = weight.toDouble()
binding.tvDishPartWeight.text = "${weight}"
}
})
addBackKeyListener()
}
private fun setTitleBar() {
setTitleBar(titleBarAction = {
it.visible()
}, titleAction = {
it.text = "菜品采集"
}, rightIconActon = {
it.gone()
it.setImageResource(R.drawable.ic_setting)
it.setOnClickListener {
//startActivity<DeviceSettingActivity>()
}
}, backAction = {
it.visible()
it.setOnClickListener {
onBackPressedDispatcher.onBackPressed()
}
})
}
fun getCookFoodList() {
appViewModel.getCookFoodList(cookMode = 1)
}
/**
* 监听返回键
*/
fun addBackKeyListener() {
onBackPressedDispatcher.addCallback(this) {
if (list.isEmpty().not()) {
//说明有新增的食材
saveDataRemindDialog()
return@addCallback
}
if (pageFrom == HOME) {
startActivity<SamplingListActivity>()
}
onBackPressedDispatcher.onBackPressed()
}
}
private fun saveDataRemindDialog() {
CommonDialog(this)
.setTitle("返回提示")
.setContent("您好,当前页面存在未保存的数据,\n确认返回吗?")
.setNegativeButton("取消")
.setPositiveButton("确认") {
if (pageFrom == HOME) {
startActivity<SamplingListActivity>()
}
finish()
}
.setOnDismissCallback { hideStatusBar() }
.show()
}
val list: MutableList<CookFoodGoodsEntity> = mutableListOf()
private var tempDishEntity: CookFoodGoodsEntity? = null
private var dishMaterialType = 1
private val dishAdapter by lazy {
DishPartAdapter(list).apply {
addOnItemChildClickListener(R.id.ivOperateIcon) { _, _, position ->
//删除操作
list.removeAt(position)
notifyItemRemoved(position)
notifyItemRangeChanged(position, list.size - position)
}
}
}
@SuppressLint("NotifyDataSetChanged")
private fun addViewClickListener() {
binding.rvDishPartList.run {
layoutManager =
LinearLayoutManager(this@DishSamplingActivity, LinearLayoutManager.VERTICAL, false)
adapter = dishAdapter
val itemTouchHelper = ItemTouchHelper(SwipeCallback(dishAdapter) { position ->
list.removeAt(position)
dishAdapter.notifyItemRemoved(position)
dishAdapter.notifyItemRangeChanged(position, list.size - position)
toast("已删除")
})
itemTouchHelper.attachToRecyclerView(this)
}
binding.etInputDishType.addOnActionSearchListener {
searchDishType()
}
binding.ivDishTypeSearch.setOnClickListener {
searchDishType()
}
binding.ivWeightClear.setOnClickListener {
WeightUtil.tareTwo(AddressUtil.ONE)
}
binding.ivWeightAdd.setOnClickListener {
if (tempDishEntity == null) {
toast("请输入食材名称")
return@setOnClickListener
}
if (binding.rgSampling.checkedRadioButtonId == -1) {
toast("请选择主辅材类型")
return@setOnClickListener
}
val realWeight = tempDishEntity!!.useWeight ?: 0.0
if (realWeight <= 0.toDouble()) {
toast("食材用量需要大于0")
return@setOnClickListener
}
if (tempDishEntity?.goodsName != binding.etInputDishType.text.toString().trim()) {
toast("所选择的食材名称与输入框内容不一致")
return@setOnClickListener
}
tempDishEntity!!.apply {
isSamplingPage = true
materialType = dishMaterialType
}
val result = list.firstOrNull { it.goodsId == tempDishEntity!!.goodsId }
if (result != null) {
toast("${result.goodsName}食材已添加,请勿重复操作")
return@setOnClickListener
}
list.add(tempDishEntity!!)
dishAdapter.notifyDataSetChanged()
tempDishEntity = null
binding.etInputDishType.setText("")
binding.rgSampling.clearCheck()
}
binding.rgSampling.setOnCheckedChangeListener { group, checkedId ->
dishMaterialType = if (checkedId == R.id.rbDishTypeFirst) 1 else 2
}
binding.ivDishSearch.setOnClickListener { v ->
jumpSearch(v)
}
binding.btnCook.clickWithDebounce {
val showFoodName = binding.etInputDish.text.toString().trim()
if (showFoodName.isBlank()) {
toast("菜品名称为空")
return@clickWithDebounce
}
if (list.isEmpty()) {
toast("菜品构成信息未设置")
return@clickWithDebounce
}
val food = FoodRecord()
binding.etInputDish.let {
if (it.tag != null && it.tag.toString() == it.text.toString()) {
food.foodId = foodId
}
}
food.foodName = showFoodName
food.cookMode = 1
Log.d(TAG, "goToSubmit: goodsList:${list.toJsonString()}")
// startActivity<SubmitDishActivity> {
startActivity<SubmitFoodActivity> {
putExtra(SubmitFoodActivity.GOODS_LIST, list as java.io.Serializable)
putExtra(SubmitFoodActivity.FOOD_ITEM, food as Serializable)
}
}
binding.etInputDish.let { v ->
v.addOnActionSearchListener {
jumpSearch(v)
}
}
}
private fun jumpSearch(v: View) {
val intent = Intent(this, FoodSearchActivity::class.java).apply {
putExtra(FoodSearchActivity.FOOD_NAME, binding.etInputDish.text.toString().trim())
}
startActivity(intent) {
foodId = it?.getStringExtra(FoodSearchActivity.FOOD_ID)
foodName = it?.getStringExtra(FoodSearchActivity.FOOD_NAME)
binding.etInputDish.run {
setText(foodName)
tag = foodName
setSelection(text.length)
}
}
KeyboardUtil.hideKeyboard(v)
}
private fun searchDishType() {
val inputText = binding.etInputDishType.text.toString().trim()
FoodSearchDialog(
activity = this@DishSamplingActivity,
defGoodsName = inputText
) { item ->
val filterResult = list.firstOrNull { it.goodsName == item.goodsName }
if (filterResult != null) {
toast("不允许重复添加同一食材")
return@FoodSearchDialog
}
binding.etInputDishType.run {
setText(item.goodsName)
setSelection(length())
}
tempDishEntity = CookFoodGoodsEntity().apply {
goodsId = item.goodsId
goodsName = item.goodsName
relateionType = item.relateionType ?: 0
goodsOrRelationCode = item.goodsOrRelationCode
isNewDishType = true
// TODO: 待定
//allEdible = item.allEdible
}
}.show()
}
}
//package com.shuwei.dish.match.ui
//
//import android.annotation.SuppressLint
//import android.content.Intent
//import android.os.Bundle
//import android.util.Log
//import android.view.View
//import androidx.activity.addCallback
//import androidx.activity.viewModels
//import androidx.recyclerview.widget.ItemTouchHelper
//import androidx.recyclerview.widget.LinearLayoutManager
//import com.shuwei.dish.match.R
//import com.shuwei.dish.match.adapter.DishPartAdapter
//import com.shuwei.dish.match.base.BaseActivity
//import com.shuwei.dish.match.base.BaseApp
//import com.shuwei.dish.match.databinding.ActivityDishSamplingBinding
//import com.shuwei.dish.match.dialog.FoodSearchDialog
//import com.shuwei.dish.match.dialog.CommonDialog
//import com.shuwei.dish.match.entity.CookFoodEntity
//import com.shuwei.dish.match.entity.CookFoodGoodsEntity
//import com.shuwei.dish.match.entity.FoodRecord
//import com.shuwei.dish.match.net.NetViewModel
//import com.shuwei.dish.match.utils.AddressUtil
//import com.shuwei.dish.match.utils.KeyboardUtil
//import com.shuwei.dish.match.utils.SwipeCallback
//import com.shuwei.dish.match.utils.WeightUtil
//import com.shuwei.dish.match.utils.ext.addOnActionSearchListener
//import com.shuwei.dish.match.utils.ext.clickWithDebounce
//import com.shuwei.dish.match.utils.ext.gone
//import com.shuwei.dish.match.utils.ext.startActivity
//import com.shuwei.dish.match.utils.ext.toJsonString
//import com.shuwei.dish.match.utils.ext.toast
//import com.shuwei.dish.match.utils.ext.visible
//import java.io.Serializable
//
//class DishSamplingActivity : BaseActivity() {
//
// private lateinit var binding: ActivityDishSamplingBinding
//
// var foodName: String? = null
//
// private var foodId: String? = null
//
// companion object {
// private const val TAG = "DishSamplingActivity"
// public const val FOOD_NAME = "foodName"
// public const val PAGE_FROM = "pageFrom"
// public const val HOME = "home"
// }
//
// private var pageFrom: String? = null
//
// override fun onCreate(savedInstanceState: Bundle?) {
// super.onCreate(savedInstanceState)
// binding = ActivityDishSamplingBinding.inflate(layoutInflater)
// setContentView(binding.root)
// pageFrom = intent.getStringExtra(PAGE_FROM)
// setTitleBar()
// setHeaderBackground()
// addViewClickListener()
// foodName = intent.getStringExtra(FOOD_NAME)
// binding.etInputDish.setText(foodName)
//
// WeightUtil.addWeightListener(
// weightKey = TAG,
// getWeight = { address, state, weight ->
// //Log.d(TAG, "addViewClickListener: address=$address,state=$state,weight=$weight")
// if (address == AddressUtil.ONE) {
// tempDishEntity?.useWeight = weight.toDouble()
// binding.tvDishPartWeight.text = "${weight}"
// }
// })
// addBackKeyListener()
// }
//
// private fun setTitleBar() {
// setTitleBar(titleBarAction = {
// it.visible()
// }, titleAction = {
// it.text = "菜品采集"
// }, rightIconActon = {
// it.gone()
// it.setImageResource(R.drawable.ic_setting)
// it.setOnClickListener {
// //startActivity<DeviceSettingActivity>()
// }
// }, backAction = {
// it.visible()
// it.setOnClickListener {
// onBackPressedDispatcher.onBackPressed()
// }
// })
// }
//
//
//
// fun getCookFoodList() {
// appViewModel.getCookFoodList(cookMode = 1)
// }
//
// /**
// * 监听返回键
// */
// fun addBackKeyListener() {
// onBackPressedDispatcher.addCallback(this) {
// if (list.isEmpty().not()) {
// //说明有新增的食材
// saveDataRemindDialog()
// return@addCallback
// }
// if (pageFrom == HOME) {
// startActivity<SamplingListActivity>()
// }
// onBackPressedDispatcher.onBackPressed()
// }
// }
//
// private fun saveDataRemindDialog() {
// CommonDialog(this)
// .setTitle("返回提示")
// .setContent("您好,当前页面存在未保存的数据,\n确认返回吗?")
// .setNegativeButton("取消")
// .setPositiveButton("确认") {
// if (pageFrom == HOME) {
// startActivity<SamplingListActivity>()
// }
// finish()
// }
// .setOnDismissCallback { hideStatusBar() }
// .show()
// }
//
//
// val list: MutableList<CookFoodGoodsEntity> = mutableListOf()
//
// private var tempDishEntity: CookFoodGoodsEntity? = null
//
// private var dishMaterialType = 1
//
// private val dishAdapter by lazy {
// DishPartAdapter(list).apply {
// addOnItemChildClickListener(R.id.ivOperateIcon) { _, _, position ->
// //删除操作
// list.removeAt(position)
// notifyItemRemoved(position)
// notifyItemRangeChanged(position, list.size - position)
// }
// }
// }
//
// @SuppressLint("NotifyDataSetChanged")
// private fun addViewClickListener() {
// binding.rvDishPartList.run {
// layoutManager =
// LinearLayoutManager(this@DishSamplingActivity, LinearLayoutManager.VERTICAL, false)
// adapter = dishAdapter
// val itemTouchHelper = ItemTouchHelper(SwipeCallback(dishAdapter) { position ->
// list.removeAt(position)
// dishAdapter.notifyItemRemoved(position)
// dishAdapter.notifyItemRangeChanged(position, list.size - position)
// toast("已删除")
// })
// itemTouchHelper.attachToRecyclerView(this)
// }
// binding.etInputDishType.addOnActionSearchListener {
// searchDishType()
// }
// binding.ivDishTypeSearch.setOnClickListener {
// searchDishType()
// }
//
// binding.ivWeightClear.setOnClickListener {
// WeightUtil.tareTwo(AddressUtil.ONE)
// }
// binding.ivWeightAdd.setOnClickListener {
// if (tempDishEntity == null) {
// toast("请输入食材名称")
// return@setOnClickListener
// }
// if (binding.rgSampling.checkedRadioButtonId == -1) {
// toast("请选择主辅材类型")
// return@setOnClickListener
// }
// val realWeight = tempDishEntity!!.useWeight ?: 0.0
// if (realWeight <= 0.toDouble()) {
// toast("食材用量需要大于0")
// return@setOnClickListener
// }
// if (tempDishEntity?.goodsName != binding.etInputDishType.text.toString().trim()) {
// toast("所选择的食材名称与输入框内容不一致")
// return@setOnClickListener
// }
// tempDishEntity!!.apply {
// isSamplingPage = true
// materialType = dishMaterialType
// }
// val result = list.firstOrNull { it.goodsId == tempDishEntity!!.goodsId }
// if (result != null) {
// toast("${result.goodsName}食材已添加,请勿重复操作")
// return@setOnClickListener
// }
// list.add(tempDishEntity!!)
// dishAdapter.notifyDataSetChanged()
// tempDishEntity = null
// binding.etInputDishType.setText("")
// binding.rgSampling.clearCheck()
// }
// binding.rgSampling.setOnCheckedChangeListener { group, checkedId ->
// dishMaterialType = if (checkedId == R.id.rbDishTypeFirst) 1 else 2
// }
// binding.ivDishSearch.setOnClickListener { v ->
// jumpSearch(v)
// }
// binding.btnCook.clickWithDebounce {
// val showFoodName = binding.etInputDish.text.toString().trim()
// if (showFoodName.isBlank()) {
// toast("菜品名称为空")
// return@clickWithDebounce
// }
// if (list.isEmpty()) {
// toast("菜品构成信息未设置")
// return@clickWithDebounce
// }
// val food = FoodRecord()
// binding.etInputDish.let {
// if (it.tag != null && it.tag.toString() == it.text.toString()) {
// food.foodId = foodId
// }
// }
// food.foodName = showFoodName
// food.cookMode = 1
// Log.d(TAG, "goToSubmit: goodsList:${list.toJsonString()}")
//// startActivity<SubmitDishActivity> {
// startActivity<SubmitFoodActivity> {
// putExtra(SubmitFoodActivity.GOODS_LIST, list as java.io.Serializable)
// putExtra(SubmitFoodActivity.FOOD_ITEM, food as Serializable)
// }
// }
// binding.etInputDish.let { v ->
// v.addOnActionSearchListener {
// jumpSearch(v)
// }
// }
// }
//
// private fun jumpSearch(v: View) {
// val intent = Intent(this, FoodSearchActivity::class.java).apply {
// putExtra(FoodSearchActivity.FOOD_NAME, binding.etInputDish.text.toString().trim())
// }
// startActivity(intent) {
// foodId = it?.getStringExtra(FoodSearchActivity.FOOD_ID)
// foodName = it?.getStringExtra(FoodSearchActivity.FOOD_NAME)
// binding.etInputDish.run {
// setText(foodName)
// tag = foodName
// setSelection(text.length)
// }
// }
// KeyboardUtil.hideKeyboard(v)
// }
//
// private fun searchDishType() {
// val inputText = binding.etInputDishType.text.toString().trim()
// FoodSearchDialog(
// activity = this@DishSamplingActivity,
// defGoodsName = inputText
// ) { item ->
// val filterResult = list.firstOrNull { it.goodsName == item.goodsName }
// if (filterResult != null) {
// toast("不允许重复添加同一食材")
// return@FoodSearchDialog
// }
// binding.etInputDishType.run {
// setText(item.goodsName)
// setSelection(length())
// }
// tempDishEntity = CookFoodGoodsEntity().apply {
// goodsId = item.goodsId
// goodsName = item.goodsName
//
// relateionType = item.relateionType ?: 0
// goodsOrRelationCode = item.goodsOrRelationCode
//
// isNewDishType = true
// // TODO: 待定
// //allEdible = item.allEdible
// }
// }.show()
// }
//
//}
@@ -25,6 +25,9 @@ import com.shuwei.dish.match.utils.ext.visible
import java.io.Serializable
import kotlinx.coroutines.launch
/**
* 菜品搜索页面
*/
class FoodSearchActivity : BaseActivity() {
companion object {
@@ -46,8 +49,8 @@ class FoodSearchActivity : BaseActivity() {
setOnItemClickListener { adapter, view, position ->
if (pageType == 1) {
val jumpItem = list[position].also { it.dinnerType = dinnerType }
startActivity<PrepareCookActivity> {
putExtra(PrepareCookActivity.FOOD_ITEM, jumpItem as Serializable)
startActivity<PrepareFoodActivity> {
putExtra(PrepareFoodActivity.FOOD_ITEM, jumpItem as Serializable)
}
return@setOnItemClickListener
}
@@ -16,6 +16,9 @@ import com.shuwei.dish.match.utils.ext.startActivity
import com.shuwei.dish.match.utils.ext.toast
import kotlinx.coroutines.launch
/**
* 主页,包括三种模式:制作模式、采样模式、品控模式
*/
class HomeActivity : BaseActivity() {
companion object {
@@ -105,7 +108,7 @@ class HomeActivity : BaseActivity() {
modeIconId = R.drawable.ic_mode_cook,
onClick = {
SpTool.cookMode = 0
startActivity<SelectDishActivity>()
startActivity<CookingModeActivity>()
finish()
})
)
@@ -138,20 +141,20 @@ class HomeActivity : BaseActivity() {
val slots = appViewModel.loadSeasoningSlot()
if (slots.isEmpty()) {
// 无调料信息,打开采样历史列表页面,点击设置配置调料信息
startActivity<SamplingListActivity>()
startActivity<SamplingModeActivity>()
finish()
return@launch
}
val count = appViewModel.countCookFood(cookMode = 1)
if (count > 0) {
// 有烹饪中数据,打开采样历史列表页面
startActivity<SamplingListActivity>()
startActivity<SamplingModeActivity>()
finish()
return@launch
}
// 无烹饪数据,打开新增采样页面
startActivity<PrepareCookActivity> {
putExtra(PrepareCookActivity.PAGE_FROM, PrepareCookActivity.HOME)
startActivity<PrepareFoodActivity> {
putExtra(PrepareFoodActivity.PAGE_FROM, PrepareFoodActivity.HOME)
}
finish()
}
@@ -72,7 +72,7 @@ class InitActivity : BaseActivity() {
// 主设备:走原有路由逻辑
when (SpTool.cookMode) {
0 -> {
startActivity<SelectDishActivity>()
startActivity<CookingModeActivity>()
}
1 -> {
@@ -91,18 +91,18 @@ class InitActivity : BaseActivity() {
val slots = appViewModel.loadSeasoningSlot()
if (slots.isEmpty()) {
// 无调料信息,打开采样历史列表页面,点击设置配置调料信息
startActivity<SamplingListActivity>()
startActivity<SamplingModeActivity>()
return@launch
}
val count = appViewModel.countCookFood(cookMode = 1)
if (count > 0) {
// 有烹饪中数据,打开采样历史列表页面
startActivity<SamplingListActivity>()
startActivity<SamplingModeActivity>()
return@launch
}
// 无烹饪数据,打开新增采样页面
startActivity<PrepareCookActivity> {
putExtra(PrepareCookActivity.PAGE_FROM, PrepareCookActivity.HOME)
startActivity<PrepareFoodActivity> {
putExtra(PrepareFoodActivity.PAGE_FROM, PrepareFoodActivity.HOME)
}
}
}
@@ -16,7 +16,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import com.shuwei.dish.match.R
import com.shuwei.dish.match.adapter.DishPartAdapter
import com.shuwei.dish.match.base.BaseActivity
import com.shuwei.dish.match.databinding.ActivityPrepareCookBinding
import com.shuwei.dish.match.databinding.ActivityPrepareFoodBinding
import com.shuwei.dish.match.databinding.LayoutCameraPreviewBinding
import com.shuwei.dish.match.dialog.CommonDialog
import com.shuwei.dish.match.entity.CookFoodEntity
@@ -39,15 +39,15 @@ import com.shuwei.dish.match.utils.ext.toJsonString
import com.shuwei.dish.match.utils.ext.toast
import com.shuwei.dish.match.utils.ext.visible
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.Serializable
import java.util.concurrent.atomic.AtomicBoolean
import kotlin.getValue
import kotlin.math.abs
@SuppressLint("NotifyDataSetChanged")
class PrepareCookActivity : BaseActivity() {
class PrepareFoodActivity : BaseActivity() {
companion object {
const val TAG = "CookActivity"
@@ -59,7 +59,7 @@ class PrepareCookActivity : BaseActivity() {
const val WEIGHT_RECOGNIZE_VALUE = 10
}
private lateinit var binding: ActivityPrepareCookBinding
private val binding by lazy { ActivityPrepareFoodBinding.inflate(layoutInflater) }
private val cameraUtils: CameraUtils by lazy { CameraUtils(this) }
@@ -76,7 +76,6 @@ class PrepareCookActivity : BaseActivity() {
@Suppress("DEPRECATION")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityPrepareCookBinding.inflate(layoutInflater)
setContentView(binding.root)
setHeaderBackground()
pageFrom = intent.getStringExtra(PAGE_FROM)
@@ -383,7 +382,7 @@ class PrepareCookActivity : BaseActivity() {
private fun initRecyclerView() {
binding.rvDishPartList.run {
layoutManager =
LinearLayoutManager(this@PrepareCookActivity, LinearLayoutManager.VERTICAL, false)
LinearLayoutManager(this@PrepareFoodActivity, LinearLayoutManager.VERTICAL, false)
adapter = dishPartAdapter
val itemTouchHelper = ItemTouchHelper(SwipeCallback(dishPartAdapter) { position ->
if (list[position].isNewDishType.not()) {
@@ -435,7 +434,7 @@ class PrepareCookActivity : BaseActivity() {
return@addCallback
}
if (pageFrom == HOME) {
startActivity<SamplingListActivity>()
startActivity<SamplingModeActivity>()
}
} else {
// 制作模式:有未保存数据时提示
@@ -459,7 +458,7 @@ class PrepareCookActivity : BaseActivity() {
.setNegativeButton("取消")
.setPositiveButton("确认") {
if (SpTool.cookMode == 1 && pageFrom == HOME) {
startActivity<SamplingListActivity>()
startActivity<SamplingModeActivity>()
}
finish()
}
@@ -475,7 +474,7 @@ class PrepareCookActivity : BaseActivity() {
lastPhotoUri = uri
lifecycleScope.launch {
withContext(Dispatchers.IO) {
val bitmap = ImageUtil.uriToBitmap(this@PrepareCookActivity, uri)
val bitmap = ImageUtil.uriToBitmap(this@PrepareFoodActivity, uri)
if (bitmap == null) {
dismissLoading()
Log.d(TAG, "takePhoto bitmap is null")
@@ -14,10 +14,9 @@ import com.shuwei.dish.match.R
import com.shuwei.dish.match.adapter.SamplingAdapter
import com.shuwei.dish.match.base.BaseActivity
import com.shuwei.dish.match.base.BaseApp
import com.shuwei.dish.match.databinding.ActivitySamplingBinding
import com.shuwei.dish.match.databinding.ActivitySamplingModeBinding
import com.shuwei.dish.match.databinding.LayoutEmptyViewBinding
import com.shuwei.dish.match.dialog.CommonDialog
import com.shuwei.dish.match.entity.CookFoodEntity
import com.shuwei.dish.match.entity.FoodRecord
import com.shuwei.dish.match.utils.DateTimeUtil
import com.shuwei.dish.match.utils.SwipeCallback
@@ -28,10 +27,12 @@ import com.shuwei.dish.match.utils.ext.visible
import java.io.Serializable
import kotlinx.coroutines.launch
import com.shuwei.dish.match.net.UiState
/**
* 采样模式
*/
class SamplingModeActivity : BaseActivity() {
class SamplingListActivity : BaseActivity() {
private lateinit var binding: ActivitySamplingBinding
private val binding by lazy { ActivitySamplingModeBinding.inflate(layoutInflater) }
companion object {
private const val TAG = "SamplingListActivity"
@@ -41,7 +42,6 @@ class SamplingListActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivitySamplingBinding.inflate(layoutInflater)
setContentView(binding.root)
setTitleBar()
setHeaderBackground()
@@ -181,8 +181,8 @@ class SamplingListActivity : BaseActivity() {
}
return
}
startActivity<PrepareCookActivity> {
putExtra(PrepareCookActivity.FOOD_NAME, item.foodName)
startActivity<PrepareFoodActivity> {
putExtra(PrepareFoodActivity.FOOD_NAME, item.foodName)
}
}
@@ -190,7 +190,7 @@ class SamplingListActivity : BaseActivity() {
private fun initRecyclerView() {
binding.rvSamplingList.run {
layoutManager =
LinearLayoutManager(this@SamplingListActivity, LinearLayoutManager.VERTICAL, false)
LinearLayoutManager(this@SamplingModeActivity, LinearLayoutManager.VERTICAL, false)
adapter = dishAdapter
val itemTouchHelper = ItemTouchHelper(SwipeCallback(dishAdapter) { position ->
if (list[position].isCooking.not()) {
@@ -215,7 +215,7 @@ class SamplingListActivity : BaseActivity() {
private fun addViewListener() {
binding.btnAddSampling.setOnClickListener {
judgeDeviceConfig {
startActivity<PrepareCookActivity>()
startActivity<PrepareFoodActivity>()
}
}
binding.refreshLayout.setOnRefreshListener {
@@ -5,8 +5,7 @@ import android.content.Intent
import android.os.Bundle
import androidx.fragment.app.Fragment
import com.shuwei.dish.match.base.BaseActivity
import com.shuwei.dish.match.base.BaseApp
import com.shuwei.dish.match.ui.fragment.CollectFragment
import com.shuwei.dish.match.ui.fragment.VectorCollectionFragment
import com.shuwei.dish.match.ui.fragment.DeviceConfigFragment
import com.shuwei.dish.match.ui.fragment.SeasoningConfigFragment
import com.shuwei.dish.match.utils.ext.gone
@@ -103,7 +102,7 @@ class SingleFragmentActivity : BaseActivity() {
* 根据页面类型创建对应 Fragment 实例
*/
private fun createFragment(pageType: PageType): Fragment = when (pageType) {
PageType.FOOD_COLLECT -> CollectFragment()
PageType.FOOD_COLLECT -> VectorCollectionFragment()
PageType.COOK_MODE -> DeviceConfigFragment()
PageType.SEASONING_CONFIG -> SeasoningConfigFragment()
}
@@ -12,8 +12,6 @@ import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import androidx.recyclerview.widget.GridLayoutManager
import com.google.gson.reflect.TypeToken
import com.shuwei.dish.match.R
import com.shuwei.dish.match.adapter.SeasoningWeightAdapter
import com.shuwei.dish.match.base.BaseActivity
import com.shuwei.dish.match.base.BaseApp
@@ -22,7 +20,6 @@ import com.shuwei.dish.match.dialog.CommonDialog
import com.shuwei.dish.match.entity.CookFoodEntity
import com.shuwei.dish.match.entity.CookFoodGoodsEntity
import com.shuwei.dish.match.entity.FoodRecord
import com.shuwei.dish.match.net.NetViewModel
import com.shuwei.dish.match.net.UiState
import com.shuwei.dish.match.scale.ScaleDeviceConfig
import com.shuwei.dish.match.scale.ScaleServiceManager
@@ -36,13 +33,10 @@ import com.shuwei.dish.match.utils.ext.roundedDecimalPlace
import com.shuwei.dish.match.utils.ext.roundedOneDecimalPlace
import com.shuwei.dish.match.utils.ext.startActivity
import com.shuwei.dish.match.utils.ext.toJsonString
import com.shuwei.dish.match.utils.ext.toType
import com.shuwei.dish.match.utils.ext.toast
import com.shuwei.dish.match.utils.ext.visible
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@SuppressLint("UseSparseArrays")
class SubmitFoodActivity : BaseActivity() {
@@ -401,14 +395,14 @@ class SubmitFoodActivity : BaseActivity() {
private fun jumpPage(isSampling: Boolean, isCooking: Boolean) {
if (isSampling) {
startActivity<SamplingListActivity> {
putExtra(SelectDishActivity.IS_COOKING, isCooking)
startActivity<SamplingModeActivity> {
putExtra(CookingModeActivity.IS_COOKING, isCooking)
}
return
}
startActivity<SelectDishActivity> {
putExtra(SelectDishActivity.IS_COOKING, isCooking)
putExtra(SelectDishActivity.DINNER_TYPE, food?.dinnerType)
startActivity<CookingModeActivity> {
putExtra(CookingModeActivity.IS_COOKING, isCooking)
putExtra(CookingModeActivity.DINNER_TYPE, food?.dinnerType)
}
}
@@ -11,8 +11,8 @@ import android.view.ViewGroup
import androidx.core.graphics.toColorInt
import com.shuwei.dish.match.base.BaseFragment
import com.shuwei.dish.match.databinding.FragmentDeviceConfigBinding
import com.shuwei.dish.match.ui.SamplingListActivity
import com.shuwei.dish.match.ui.SelectDishActivity
import com.shuwei.dish.match.ui.SamplingModeActivity
import com.shuwei.dish.match.ui.CookingModeActivity
import com.shuwei.dish.match.utils.SpTool
import com.shuwei.dish.match.utils.ext.appendText
import com.shuwei.dish.match.utils.ext.buildSpannableString
@@ -94,8 +94,8 @@ class DeviceConfigFragment : BaseFragment<FragmentDeviceConfigBinding>() {
binding.rbModeSampling.isChecked = false
loadCookSpan(isClicked = true)
loadSamplingSpan()
activity?.startActivity<SelectDishActivity> {
putExtra(SelectDishActivity.IS_CONFIG_PAGE, true)
activity?.startActivity<CookingModeActivity> {
putExtra(CookingModeActivity.IS_CONFIG_PAGE, true)
}
activity?.finish()
}
@@ -105,8 +105,8 @@ class DeviceConfigFragment : BaseFragment<FragmentDeviceConfigBinding>() {
binding.rbModeSampling.isChecked = true
loadCookSpan()
loadSamplingSpan(isClicked = true)
activity?.startActivity<SamplingListActivity> {
putExtra(SamplingListActivity.IS_CONFIG_PAGE, true)
activity?.startActivity<SamplingModeActivity> {
putExtra(SamplingModeActivity.IS_CONFIG_PAGE, true)
}
activity?.finish()
}
@@ -3,7 +3,6 @@ package com.shuwei.dish.match.ui.fragment
import android.annotation.SuppressLint
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
@@ -19,8 +18,8 @@ import com.shuwei.dish.match.databinding.LayoutEmptyViewBinding
import com.shuwei.dish.match.entity.CookFoodEntity
import com.shuwei.dish.match.entity.FoodRecord
import com.shuwei.dish.match.net.UiState
import com.shuwei.dish.match.ui.PrepareCookActivity
import com.shuwei.dish.match.ui.SelectDishActivity
import com.shuwei.dish.match.ui.PrepareFoodActivity
import com.shuwei.dish.match.ui.CookingModeActivity
import com.shuwei.dish.match.ui.SubmitFoodActivity
import com.shuwei.dish.match.utils.SwipeCallback
import com.shuwei.dish.match.utils.ext.startActivity
@@ -49,7 +48,7 @@ class DishListFragment : BaseFragment<FragmentDishListBinding>() {
private var dinnerType = "0"
private lateinit var activity: SelectDishActivity
private lateinit var activity: CookingModeActivity
private var list: MutableList<FoodRecord> = mutableListOf()
private val dishAdapter by lazy {
@@ -79,7 +78,7 @@ class DishListFragment : BaseFragment<FragmentDishListBinding>() {
return
}
item.dinnerType = dinnerType
activity.startActivity<PrepareCookActivity> {
activity.startActivity<PrepareFoodActivity> {
putExtra(
SubmitFoodActivity.FOOD_ITEM,
item as Serializable
@@ -95,7 +94,7 @@ class DishListFragment : BaseFragment<FragmentDishListBinding>() {
}
override fun initialize() {
activity = requireActivity() as SelectDishActivity
activity = requireActivity() as CookingModeActivity
dinnerType = arguments?.getString(DINNER_TYPE, "0") ?: "0"
binding.rvDishList.run {
layoutManager =
@@ -19,7 +19,7 @@ import com.shuwei.dish.match.R
import com.shuwei.dish.match.adapter.VectorCollectionAdapter
import com.shuwei.dish.match.adapter.FoodSearchAdapter
import com.shuwei.dish.match.base.BaseFragment
import com.shuwei.dish.match.databinding.FragmentCollectBinding
import com.shuwei.dish.match.databinding.FragmentVectorCollectionBinding
import com.shuwei.dish.match.databinding.LayoutCameraPreviewBinding
import com.shuwei.dish.match.dialog.Loading
import com.shuwei.dish.match.entity.CookFoodGoodsEntity
@@ -37,7 +37,7 @@ import com.shuwei.dish.match.utils.ext.dp
import com.shuwei.dish.match.utils.ext.toast
@SuppressLint("NotifyDataSetChanged")
class CollectFragment : BaseFragment<FragmentCollectBinding>() {
class VectorCollectionFragment : BaseFragment<FragmentVectorCollectionBinding>() {
companion object {
private const val TAG = "CollectFragment"
@@ -105,8 +105,8 @@ class CollectFragment : BaseFragment<FragmentCollectBinding>() {
override fun inflateBinding(
inflater: LayoutInflater,
container: ViewGroup?
): FragmentCollectBinding {
return FragmentCollectBinding.inflate(inflater, container, false)
): FragmentVectorCollectionBinding {
return FragmentVectorCollectionBinding.inflate(inflater, container, false)
}
//typealias CameraCallback = (Uri) -> Unit
+254 -254
View File
@@ -7,287 +7,287 @@
android:orientation="vertical"
tools:background="@drawable/bg_other_page">
<LinearLayout
android:id="@+id/llSearchBar"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_margin="30dp"
android:background="@drawable/shape_white_30_corners"
android:gravity="center_vertical"
android:orientation="horizontal">
<!-- <LinearLayout-->
<!-- android:id="@+id/llSearchBar"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="100dp"-->
<!-- android:layout_margin="30dp"-->
<!-- android:background="@drawable/shape_white_30_corners"-->
<!-- android:gravity="center_vertical"-->
<!-- android:orientation="horizontal">-->
<EditText
android:id="@+id/etInputDish"
android:layout_width="0dp"
android:layout_height="80dp"
android:layout_marginStart="28dp"
android:layout_weight="1"
android:autofillHints=""
android:background="@color/white"
android:gravity="center"
android:hint="@string/dish_search_hint"
android:inputType="text"
android:imeOptions="actionSearch"
android:paddingStart="3dp"
android:paddingEnd="3dp"
android:textColor="@color/black333"
android:textColorHint="@color/gray_c8"
android:textSize="40sp"
tools:ignore="TextFields" />
<!-- <EditText-->
<!-- android:id="@+id/etInputDish"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="80dp"-->
<!-- android:layout_marginStart="28dp"-->
<!-- android:layout_weight="1"-->
<!-- android:autofillHints=""-->
<!-- android:background="@color/white"-->
<!-- android:gravity="center"-->
<!-- android:hint="@string/dish_search_hint"-->
<!-- android:inputType="text"-->
<!-- android:imeOptions="actionSearch"-->
<!-- android:paddingStart="3dp"-->
<!-- android:paddingEnd="3dp"-->
<!-- android:textColor="@color/black333"-->
<!-- android:textColorHint="@color/gray_c8"-->
<!-- android:textSize="40sp"-->
<!-- tools:ignore="TextFields" />-->
<ImageView
android:id="@+id/ivDishSearch"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:src="@drawable/ic_search_gray"
tools:ignore="ContentDescription" />
<!-- <ImageView-->
<!-- android:id="@+id/ivDishSearch"-->
<!-- android:layout_width="60dp"-->
<!-- android:layout_height="60dp"-->
<!-- android:layout_marginStart="20dp"-->
<!-- android:layout_marginEnd="20dp"-->
<!-- android:paddingStart="10dp"-->
<!-- android:paddingEnd="10dp"-->
<!-- android:src="@drawable/ic_search_gray"-->
<!-- tools:ignore="ContentDescription" />-->
</LinearLayout>
<!-- </LinearLayout>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:layout_marginBottom="30dp"
android:background="@drawable/shape_white_30_corners"
android:gravity="center_vertical"
android:orientation="vertical">
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="30dp"-->
<!-- android:layout_marginEnd="30dp"-->
<!-- android:layout_marginBottom="30dp"-->
<!-- android:background="@drawable/shape_white_30_corners"-->
<!-- android:gravity="center_vertical"-->
<!-- android:orientation="vertical">-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="113dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="113dp"-->
<!-- android:gravity="center_vertical"-->
<!-- android:orientation="horizontal">-->
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:layout_weight="1"
android:text="@string/dish_name"
android:textColor="@color/black666"
android:textSize="28sp" />
<!-- <TextView-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="30dp"-->
<!-- android:layout_marginEnd="30dp"-->
<!-- android:layout_weight="1"-->
<!-- android:text="@string/dish_name"-->
<!-- android:textColor="@color/black666"-->
<!-- android:textSize="28sp" />-->
<EditText
android:id="@+id/etInputDishType"
android:layout_width="wrap_content"
android:layout_height="80dp"
android:background="@color/white"
android:gravity="center_vertical"
android:hint="@string/dish_search_hint2"
android:textColor="@color/black333"
android:textColorHint="@color/gray_c8"
android:imeOptions="actionSearch"
android:inputType="text"
android:textSize="28sp"
android:maxLines="1"
android:paddingEnd="6dp"
android:paddingStart="6dp"
android:ellipsize="end"/>
<!-- <EditText-->
<!-- android:id="@+id/etInputDishType"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="80dp"-->
<!-- android:background="@color/white"-->
<!-- android:gravity="center_vertical"-->
<!-- android:hint="@string/dish_search_hint2"-->
<!-- android:textColor="@color/black333"-->
<!-- android:textColorHint="@color/gray_c8"-->
<!-- android:imeOptions="actionSearch"-->
<!-- android:inputType="text"-->
<!-- android:textSize="28sp"-->
<!-- android:maxLines="1"-->
<!-- android:paddingEnd="6dp"-->
<!-- android:paddingStart="6dp"-->
<!-- android:ellipsize="end"/>-->
<ImageView
android:id="@+id/ivDishTypeSearch"
android:layout_width="80dp"
android:layout_height="80dp"
android:padding="24dp"
android:layout_marginEnd="6dp"
android:src="@drawable/ic_search_green"
tools:ignore="ContentDescription" />
<!-- <ImageView-->
<!-- android:id="@+id/ivDishTypeSearch"-->
<!-- android:layout_width="80dp"-->
<!-- android:layout_height="80dp"-->
<!-- android:padding="24dp"-->
<!-- android:layout_marginEnd="6dp"-->
<!-- android:src="@drawable/ic_search_green"-->
<!-- tools:ignore="ContentDescription" />-->
<!-- <ImageView-->
<!-- android:id="@+id/ivDishTypeSearch"-->
<!-- android:layout_width="62dp"-->
<!-- android:layout_height="62dp"-->
<!-- android:layout_marginStart="15dp"-->
<!-- android:layout_marginEnd="15dp"-->
<!-- android:paddingStart="15dp"-->
<!-- android:paddingEnd="15dp"-->
<!-- android:src="@drawable/ic_search_green"-->
<!-- tools:ignore="ContentDescription" />-->
</LinearLayout>
<!-- &lt;!&ndash; <ImageView&ndash;&gt;-->
<!-- &lt;!&ndash; android:id="@+id/ivDishTypeSearch"&ndash;&gt;-->
<!-- &lt;!&ndash; android:layout_width="62dp"&ndash;&gt;-->
<!-- &lt;!&ndash; android:layout_height="62dp"&ndash;&gt;-->
<!-- &lt;!&ndash; android:layout_marginStart="15dp"&ndash;&gt;-->
<!-- &lt;!&ndash; android:layout_marginEnd="15dp"&ndash;&gt;-->
<!-- &lt;!&ndash; android:paddingStart="15dp"&ndash;&gt;-->
<!-- &lt;!&ndash; android:paddingEnd="15dp"&ndash;&gt;-->
<!-- &lt;!&ndash; android:src="@drawable/ic_search_green"&ndash;&gt;-->
<!-- &lt;!&ndash; tools:ignore="ContentDescription" />&ndash;&gt;-->
<!-- </LinearLayout>-->
<com.google.android.material.divider.MaterialDivider
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
app:dividerColor="@color/gray_eb" />
<!-- <com.google.android.material.divider.MaterialDivider-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="1dp"-->
<!-- android:layout_marginStart="30dp"-->
<!-- android:layout_marginEnd="30dp"-->
<!-- app:dividerColor="@color/gray_eb" />-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="113dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="113dp"-->
<!-- android:gravity="center_vertical"-->
<!-- android:orientation="horizontal">-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:text="@string/dish_from_type"
android:textColor="@color/black666"
android:textSize="28sp" />
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="30dp"-->
<!-- android:layout_marginEnd="30dp"-->
<!-- android:text="@string/dish_from_type"-->
<!-- android:textColor="@color/black666"-->
<!-- android:textSize="28sp" />-->
<RadioGroup
android:id="@+id/rgSampling"
android:layout_width="match_parent"
android:layout_height="80dp"
android:gravity="center_vertical|end"
android:orientation="horizontal">
<!-- <RadioGroup-->
<!-- android:id="@+id/rgSampling"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="80dp"-->
<!-- android:gravity="center_vertical|end"-->
<!-- android:orientation="horizontal">-->
<RadioButton
android:id="@+id/rbDishTypeFirst"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="30dp"
android:background="@color/white"
android:button="@null"
android:drawableStart="@drawable/selector_dish_type"
android:drawablePadding="30dp"
android:gravity="center"
android:paddingStart="30dp"
android:paddingEnd="30dp"
android:text="@string/dish_type_first"
android:textColor="@color/dish_type_font"
android:textSize="30sp"
android:textStyle="bold" />
<!-- <RadioButton-->
<!-- android:id="@+id/rbDishTypeFirst"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_marginStart="30dp"-->
<!-- android:background="@color/white"-->
<!-- android:button="@null"-->
<!-- android:drawableStart="@drawable/selector_dish_type"-->
<!-- android:drawablePadding="30dp"-->
<!-- android:gravity="center"-->
<!-- android:paddingStart="30dp"-->
<!-- android:paddingEnd="30dp"-->
<!-- android:text="@string/dish_type_first"-->
<!-- android:textColor="@color/dish_type_font"-->
<!-- android:textSize="30sp"-->
<!-- android:textStyle="bold" />-->
<RadioButton
android:id="@+id/rbDishTypeSecond"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginStart="30dp"
android:background="@color/white"
android:button="@null"
android:checked="false"
android:drawableStart="@drawable/selector_dish_type"
android:drawablePadding="30dp"
android:gravity="center"
android:paddingStart="30dp"
android:paddingEnd="30dp"
android:text="@string/dish_type_second"
android:textColor="@color/dish_type_font"
android:textSize="30sp"
android:textStyle="bold" />
</RadioGroup>
<!-- <RadioButton-->
<!-- android:id="@+id/rbDishTypeSecond"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_marginStart="30dp"-->
<!-- android:background="@color/white"-->
<!-- android:button="@null"-->
<!-- android:checked="false"-->
<!-- android:drawableStart="@drawable/selector_dish_type"-->
<!-- android:drawablePadding="30dp"-->
<!-- android:gravity="center"-->
<!-- android:paddingStart="30dp"-->
<!-- android:paddingEnd="30dp"-->
<!-- android:text="@string/dish_type_second"-->
<!-- android:textColor="@color/dish_type_font"-->
<!-- android:textSize="30sp"-->
<!-- android:textStyle="bold" />-->
<!-- </RadioGroup>-->
</LinearLayout>
<!-- </LinearLayout>-->
<com.google.android.material.divider.MaterialDivider
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
app:dividerColor="@color/gray_eb" />
<!-- <com.google.android.material.divider.MaterialDivider-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="1dp"-->
<!-- android:layout_marginStart="30dp"-->
<!-- android:layout_marginEnd="30dp"-->
<!-- app:dividerColor="@color/gray_eb" />-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="170dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="170dp"-->
<!-- android:gravity="center_vertical"-->
<!-- android:orientation="horizontal">-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:text="@string/dish_part_weight_remind"
android:textColor="@color/black666"
android:textSize="28sp" />
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="30dp"-->
<!-- android:layout_marginEnd="30dp"-->
<!-- android:text="@string/dish_part_weight_remind"-->
<!-- android:textColor="@color/black666"-->
<!-- android:textSize="28sp" />-->
<TextView
android:id="@+id/tvDishPartWeight"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginStart="30dp"
android:layout_weight="1"
android:autofillHints=""
android:background="@drawable/shape_white_f6_10_corners"
android:gravity="center"
android:hint="-"
android:maxLines="1"
android:paddingStart="20dp"
android:paddingEnd="20dp"
android:text=""
android:textColor="@color/dish_green"
android:textColorHint="@color/gray_d6"
android:textSize="60sp"
tools:ignore="HardcodedText" />
<!-- <TextView-->
<!-- android:id="@+id/tvDishPartWeight"-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="100dp"-->
<!-- android:layout_marginStart="30dp"-->
<!-- android:layout_weight="1"-->
<!-- android:autofillHints=""-->
<!-- android:background="@drawable/shape_white_f6_10_corners"-->
<!-- android:gravity="center"-->
<!-- android:hint="-"-->
<!-- android:maxLines="1"-->
<!-- android:paddingStart="20dp"-->
<!-- android:paddingEnd="20dp"-->
<!-- android:text=""-->
<!-- android:textColor="@color/dish_green"-->
<!-- android:textColorHint="@color/gray_d6"-->
<!-- android:textSize="60sp"-->
<!-- tools:ignore="HardcodedText" />-->
<ImageView
android:id="@+id/ivWeightClear"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_marginStart="30dp"
android:src="@drawable/ic_weight_clear"
tools:ignore="ContentDescription" />
<!-- <ImageView-->
<!-- android:id="@+id/ivWeightClear"-->
<!-- android:layout_width="90dp"-->
<!-- android:layout_height="90dp"-->
<!-- android:layout_marginStart="30dp"-->
<!-- android:src="@drawable/ic_weight_clear"-->
<!-- tools:ignore="ContentDescription" />-->
<ImageView
android:id="@+id/ivWeightAdd"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:src="@drawable/ic_weight_add"
tools:ignore="ContentDescription" />
</LinearLayout>
</LinearLayout>
<!-- <ImageView-->
<!-- android:id="@+id/ivWeightAdd"-->
<!-- android:layout_width="90dp"-->
<!-- android:layout_height="90dp"-->
<!-- android:layout_marginStart="30dp"-->
<!-- android:layout_marginEnd="30dp"-->
<!-- android:src="@drawable/ic_weight_add"-->
<!-- tools:ignore="ContentDescription" />-->
<!-- </LinearLayout>-->
<!-- </LinearLayout>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginStart="30dp"
android:layout_marginTop="0dp"
android:layout_marginEnd="30dp"
android:layout_weight="1"
android:background="@drawable/shape_white_30_corners"
android:orientation="vertical">
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="0dp"-->
<!-- android:layout_marginStart="30dp"-->
<!-- android:layout_marginTop="0dp"-->
<!-- android:layout_marginEnd="30dp"-->
<!-- android:layout_weight="1"-->
<!-- android:background="@drawable/shape_white_30_corners"-->
<!-- android:orientation="vertical">-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginTop="40dp"
android:layout_marginBottom="40dp"
android:text="@string/dish_composition"
android:textColor="@color/black666"
android:textSize="28sp" />
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginStart="30dp"-->
<!-- android:layout_marginTop="40dp"-->
<!-- android:layout_marginBottom="40dp"-->
<!-- android:text="@string/dish_composition"-->
<!-- android:textColor="@color/black666"-->
<!-- android:textSize="28sp" />-->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvDishPartList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="20dp"
android:overScrollMode="never"
tools:itemCount="3"
tools:listitem="@layout/list_item_dish_cook"
android:scrollbars="vertical"/>
<!-- <androidx.recyclerview.widget.RecyclerView-->
<!-- android:id="@+id/rvDishPartList"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_marginBottom="20dp"-->
<!-- android:overScrollMode="never"-->
<!-- tools:itemCount="3"-->
<!-- tools:listitem="@layout/list_item_dish_cook"-->
<!-- android:scrollbars="vertical"/>-->
</LinearLayout>
<!-- </LinearLayout>-->
<TextView
android:id="@+id/btnCook"
android:layout_width="match_parent"
android:layout_height="90dp"
android:layout_margin="30dp"
android:gravity="center"
android:text="@string/goCooking"
android:textColor="@color/white"
android:textSize="32sp"
android:textStyle="bold"
android:background="@drawable/shape_green_bg"
android:foreground="?android:attr/selectableItemBackground"
android:clickable="true" />
<!-- android:background="@drawable/ripple_effect_green"-->
<!-- <TextView-->
<!-- android:id="@+id/btnCook"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="90dp"-->
<!-- android:layout_margin="30dp"-->
<!-- android:gravity="center"-->
<!-- android:text="@string/goCooking"-->
<!-- android:textColor="@color/white"-->
<!-- android:textSize="32sp"-->
<!-- android:textStyle="bold"-->
<!-- android:background="@drawable/shape_green_bg"-->
<!-- android:background="?attr/selectableItemBackground"-->
<!-- android:clickable="true"-->
<!-- android:foreground="?android:attr/selectableItemBackground"-->
<!-- android:clickable="true" />-->
<!--&lt;!&ndash; android:background="@drawable/ripple_effect_green"&ndash;&gt;-->
<!--&lt;!&ndash; android:background="@drawable/shape_green_bg"&ndash;&gt;-->
<!--&lt;!&ndash; android:background="?attr/selectableItemBackground"&ndash;&gt;-->
<!--&lt;!&ndash; android:clickable="true"&ndash;&gt;-->
</LinearLayout>