This commit is contained in:
mazengfei
2026-04-01 17:11:00 +08:00
parent 3ef93c5f5e
commit 12da153df3
@@ -102,7 +102,7 @@ class MainScreenPresentation(
// private var userNutritionData: UserNutritionData? = null // private var userNutritionData: UserNutritionData? = null
private var userNutrition: UserNutrition? = null private var userNutrition: UserNutrition? = null
private var dinnerTypeInfo: DinnerType? = null private var dinnerTypeInfo: DinnerType? = null
private val debouncer = Debouncer(3000) private val debouncer = Debouncer(1500)
private var recognitionTime: Long = 0L // 人脸识别时的时间 private var recognitionTime: Long = 0L // 人脸识别时的时间
var recognitionWeight: Int = 0 // 人脸识别时的重量 var recognitionWeight: Int = 0 // 人脸识别时的重量
@@ -771,14 +771,14 @@ class MainScreenPresentation(
if (currentFood == null || userNutrition == null) { if (currentFood == null || userNutrition == null) {
return return
} }
debouncer.debounce { var weight = value
var weight = value if (weight < 0) weight = 0
if (weight < 0) weight = 0 if (activity.settlementMode == 0) {
if (activity.settlementMode == 0) { activity.runOnUiThread {
activity.runOnUiThread { addFoodToOrder(weight, currentFood!!)
addFoodToOrder(weight, currentFood!!)
}
} }
}
debouncer.debounce {
Timber.tag(TAG) Timber.tag(TAG)
.d("calculateNutrition weight = $weight, recognitionWeight = $recognitionWeight") .d("calculateNutrition weight = $weight, recognitionWeight = $recognitionWeight")
val dinnerType = dinnerTypeInfo?.dinnerType val dinnerType = dinnerTypeInfo?.dinnerType