优化
This commit is contained in:
@@ -82,4 +82,8 @@ class CookFoodGoodsEntity(
|
|||||||
|
|
||||||
@Ignore
|
@Ignore
|
||||||
var isClicked: Boolean = false
|
var isClicked: Boolean = false
|
||||||
|
|
||||||
|
//true-原始数据,false-非原始数据
|
||||||
|
@Ignore
|
||||||
|
var isOriginalData: Boolean = true
|
||||||
}
|
}
|
||||||
@@ -13,7 +13,8 @@ data class FoodRecord(
|
|||||||
var cookMode: Int = 0,
|
var cookMode: Int = 0,
|
||||||
//1-早餐,2-午餐,3-晚餐
|
//1-早餐,2-午餐,3-晚餐
|
||||||
var dinnerType: String = "0",
|
var dinnerType: String = "0",
|
||||||
|
//true-原始数据,false-非原始数据
|
||||||
|
var isOriginalData: Boolean = true,
|
||||||
var sort: Int = 0
|
var sort: Int = 0
|
||||||
) : Serializable
|
) : Serializable
|
||||||
|
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ class PrepareCookActivity : BaseActivity() {
|
|||||||
Log.d(TAG, "addViewClickListener->useRealWeight=$weight")
|
Log.d(TAG, "addViewClickListener->useRealWeight=$weight")
|
||||||
clickItem.run {
|
clickItem.run {
|
||||||
useWeight = weight
|
useWeight = weight
|
||||||
|
isOriginalData = false
|
||||||
isSetFinished = true
|
isSetFinished = true
|
||||||
dishPartAdapter.notifyItemChanged(clickIndex)
|
dishPartAdapter.notifyItemChanged(clickIndex)
|
||||||
}
|
}
|
||||||
@@ -138,6 +139,7 @@ class PrepareCookActivity : BaseActivity() {
|
|||||||
goodsName = item.goodsName
|
goodsName = item.goodsName
|
||||||
// materialType =
|
// materialType =
|
||||||
isNewDishType = true
|
isNewDishType = true
|
||||||
|
isOriginalData = false
|
||||||
})
|
})
|
||||||
onItemClick(list.size - 1)
|
onItemClick(list.size - 1)
|
||||||
binding.rvDishPartList.smoothScrollToPosition(list.size - 1)
|
binding.rvDishPartList.smoothScrollToPosition(list.size - 1)
|
||||||
@@ -327,17 +329,23 @@ class PrepareCookActivity : BaseActivity() {
|
|||||||
@SuppressLint("GestureBackNavigation")
|
@SuppressLint("GestureBackNavigation")
|
||||||
@Deprecated("Deprecated in Java")
|
@Deprecated("Deprecated in Java")
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
if (list.size > firstReqSize) {
|
val count = list.count { !it.isOriginalData }
|
||||||
//说明有新增的食材
|
if (count > 0) {
|
||||||
saveDataRemindDialog()
|
//说明有新增或者设置重量
|
||||||
return
|
|
||||||
}
|
|
||||||
val filterResult = list.firstOrNull { (it.useWeight ?: 0.toDouble()) > 0.toDouble() }
|
|
||||||
if (filterResult != null) {
|
|
||||||
//说明有称重的数据
|
|
||||||
saveDataRemindDialog()
|
saveDataRemindDialog()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// if (list.size > firstReqSize) {
|
||||||
|
// //说明有新增的食材
|
||||||
|
// saveDataRemindDialog()
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// val filterResult = list.firstOrNull { (it.useWeight ?: 0.toDouble()) > 0.toDouble() }
|
||||||
|
// if (filterResult != null) {
|
||||||
|
// //说明有称重的数据
|
||||||
|
// saveDataRemindDialog()
|
||||||
|
// return
|
||||||
|
// }
|
||||||
super.onBackPressed()
|
super.onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -221,6 +221,8 @@ class DishListFragment : BaseFragment<FragmentDishListBinding>() {
|
|||||||
@SuppressLint("NotifyDataSetChanged")
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
private fun loadEmptyView() {
|
private fun loadEmptyView() {
|
||||||
try {
|
try {
|
||||||
|
binding.refreshLayout.setEnableRefresh(true)
|
||||||
|
binding.refreshLayout.setEnableLoadMore(false)
|
||||||
list.clear()
|
list.clear()
|
||||||
dishAdapter.notifyDataSetChanged()
|
dishAdapter.notifyDataSetChanged()
|
||||||
if (emptyViewBinding == null) {
|
if (emptyViewBinding == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user