fix(activity): 修复 PrepareCookActivity 相机未就绪时触发拍照导致报错的问题
This commit is contained in:
@@ -160,12 +160,14 @@ class PrepareCookActivity : BaseActivity() {
|
||||
|
||||
private val isTakingPhoto = AtomicBoolean(false)
|
||||
private var lastWeight = 0.0
|
||||
private var currentWeight = 0.0
|
||||
|
||||
/**
|
||||
* 重量稳定时触发菜品识别
|
||||
* @param weight 当前稳定重量
|
||||
*/
|
||||
private fun recognizeFood(weight: Double) {
|
||||
this.currentWeight = weight
|
||||
if (weight < WEIGHT_RECOGNIZE_VALUE) {
|
||||
if (recognizeDialog.isShowing) recognizeDialog.dismiss()
|
||||
return
|
||||
@@ -176,7 +178,6 @@ class PrepareCookActivity : BaseActivity() {
|
||||
succCallback = cameraSuccessCallback,
|
||||
failCallback = cameraFailureCallback
|
||||
)
|
||||
lastWeight = weight
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -500,6 +501,7 @@ class PrepareCookActivity : BaseActivity() {
|
||||
}
|
||||
recognizeDialog.loadData(foodList)
|
||||
isTakingPhoto.set(false)
|
||||
lastWeight = currentWeight
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user