remove(dish): 删除菜品采样相关功能代码

- 移除 activity_dish_sampling.xml 布局文件及其全部UI组件
- 删除 DishSamplingActivity 类的所有业务逻辑代码
- 移除 BaseReq 基础请求类定义
- 将 loading 图片资源引用从 loading_spinner 更新为 loading
This commit is contained in:
2026-04-29 08:48:12 +08:00
parent 9a0b066490
commit 95895e6390
4 changed files with 1 additions and 595 deletions
@@ -1,10 +0,0 @@
package com.shuwei.dish.match.base
class BaseReq<T> {
var code: Int? = null
var success: Boolean? = null
var data: T? = null
var message: String? = null
var result: T? = null
var msg: String? = null
}
@@ -1,291 +0,0 @@
//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()
// }
//
//}
@@ -28,7 +28,7 @@
android:id="@+id/ivLoading"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/loading_spinner"
android:src="@drawable/loading"
android:contentDescription="加载中" />
<!-- 倒计时文字 -->
@@ -1,293 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
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">-->
<!-- <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" />-->
<!-- </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="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" />-->
<!-- <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" />-->
<!-- &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" />-->
<!-- <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" />-->
<!-- <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/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>-->
<!-- <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">-->
<!-- <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" />-->
<!-- <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>-->
<!-- <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" />-->
<!-- <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>-->
<!-- <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" />-->
<!--&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>