diff --git a/app/src/main/java/com/shuwei/dish/match/base/BaseReq.kt b/app/src/main/java/com/shuwei/dish/match/base/BaseReq.kt deleted file mode 100644 index ce222f8..0000000 --- a/app/src/main/java/com/shuwei/dish/match/base/BaseReq.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.shuwei.dish.match.base - -class BaseReq { - var code: Int? = null - var success: Boolean? = null - var data: T? = null - var message: String? = null - var result: T? = null - var msg: String? = null -} \ No newline at end of file diff --git a/app/src/main/java/com/shuwei/dish/match/ui/DishSamplingActivity.kt b/app/src/main/java/com/shuwei/dish/match/ui/DishSamplingActivity.kt deleted file mode 100644 index 9448f0f..0000000 --- a/app/src/main/java/com/shuwei/dish/match/ui/DishSamplingActivity.kt +++ /dev/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() -// } -// }, 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() -// } -// onBackPressedDispatcher.onBackPressed() -// } -// } -// -// private fun saveDataRemindDialog() { -// CommonDialog(this) -// .setTitle("返回提示") -// .setContent("您好,当前页面存在未保存的数据,\n确认返回吗?") -// .setNegativeButton("取消") -// .setPositiveButton("确认") { -// if (pageFrom == HOME) { -// startActivity() -// } -// finish() -// } -// .setOnDismissCallback { hideStatusBar() } -// .show() -// } -// -// -// val list: MutableList = 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 { -// startActivity { -// 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() -// } -// -//} \ No newline at end of file diff --git a/app/src/main/res/layout-land/activity_init.xml b/app/src/main/res/layout-land/activity_init.xml index 61954d3..14273b1 100644 --- a/app/src/main/res/layout-land/activity_init.xml +++ b/app/src/main/res/layout-land/activity_init.xml @@ -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="加载中" /> diff --git a/app/src/main/res/layout/activity_dish_sampling.xml b/app/src/main/res/layout/activity_dish_sampling.xml deleted file mode 100644 index ba082b8..0000000 --- a/app/src/main/res/layout/activity_dish_sampling.xml +++ /dev/null @@ -1,293 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file