diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 490c2dd..2883039 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -61,7 +61,8 @@
+ android:theme="@style/Theme.AppCompat.Light.NoActionBar"
+ android:launchMode="singleTask" />
() {
binding.ivImg.load(imgUrl)
}
+ /**
+ * 联合支付-即放即取模式
+ */
+ private fun loadJFJQBySettlement(weight: Int) {
+ //即放即取+联合支付人脸查询订单完成
+ if (presentation!!.jointPaymentQueryFinish) {
+ if (weight > WEIGHT_RESET_RECOGNIZE) {
+ //已识别完成人脸并查询到订单数据,增加重量不再重新识别
+ return
+ }
+ //重量小于等于5克时改为识别中页面
+ isAnalyzing = false
+ presentation?.step1FoodRecognizing()
+ return
+ }
+ if (weight <= WEIGHT_RESET_RECOGNIZE) {
+ //秤上重量过下,显示识别中页面
+ presentation?.step1FoodRecognizing()
+ return
+ }
+// val isWeightChange = abs(weight - lastWeight) > 0.02
+ val isWeightChange = weight - lastWeight > WEIGHT_CHANGE_VALUE
+ if (weight != lastWeight) {
+ log("recognizeByWeight---00001,weight=$weight,lastWeight=$lastWeight,isWeightChange=$isWeightChange")
+ }
+ recognizeByWeight(weight, isWeightChange)
+ }
+
+ /**
+ * 联合支付-余量计量模式
+ */
+ private fun loadYLJLBySettlement(weight: Int) {
+ if (weight <= WEIGHT_RESET_RECOGNIZE) {
+ //秤上重量过小,显示识别中页面
+ presentation?.step1FoodRecognizing()
+ return
+ }
+ //余量计量+联合支付人脸查询订单完成
+ if (presentation!!.jointPaymentQueryFinish) {
+ presentation?.updateWeight(weight)
+ return
+ }
+ val isWeightChange = weight - lastWeight > WEIGHT_CHANGE_VALUE
+ recognizeByWeight(weight, isWeightChange)
+ }
+
private fun readWeight(weight: Int) {
log("registerDataChange weight = $weight")
- //runOnUiThread { binding.tvShowWeight.text="${weight*1000}克" }
+ runOnUiThread {
+ binding.tvShowWeight.let {
+ if (it.text.toString() == weight.toString()) return@runOnUiThread
+ it.text = "$weight"
+ }
+ }
if (settlementMode == 0) {
//联合支付-------------------------------------------
//0-即放即取,1-余量计量
val mealPickupMode = SPUtil.getInstance().get(GlobalKey.KEY_PICKUP_MODE, 0) ?: 0
if (mealPickupMode == 1) {
+ loadYLJLBySettlement(weight)
return
}
- //即放即取+联合支付人脸查询订单完成
- if (presentation!!.jointPaymentQueryFinish) {
- if (weight > WEIGHT_RESET_RECOGNIZE) {
- //已识别完成人脸并查询到订单数据,增加重量不再重新识别
- return
- }
- //重量小于等于5克时改为识别中页面
- isAnalyzing = false
- presentation?.step1FoodRecognizing()
- return
- }
- if (weight <= WEIGHT_RESET_RECOGNIZE) {
- //秤上重量过下,显示识别中页面
- presentation?.step1FoodRecognizing()
- return
- }
-// val isWeightChange = abs(weight - lastWeight) > 0.02
- val isWeightChange = weight - lastWeight > WEIGHT_CHANGE_VALUE
- if (weight != lastWeight) {
- log("recognizeByWeight---00001,weight=$weight,lastWeight=$lastWeight,isWeightChange=$isWeightChange")
- }
- recognizeByWeight(weight, isWeightChange)
+ loadJFJQBySettlement(weight)
return
}
+
//独立支付-------------------------------------------
if (lastWeight - weight > 5) {
//及放及取,从秤上拿走超过5克
@@ -305,11 +337,7 @@ class MainActivity : BaseActivity() {
}
return
}
-// val isWeightChange = abs(weight - lastWeight) > 0.02
val isWeightChange = weight - lastWeight > WEIGHT_CHANGE_VALUE
- if (weight != lastWeight) {
- log("recognizeByWeight---00001,weight=$weight,lastWeight=$lastWeight,isWeightChange=$isWeightChange")
- }
recognizeByWeight(weight, isWeightChange)
}
@@ -321,6 +349,10 @@ class MainActivity : BaseActivity() {
}
private fun recognizeByWeight(weight: Int, isWeightChange: Boolean, block: () -> Unit = {}) {
+ if (weight != lastWeight) {
+ val payTypeDesc = if (settlementMode == 0) "联合支付" else "独立支付"
+ log("readWeight-${payTypeDesc},weight=$weight,lastWeight=$lastWeight,isWeightChange=$isWeightChange")
+ }
presentation?.updateWeight(weight)
if (weight <= WEIGHT_RESET_RECOGNIZE) {
@@ -642,6 +674,7 @@ class MainActivity : BaseActivity() {
//已显示副屏,则进行更新
val weight = lastWeight
lastWeight = 0
+ presentation?.pauseCamera()
presentation?.hideRecImage()
presentation?.step1FoodRecognizing()
@@ -690,10 +723,6 @@ class MainActivity : BaseActivity() {
lastTouchTime = System.currentTimeMillis()
}
- fun joinPayment() {
-
- }
-
fun createOrder(
foodInfo: FoodInfo,
foodWeight: Int,
diff --git a/app/src/main/java/com/sw/dualscreen/adapter/FoodOrderAdapter.kt b/app/src/main/java/com/sw/dualscreen/adapter/FoodOrderAdapter.kt
index 755a580..06898bf 100644
--- a/app/src/main/java/com/sw/dualscreen/adapter/FoodOrderAdapter.kt
+++ b/app/src/main/java/com/sw/dualscreen/adapter/FoodOrderAdapter.kt
@@ -35,7 +35,7 @@ class FoodOrderAdapter(var list: MutableList) :
binding.tvFoodName.text = it.foodName
val foodPrice = it.foodPrice.format2String(2)
if (it.orderFrom == 2) {
- binding.tvPriceNorm.text = "${it.specName}-${it.specWeight}克"
+ binding.tvPriceNorm.text = "${it.specName}/${it.specWeight}克"
} else {
binding.tvPriceNorm.text = "${foodPrice}/${it.num}克"
}
diff --git a/app/src/main/java/com/sw/dualscreen/presentation/MainScreenPresentation.kt b/app/src/main/java/com/sw/dualscreen/presentation/MainScreenPresentation.kt
index 743ef23..86c010b 100644
--- a/app/src/main/java/com/sw/dualscreen/presentation/MainScreenPresentation.kt
+++ b/app/src/main/java/com/sw/dualscreen/presentation/MainScreenPresentation.kt
@@ -1220,18 +1220,21 @@ class MainScreenPresentation(
isMember = false
//ToastUtils.showToast("isKeepFaceState=$isKeepFaceState,mealPickupMode=$mealPickupMode")
//|| isKeepFaceState
- if (activity.settlementMode == 0) {
- activity.isAnalyzing = false
- step1FoodRecognizing()
- } else {
+// if (activity.settlementMode == 0) {
+// activity.isAnalyzing = false
+// step1FoodRecognizing()
+// } else {
if (mealPickupMode == 1) {
step2FaceRecognizing(currentFood!!)
isKeepFaceState = false
+ if (activity.settlementMode == 0) {
+ setTopInfoVisible()
+ }
} else {
activity.isAnalyzing = false
step1FoodRecognizing()
}
- }
+// }
})
}
}
@@ -1263,11 +1266,15 @@ class MainScreenPresentation(
// foodWeight = lastWeight
//)
//userViewModel.postUserNutritionData(listOf(userNutritionParam))
+ val realWeight = eatWeight.toDouble()
+ val specWeight = currentFood!!.specWeight
+ val eatNum = activity.getEatNum(realWeight, specWeight)
+ activity.log("createOrder,realWeight=$realWeight,specWeight=$specWeight")
activity.createOrder(
foodInfo = currentFood!!,
foodWeight = lastWeight,
eatWeight = eatWeight,
- eatNum = activity.getEatNum(eatWeight.toDouble(), currentFood!!.specWeight),
+ eatNum = eatNum,
userId = currentUserId,
isMember = isMember,
notEnoughOneBlock = notEnoughOneBlock,
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index ec1a727..094bbcb 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -48,19 +48,22 @@
android:textColor="#FF0A1428"
android:textSize="52sp"
android:textStyle="bold" />
-
-
-
-
-
-
-
+
+
+