优化
This commit is contained in:
@@ -451,10 +451,15 @@ class MainScreenPresentation(
|
||||
isLoadUnbilledMode = false
|
||||
}, 10000)
|
||||
|
||||
//上次已经识别过人脸
|
||||
step3ShowRecognizeResult(currentUserId!!)
|
||||
if (isAgainLoadData.not()) {
|
||||
//上次已经识别过人脸
|
||||
step3ShowRecognizeResult(currentUserId!!)
|
||||
isAgainLoadData = true
|
||||
}
|
||||
}
|
||||
|
||||
public var isAgainLoadData = false
|
||||
|
||||
private var isFirstOpen = true
|
||||
var startTime = 0L
|
||||
|
||||
@@ -673,9 +678,7 @@ class MainScreenPresentation(
|
||||
var maxKcal = userNutrition?.maxCalorie ?: 1.0
|
||||
Timber.tag(TAG).d("maxKcal = $maxKcal")
|
||||
// 避免0作为被除数
|
||||
if (maxKcal <= 0.0) {
|
||||
maxKcal = 1.0
|
||||
}
|
||||
maxKcal = if (maxKcal <= 0.0) 1.0 else maxKcal
|
||||
Timber.tag(TAG).d("maxKcal 1 = $maxKcal")
|
||||
include.totalKcalTv.text = totalKcal.format2String(2)
|
||||
var totalKcalHeight = (totalKcal / maxKcal).toFloat()
|
||||
@@ -696,6 +699,7 @@ class MainScreenPresentation(
|
||||
val grainIndex = UserNutritionUtils.findCalorieIndex(energy.grain, grainArray)
|
||||
include.customFoodColumn.setImageDrawable(false, grainIndex)
|
||||
include.totalFoodTv.text = grain.format2String(2)
|
||||
columnMax = if (columnMax <= 0.0) 1.0 else columnMax
|
||||
var grainHeight = (grain / columnMax).toFloat()
|
||||
if (grainHeight == 0F) {
|
||||
include.divTotalFoodView.visible()
|
||||
@@ -716,7 +720,6 @@ class MainScreenPresentation(
|
||||
include.customVegetableColumn.setImageDrawable(false, fruitsIndex)
|
||||
include.totalVegetableTv.text = fruitsVegetables.format2String(2)
|
||||
var fruitsHeight = (fruitsVegetables / columnMax).toFloat()
|
||||
|
||||
if (fruitsHeight == 0F) {
|
||||
include.divVegetableView.visible()
|
||||
} else {
|
||||
@@ -852,6 +855,7 @@ class MainScreenPresentation(
|
||||
val faceEntity = compareResult.faceEntity
|
||||
val userId = faceEntity.userName
|
||||
currentUserId = userId
|
||||
isAgainLoadData = false
|
||||
if (userId == null) return@Observer
|
||||
//ToastUtils.showToast("人脸识别成功,userId = $userId")
|
||||
if (currentFood == null) {
|
||||
|
||||
Reference in New Issue
Block a user