优化
This commit is contained in:
@@ -377,7 +377,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
showWaitingDialog("识别中,请稍后……")
|
||||
takePhoto(
|
||||
successCallback = { photoUri ->
|
||||
Thread{
|
||||
Thread {
|
||||
onTakePhotoSuccess(photoUri)
|
||||
}.start()
|
||||
failCount = 0
|
||||
@@ -766,22 +766,22 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
eatWeight: Int,
|
||||
eatNum: Int,
|
||||
userId: String?,
|
||||
notEnoughOneBlock: ()-> Unit = {},
|
||||
notEnoughOneBlock: () -> Unit = {},
|
||||
block: () -> Unit
|
||||
) {
|
||||
Timber.tag(TAG).d("foodWeight=$foodWeight,eatWeight=$eatWeight")
|
||||
val pickupMode = SPUtil.getInstance().get(GlobalKey.KEY_PICKUP_MODE, 0) ?: 0
|
||||
if (pickupMode == 0) {
|
||||
if (foodWeight <= 5) {
|
||||
ToastUtils.showToast("餐品重量不足")
|
||||
return
|
||||
}
|
||||
if (eatWeight <= 5) {
|
||||
ToastUtils.showToast("取餐重量过小")
|
||||
return
|
||||
}
|
||||
}
|
||||
if (eatNum == 0) {
|
||||
// if (pickupMode == 0) {
|
||||
// if (foodWeight <= 5) {
|
||||
// ToastUtils.showToast("餐品重量不足")
|
||||
// return
|
||||
// }
|
||||
// if (eatWeight <= 5) {
|
||||
// ToastUtils.showToast("取餐重量过小")
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
if (eatNum <= 0) {
|
||||
ToastUtils.showToast("您好,当前重量不足一份")
|
||||
notEnoughOneBlock()
|
||||
return
|
||||
@@ -803,9 +803,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
//即放即取-1,称重-2
|
||||
mode = if (pickupMode == 1) 1 else 2
|
||||
)
|
||||
debouncer.debounce {
|
||||
submitOrder(order, block)
|
||||
}
|
||||
submitOrder(order, block)
|
||||
}
|
||||
|
||||
private fun submitOrder(order: FoodOrder, block: () -> Unit) {
|
||||
@@ -822,7 +820,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
|
||||
if (checkedItem!!.isFromSearch == true) {
|
||||
//当前菜名为手动搜索选择,非识别结果,保存向量数据
|
||||
Thread{
|
||||
Thread {
|
||||
saveFoodVector(checkedItem!!)
|
||||
}.start()
|
||||
}
|
||||
@@ -832,7 +830,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
}
|
||||
|
||||
fun getEatNum(realWeight: Double?, specWeight: Double?): Int {
|
||||
if (realWeight == null || realWeight == 0.0 || specWeight == null || specWeight == 0.0) return 1
|
||||
if (realWeight == null || realWeight <= 0.0 || specWeight == null || specWeight <= 0.0) return 0
|
||||
return (realWeight / specWeight).roundToInt()
|
||||
}
|
||||
|
||||
@@ -905,6 +903,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
//余量计量
|
||||
eatWeight = (recognizeWeight - lastWeight) * 1000
|
||||
foodWeight = recognizeWeight * 1000
|
||||
Timber.d("eatWeight=$eatWeight, recognizeWeight=$recognizeWeight, lastWeight=$lastWeight")
|
||||
}
|
||||
} else {
|
||||
//不计费
|
||||
@@ -1229,7 +1228,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
val file = BitmapSaver.saveToAppFilesDir(
|
||||
bitmap, this, "IMG_CROP_${System.currentTimeMillis()}.jpg"
|
||||
)
|
||||
Timber.tag(TAG).d("main,saveToAppFilesDir耗时:${System.currentTimeMillis() - startTime}")
|
||||
Timber.tag(TAG)
|
||||
.d("main,saveToAppFilesDir耗时:${System.currentTimeMillis() - startTime}")
|
||||
startTime = System.currentTimeMillis()
|
||||
Timber.d("registerDataChange photoUri bitmap保存文件路径:${file?.absolutePath}")
|
||||
//val nameList = FoodModule.queryFood(bitmap)
|
||||
|
||||
Reference in New Issue
Block a user