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