优化秤重量显示,量程溢出时增加红色背景提示

This commit is contained in:
mazengfei
2026-05-22 17:29:36 +08:00
parent 863cd70118
commit 82960b26a0
3 changed files with 11 additions and 2 deletions
@@ -12,6 +12,8 @@ import android.util.SparseArray
import android.widget.FrameLayout
import androidx.core.graphics.toColorInt
import androidx.core.view.forEach
import androidx.core.content.ContextCompat
import com.shuwei.dish.match.R
import com.shuwei.dish.match.base.BaseActivity
import com.shuwei.dish.match.db.entity.SeasoningEntity
import com.shuwei.dish.match.utils.AddressUtil
@@ -129,6 +131,13 @@ class DeviceConfigActivity : BaseActivity() {
item?.let {
it.useWeight = weight
updateGridData(it)
// 根据是否量程溢出切换格子背景色
val frameLayout = binding.include.root.findViewWithTag<FrameLayout>(it.sort.toString())
frameLayout?.background = if (state == WeightUtil.STATE_OVER_WEIGHT) {
ContextCompat.getDrawable(this, R.drawable.shape_red_10_corners)
} else {
ContextCompat.getDrawable(this, R.drawable.selector_text_cell)
}
}
Log.d(TAG, "addWeighListener: update-----------------------")
})
@@ -215,7 +215,7 @@ class PrepareCookActivity : BaseActivity() {
}
private fun loadDishDetail(detail: CookFoodDTO) {
val voList = detail.matchingConstituteInfoList
val voList = detail.foodConstituteList
if (voList.isNullOrEmpty()) {
return
}
@@ -98,7 +98,7 @@ class SubmitFoodActivity : BaseActivity() {
}
private fun loadSeasoningFromLocal() {
appViewModel.getCookFoodGoodsList(foodId = food!!.foodId!!, cookMode = food!!.cookMode) { it ->
appViewModel.getCookFoodGoodsList(foodId = food!!.foodId!!, cookMode = food!!.cookMode, dinnerType = food!!.dinnerType) { it ->
goodsList = mutableListOf()
val goodsIdList = mutableListOf<String>()
//设置主辅材数据