优化订单显示档口机标识;优化当前菜品信息的问题;
This commit is contained in:
@@ -2,6 +2,7 @@ package com.sw.dualscreen.adapter
|
|||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.graphics.Color
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
@@ -31,13 +32,15 @@ class FoodOrderAdapter(list: MutableList<FoodItem>) :
|
|||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
override fun onBindViewHolder(holder: VH, position: Int, item: FoodItem?) {
|
override fun onBindViewHolder(holder: VH, position: Int, item: FoodItem?) {
|
||||||
val binding = holder.binding
|
val binding = holder.binding
|
||||||
|
setTextColor(binding.tvFoodName, binding.tvPriceNorm, binding.tvWeight, binding.tvAmount)
|
||||||
item?.let {
|
item?.let {
|
||||||
binding.tvFoodName.text = it.foodName
|
binding.tvFoodName.text = it.foodName
|
||||||
|
binding.tvFoodName.setTextColor(if (it.isLocalData) Color.GREEN else "#FF33446A".toColorInt())
|
||||||
if (it.orderFrom == 2) {
|
if (it.orderFrom == 2) {
|
||||||
binding.tvPriceNorm.text = if (it.specName.isNullOrBlank()) "${it.specWeight}克" else "${it.specName}/${it.specWeight}克"
|
binding.tvPriceNorm.text = if (it.specName.isNullOrBlank()) "${it.specWeight}克" else "${it.specName}/${it.specWeight}克"
|
||||||
} else {
|
} else {
|
||||||
val foodPrice = it.foodPrice.format2String(2)
|
val foodPrice = it.foodPrice.format2String(2)
|
||||||
binding.tvPriceNorm.text = "${foodPrice}/${it.num}克"
|
binding.tvPriceNorm.text = "${foodPrice}/100克"
|
||||||
}
|
}
|
||||||
//if (it.specName.isNullOrBlank().not()) {
|
//if (it.specName.isNullOrBlank().not()) {
|
||||||
// binding.tvPriceFlag.text = "[${it.specName}]"
|
// binding.tvPriceFlag.text = "[${it.specName}]"
|
||||||
@@ -48,7 +51,6 @@ class FoodOrderAdapter(list: MutableList<FoodItem>) :
|
|||||||
if (it.orderFrom == 2) visible() else gone()
|
if (it.orderFrom == 2) visible() else gone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setTextColor(binding.tvFoodName, binding.tvPriceNorm, binding.tvWeight, binding.tvAmount)
|
|
||||||
binding.root.updateLayoutParams<RecyclerView.LayoutParams> {
|
binding.root.updateLayoutParams<RecyclerView.LayoutParams> {
|
||||||
topMargin = 2.dp
|
topMargin = 2.dp
|
||||||
bottomMargin = 2.dp
|
bottomMargin = 2.dp
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import android.graphics.Bitmap
|
|||||||
import android.graphics.Point
|
import android.graphics.Point
|
||||||
import android.hardware.Camera
|
import android.hardware.Camera
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
import android.view.Display
|
import android.view.Display
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@@ -15,6 +16,7 @@ import android.view.ViewTreeObserver
|
|||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
|
import androidx.core.view.postDelayed
|
||||||
import androidx.core.view.updateLayoutParams
|
import androidx.core.view.updateLayoutParams
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
@@ -31,6 +33,7 @@ import com.sw.dualscreen.ext.format2String
|
|||||||
import com.sw.dualscreen.ext.gone
|
import com.sw.dualscreen.ext.gone
|
||||||
import com.sw.dualscreen.ext.load
|
import com.sw.dualscreen.ext.load
|
||||||
import com.sw.dualscreen.ext.maskName
|
import com.sw.dualscreen.ext.maskName
|
||||||
|
import com.sw.dualscreen.ext.roundedDecimalPlace
|
||||||
import com.sw.dualscreen.ext.screenSize
|
import com.sw.dualscreen.ext.screenSize
|
||||||
import com.sw.dualscreen.ext.visible
|
import com.sw.dualscreen.ext.visible
|
||||||
import com.sw.dualscreen.model.response.DinnerType
|
import com.sw.dualscreen.model.response.DinnerType
|
||||||
@@ -190,8 +193,8 @@ class MainScreenPresentation(
|
|||||||
// Timber.tag(TAG).e("updateWeight dinnerType is null")
|
// Timber.tag(TAG).e("updateWeight dinnerType is null")
|
||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
if (chargeMode == 1) {
|
if (chargeMode == 1 || activity.settlementMode == 0) {
|
||||||
//不计费
|
//不计费或者联合支付模式更新营养热量数据
|
||||||
if (mealPickupMode == 0) {
|
if (mealPickupMode == 0) {
|
||||||
//即放即取
|
//即放即取
|
||||||
calculateNutrition(lastWeight)
|
calculateNutrition(lastWeight)
|
||||||
@@ -279,6 +282,14 @@ class MainScreenPresentation(
|
|||||||
private fun setTopInfoVisible() {
|
private fun setTopInfoVisible() {
|
||||||
binding.llTopInfo.visible()
|
binding.llTopInfo.visible()
|
||||||
binding.flFoodDetail.gone()
|
binding.flFoodDetail.gone()
|
||||||
|
if (activity.settlementMode == 0) {
|
||||||
|
try {
|
||||||
|
foodOrderList.clear()
|
||||||
|
foodOrderAdapter.submitList(foodOrderList)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
binding.llTopInfo.updateLayoutParams {
|
binding.llTopInfo.updateLayoutParams {
|
||||||
height = activity.screenSize[1] / 2 + 120.dp
|
height = activity.screenSize[1] / 2 + 120.dp
|
||||||
}
|
}
|
||||||
@@ -288,6 +299,7 @@ class MainScreenPresentation(
|
|||||||
* 显示识别出的菜品信息
|
* 显示识别出的菜品信息
|
||||||
*/
|
*/
|
||||||
fun step3ShowRecognizeResult(userId: String) {
|
fun step3ShowRecognizeResult(userId: String) {
|
||||||
|
step3Debouncer.debounce {
|
||||||
Timber.tag(TAG).d("main,step3,耗时:${System.currentTimeMillis() - startTime}")
|
Timber.tag(TAG).d("main,step3,耗时:${System.currentTimeMillis() - startTime}")
|
||||||
LightManager.closeRedLight()
|
LightManager.closeRedLight()
|
||||||
LightManager.openGreenLight()
|
LightManager.openGreenLight()
|
||||||
@@ -295,7 +307,24 @@ class MainScreenPresentation(
|
|||||||
stepChangeCallback(currentStep)
|
stepChangeCallback(currentStep)
|
||||||
|
|
||||||
setTopInfoVisible()
|
setTopInfoVisible()
|
||||||
//根据接口数据更新热量数据--------------------------
|
if (activity.settlementMode == 0) {
|
||||||
|
//判断是联合支付调用接口查询就餐信息后,再查询热量营养数据
|
||||||
|
loadOrderList(userId) {
|
||||||
|
loadUserNutritionData(userId)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//独立支队
|
||||||
|
loadUserNutritionData(userId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val step3Debouncer = Debouncer(10*1000)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据接口数据更新热量、营养数据
|
||||||
|
*/
|
||||||
|
private fun loadUserNutritionData(userId: String) {
|
||||||
userViewModel.getUserNutritionData(userId = userId) { nutrition ->
|
userViewModel.getUserNutritionData(userId = userId) { nutrition ->
|
||||||
activity.runOnUiThread {
|
activity.runOnUiThread {
|
||||||
if (nutrition == null) {
|
if (nutrition == null) {
|
||||||
@@ -316,11 +345,6 @@ class MainScreenPresentation(
|
|||||||
activity.hideWaitingDialog()
|
activity.hideWaitingDialog()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: 判断是联合支付调用接口查询就餐信息------------------------
|
|
||||||
if (activity.settlementMode == 0) {
|
|
||||||
loadOrderList(userId)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initView() {
|
private fun initView() {
|
||||||
@@ -417,7 +441,7 @@ class MainScreenPresentation(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var isLoadUnbilledMode = false
|
private var isLoadUnbilledMode = false
|
||||||
private val df by lazy { DecimalFormat("#.##") }
|
// private val df by lazy { DecimalFormat("#.##") }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 餐品识别成功,不计费模式
|
* 餐品识别成功,不计费模式
|
||||||
@@ -456,15 +480,20 @@ class MainScreenPresentation(
|
|||||||
|
|
||||||
//updateFoodInfo(foodInfo)
|
//updateFoodInfo(foodInfo)
|
||||||
binding.nutritionInclude.tvUserName.text = userNutrition?.name.maskName()
|
binding.nutritionInclude.tvUserName.text = userNutrition?.name.maskName()
|
||||||
val recommendCalorie = userNutrition?.recommendCalorie ?: 0.0
|
val recommendCalorie = (userNutrition?.recommendCalorie ?: 0.0).roundedDecimalPlace(1)
|
||||||
|
|
||||||
binding.nutritionInclude.tvRecommendHeat.text =
|
binding.nutritionInclude.tvRecommendHeat.text =
|
||||||
"推荐热量:${df.format(recommendCalorie)}kcal"
|
"推荐热量:${recommendCalorie.roundedDecimalPlace(1)}kcal"
|
||||||
// binding.nutritionInclude.tvRecommendHeat.text = "推荐热量:${recommendCalorie.removeTrailingZeros()}kcal"
|
// binding.nutritionInclude.tvRecommendHeat.text = "推荐热量:${recommendCalorie.removeTrailingZeros()}kcal"
|
||||||
//updateWeight(lastWeight / 1000)
|
//updateWeight(lastWeight / 1000)
|
||||||
// -------------------------------------------------
|
// -------------------------------------------------
|
||||||
// 删除userNutritionData,改为userNutrition
|
// 删除userNutritionData,改为userNutrition
|
||||||
calculateNutrition(recognitionWeight - lastWeight)
|
//0-即放即取,1-余量计量
|
||||||
|
mealPickupMode = SPUtil.getInstance().get(GlobalKey.KEY_PICKUP_MODE, 0) ?: 0
|
||||||
|
calculateNutrition(
|
||||||
|
if (mealPickupMode == 1) recognitionWeight - lastWeight
|
||||||
|
else recognitionWeight
|
||||||
|
)
|
||||||
binding.root.postDelayed({
|
binding.root.postDelayed({
|
||||||
isLoadUnbilledMode = false
|
isLoadUnbilledMode = false
|
||||||
}, 10000)
|
}, 10000)
|
||||||
@@ -672,10 +701,13 @@ class MainScreenPresentation(
|
|||||||
|
|
||||||
private var lastAddWeight = 0
|
private var lastAddWeight = 0
|
||||||
private fun addFoodToOrder(weight: Int, foodInfo: FoodInfo) {
|
private fun addFoodToOrder(weight: Int, foodInfo: FoodInfo) {
|
||||||
|
Log.d(TAG, "addFoodToOrder: ${weight == lastAddWeight}")
|
||||||
if (weight == lastAddWeight) return
|
if (weight == lastAddWeight) return
|
||||||
lastAddWeight = weight
|
lastAddWeight = weight
|
||||||
if (weight <= 10) {
|
if (weight <= 10) {
|
||||||
if (foodOrderList.isNotEmpty()) {
|
//0-即放即取,1-余量计量
|
||||||
|
mealPickupMode = SPUtil.getInstance().get(GlobalKey.KEY_PICKUP_MODE, 0) ?: 0
|
||||||
|
if (foodOrderList.isNotEmpty() && mealPickupMode == 1) {
|
||||||
val last = foodOrderList.last()
|
val last = foodOrderList.last()
|
||||||
if (last.isLocalData) {
|
if (last.isLocalData) {
|
||||||
foodOrderList.remove(last)
|
foodOrderList.remove(last)
|
||||||
@@ -687,8 +719,8 @@ class MainScreenPresentation(
|
|||||||
}
|
}
|
||||||
val foodPrice = if (isMember) foodInfo.vipPrice else foodInfo.specPrice
|
val foodPrice = if (isMember) foodInfo.vipPrice else foodInfo.specPrice
|
||||||
val eatNum = activity.getEatNum(weight.toDouble(), foodInfo.specWeight)
|
val eatNum = activity.getEatNum(weight.toDouble(), foodInfo.specWeight)
|
||||||
val price = eatNum * (foodPrice?:0.0)
|
val price = eatNum * (foodPrice ?: 0.0)
|
||||||
if (foodOrderList.isNotEmpty()) {
|
if (foodOrderList.isNotEmpty() && mealPickupMode == 1) {
|
||||||
val last = foodOrderList.last()
|
val last = foodOrderList.last()
|
||||||
if (last.isLocalData) {
|
if (last.isLocalData) {
|
||||||
last.eatNum = eatNum
|
last.eatNum = eatNum
|
||||||
@@ -699,7 +731,8 @@ class MainScreenPresentation(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foodOrderList.add(FoodItem(
|
foodOrderList.add(
|
||||||
|
FoodItem(
|
||||||
id = System.currentTimeMillis().toString(),
|
id = System.currentTimeMillis().toString(),
|
||||||
foodId = foodInfo.foodId,
|
foodId = foodInfo.foodId,
|
||||||
foodName = foodInfo.foodName,
|
foodName = foodInfo.foodName,
|
||||||
@@ -711,12 +744,27 @@ class MainScreenPresentation(
|
|||||||
num = weight,
|
num = weight,
|
||||||
eatNum = eatNum,
|
eatNum = eatNum,
|
||||||
isLocalData = true
|
isLocalData = true
|
||||||
))
|
)
|
||||||
|
)
|
||||||
foodOrderAdapter.submitList(foodOrderList)
|
foodOrderAdapter.submitList(foodOrderList)
|
||||||
|
Log.d(
|
||||||
|
TAG,
|
||||||
|
"addFoodToOrder: size=${foodOrderList.size},新增数据:${foodOrderList.last()}"
|
||||||
|
)
|
||||||
//foodOrderAdapter.notifyDataSetChanged()
|
//foodOrderAdapter.notifyDataSetChanged()
|
||||||
|
var eatWeightSum = 0
|
||||||
|
foodOrderList.forEach {
|
||||||
|
eatWeightSum += it.num
|
||||||
|
}
|
||||||
|
binding.detailInclude.tvTotalWeight.text = "总重量:${eatWeightSum}克"
|
||||||
|
Log.d(TAG, "addFoodToOrder: 更新总重量,新增数据------------------------------")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun calculateNutrition(value: Int) {
|
private fun calculateNutrition(value: Int) {
|
||||||
|
Log.d(
|
||||||
|
TAG,
|
||||||
|
"addFoodToOrder: weight = $value, recognitionWeight = $recognitionWeight foodInfo = $currentFood"
|
||||||
|
)
|
||||||
if (currentFood == null || userNutrition == null) {
|
if (currentFood == null || userNutrition == null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -751,6 +799,9 @@ class MainScreenPresentation(
|
|||||||
val fruitsVegetables = energy.fruitsVegetables
|
val fruitsVegetables = energy.fruitsVegetables
|
||||||
val meatEggs = energy.meatEggs
|
val meatEggs = energy.meatEggs
|
||||||
|
|
||||||
|
binding.detailInclude.tvTotalCalorie.text =
|
||||||
|
"总热量:${totalKcal.roundedDecimalPlace(1)}千卡"
|
||||||
|
|
||||||
val include = binding.nutritionInclude
|
val include = binding.nutritionInclude
|
||||||
|
|
||||||
// 设置热量---------------------------------------------------------------------
|
// 设置热量---------------------------------------------------------------------
|
||||||
@@ -769,7 +820,7 @@ class MainScreenPresentation(
|
|||||||
// 避免0作为被除数
|
// 避免0作为被除数
|
||||||
maxKcal = if (maxKcal <= 0.0) 1.0 else maxKcal
|
maxKcal = if (maxKcal <= 0.0) 1.0 else maxKcal
|
||||||
Timber.tag(TAG).d("maxKcal 1 = $maxKcal")
|
Timber.tag(TAG).d("maxKcal 1 = $maxKcal")
|
||||||
include.totalKcalTv.text = totalKcal.format2String(2)
|
include.totalKcalTv.text = totalKcal.roundedDecimalPlace(1).toString()
|
||||||
var totalKcalHeight = (totalKcal / maxKcal).toFloat()
|
var totalKcalHeight = (totalKcal / maxKcal).toFloat()
|
||||||
if (totalKcalHeight == 0F) {
|
if (totalKcalHeight == 0F) {
|
||||||
include.divKcalView.visible()
|
include.divKcalView.visible()
|
||||||
@@ -787,7 +838,7 @@ class MainScreenPresentation(
|
|||||||
)
|
)
|
||||||
val grainIndex = UserNutritionUtils.findCalorieIndex(energy.grain, grainArray)
|
val grainIndex = UserNutritionUtils.findCalorieIndex(energy.grain, grainArray)
|
||||||
include.customFoodColumn.setImageDrawable(false, grainIndex)
|
include.customFoodColumn.setImageDrawable(false, grainIndex)
|
||||||
include.totalFoodTv.text = grain.format2String(2)
|
include.totalFoodTv.text = grain.roundedDecimalPlace(1).toString()
|
||||||
columnMax = if (columnMax <= 0.0) 1.0 else columnMax
|
columnMax = if (columnMax <= 0.0) 1.0 else columnMax
|
||||||
var grainHeight = (grain / columnMax).toFloat()
|
var grainHeight = (grain / columnMax).toFloat()
|
||||||
if (grainHeight == 0F) {
|
if (grainHeight == 0F) {
|
||||||
@@ -807,7 +858,7 @@ class MainScreenPresentation(
|
|||||||
val fruitsIndex =
|
val fruitsIndex =
|
||||||
UserNutritionUtils.findCalorieIndex(energy.fruitsVegetables, fruitsArray)
|
UserNutritionUtils.findCalorieIndex(energy.fruitsVegetables, fruitsArray)
|
||||||
include.customVegetableColumn.setImageDrawable(false, fruitsIndex)
|
include.customVegetableColumn.setImageDrawable(false, fruitsIndex)
|
||||||
include.totalVegetableTv.text = fruitsVegetables.format2String(2)
|
include.totalVegetableTv.text = fruitsVegetables.roundedDecimalPlace(1).toString()
|
||||||
var fruitsHeight = (fruitsVegetables / columnMax).toFloat()
|
var fruitsHeight = (fruitsVegetables / columnMax).toFloat()
|
||||||
if (fruitsHeight == 0F) {
|
if (fruitsHeight == 0F) {
|
||||||
include.divVegetableView.visible()
|
include.divVegetableView.visible()
|
||||||
@@ -826,7 +877,7 @@ class MainScreenPresentation(
|
|||||||
val meatEggsIndex =
|
val meatEggsIndex =
|
||||||
UserNutritionUtils.findCalorieIndex(energy.meatEggs, meatEggsArray)
|
UserNutritionUtils.findCalorieIndex(energy.meatEggs, meatEggsArray)
|
||||||
include.customMeatColumn.setImageDrawable(false, meatEggsIndex)
|
include.customMeatColumn.setImageDrawable(false, meatEggsIndex)
|
||||||
include.totalMeatTv.text = meatEggs.format2String(2)
|
include.totalMeatTv.text = meatEggs.roundedDecimalPlace(1).toString()
|
||||||
var meatHeight = (meatEggs / columnMax).toFloat()
|
var meatHeight = (meatEggs / columnMax).toFloat()
|
||||||
if (meatHeight == 0F) {
|
if (meatHeight == 0F) {
|
||||||
include.divMeatView.visible()
|
include.divMeatView.visible()
|
||||||
@@ -885,6 +936,7 @@ class MainScreenPresentation(
|
|||||||
recognizeViewModel.onPreviewFrame(ByteArray(1382400), true)
|
recognizeViewModel.onPreviewFrame(ByteArray(1382400), true)
|
||||||
//triggerReidentify()
|
//triggerReidentify()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重置人脸跟踪状态,让已在画面中的人脸重新触发识别
|
* 重置人脸跟踪状态,让已在画面中的人脸重新触发识别
|
||||||
* 适用场景:切换按钮后需要重新识别当前画面中的人脸
|
* 适用场景:切换按钮后需要重新识别当前画面中的人脸
|
||||||
@@ -900,6 +952,7 @@ class MainScreenPresentation(
|
|||||||
// isRecognition 保持 true,相机继续送帧,下一帧真实人脸会产生新 trackId
|
// isRecognition 保持 true,相机继续送帧,下一帧真实人脸会产生新 trackId
|
||||||
recognizeViewModel.onPreviewFrame(ByteArray(1382400), true)
|
recognizeViewModel.onPreviewFrame(ByteArray(1382400), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var recognizeTime = 0L
|
private var recognizeTime = 0L
|
||||||
private fun initArcViewModel() {
|
private fun initArcViewModel() {
|
||||||
recognizeViewModel.setLiveType(livenessType)
|
recognizeViewModel.setLiveType(livenessType)
|
||||||
@@ -1385,7 +1438,7 @@ class MainScreenPresentation(
|
|||||||
* 加载订单列表
|
* 加载订单列表
|
||||||
*/
|
*/
|
||||||
@SuppressLint("NotifyDataSetChanged", "SetTextI18n")
|
@SuppressLint("NotifyDataSetChanged", "SetTextI18n")
|
||||||
private fun loadOrderList(userId: String) {
|
private fun loadOrderList(userId: String, callback: () -> Unit) {
|
||||||
binding.llTopInfo.gone()
|
binding.llTopInfo.gone()
|
||||||
binding.flFoodDetail.visible()
|
binding.flFoodDetail.visible()
|
||||||
binding.detailInclude.let {
|
binding.detailInclude.let {
|
||||||
@@ -1403,13 +1456,17 @@ class MainScreenPresentation(
|
|||||||
activity.runOnUiThread {
|
activity.runOnUiThread {
|
||||||
if (model == null) return@runOnUiThread
|
if (model == null) return@runOnUiThread
|
||||||
foodOrderList.clear()
|
foodOrderList.clear()
|
||||||
foodOrderList.addAll(model.list?:emptyList())
|
foodOrderList.addAll(model.list ?: emptyList())
|
||||||
foodOrderAdapter.submitList(foodOrderList)
|
foodOrderAdapter.submitList(foodOrderList)
|
||||||
//foodOrderAdapter.notifyDataSetChanged()
|
//foodOrderAdapter.notifyDataSetChanged()
|
||||||
binding.detailInclude.tvTotalWeight.text = "总重量:${model.eatWeightSum}克"
|
binding.detailInclude.tvTotalWeight.text = "总重量:${model.eatWeightSum}克"
|
||||||
|
Log.d(TAG, "addFoodToOrder: 更新总重量,订单列表------------------------------")
|
||||||
binding.detailInclude.tvTotalCalorie.text =
|
binding.detailInclude.tvTotalCalorie.text =
|
||||||
"总热量:${model.calorie.roundToInt()}千卡"
|
"总热量:${model.calorie.roundedDecimalPlace(1)}千卡"
|
||||||
jointPaymentQueryFinish = true
|
jointPaymentQueryFinish = true
|
||||||
|
|
||||||
|
//重新加载营养信息
|
||||||
|
callback()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,13 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<!-- 菜品名称列,权重2.5 -->
|
<!-- 菜品名称列,权重2.5 -->
|
||||||
<LinearLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="2.1"
|
android:layout_weight="2.1"
|
||||||
@@ -15,13 +16,21 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvFoodName"
|
android:id="@+id/tvFoodName"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
tools:text="菜品名称"
|
tools:text="菜品名称"
|
||||||
android:textColor="#FF889AC2"
|
android:textColor="#FF889AC2"
|
||||||
android:textSize="25sp"
|
android:textSize="25sp"
|
||||||
android:paddingHorizontal="5dp"
|
android:paddingHorizontal="5dp"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
|
android:ellipsize="end"
|
||||||
|
app:layout_constraintHorizontal_chainStyle="packed"
|
||||||
|
app:layout_constraintWidth_default="wrap"
|
||||||
|
app:layout_constraintHorizontal_bias="0"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/tvLabel"
|
||||||
android:gravity="center_vertical|start" />
|
android:gravity="center_vertical|start" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -34,9 +43,14 @@
|
|||||||
android:background="@drawable/bg_order_flag"
|
android:background="@drawable/bg_order_flag"
|
||||||
android:paddingHorizontal="5dp"
|
android:paddingHorizontal="5dp"
|
||||||
android:paddingVertical="1dp"
|
android:paddingVertical="1dp"
|
||||||
|
android:layout_marginHorizontal="2dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/tvFoodName"
|
||||||
android:visibility="gone"/>
|
android:visibility="gone"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<!-- 规格列,权重1.0 -->
|
<!-- 规格列,权重1.0 -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|||||||
Reference in New Issue
Block a user