实现了热量值计算

This commit is contained in:
zxj
2025-08-04 18:02:45 +08:00
parent 5ae72cdf04
commit c6badf2ca7
14 changed files with 431 additions and 32 deletions
@@ -54,6 +54,7 @@ class MainActivity : AppCompatActivity() {
private var checkedItem: FoodInfo? = null
private var imageAnalysis: ImageAnalysis? = null
private var cameraProviderFuture: ListenableFuture<ProcessCameraProvider>? = null
private var canIdentify: Boolean = true
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -156,14 +157,15 @@ class MainActivity : AppCompatActivity() {
}
}
viewModel.getIdentifiedFoodList()
// SensorScaleUtils.startScale { weight ->
SensorScaleUtils.startScale { weight ->
// Timber.d("weight = $weight")
// if (weight > 0.0) {
// if (canIndentify) {
// viewModel.getIdentifiedFoodList()
// }
// }
// }
if (weight > 0.0) {
if (canIdentify) {
canIdentify = false
viewModel.getIdentifiedFoodList()
}
}
}
}
private fun createAdapter(): GenericItemAdapter<FoodInfo, ItemFoodInfoBinding> {