fix(main): 优化重量识别逻辑与日志;防抖时间调整为2s;从版本控制中移除.idea和objectbox-models
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
dbe3753821
commit
0127697560
+3
-6
@@ -1,15 +1,12 @@
|
|||||||
*.iml
|
*.iml
|
||||||
.gradle
|
.gradle
|
||||||
/local.properties
|
/local.properties
|
||||||
/.idea/caches
|
/.idea/
|
||||||
/.idea/libraries
|
|
||||||
/.idea/modules.xml
|
|
||||||
/.idea/workspace.xml
|
|
||||||
/.idea/navEditor.xml
|
|
||||||
/.idea/assetWizardSettings.xml
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
/build
|
/build
|
||||||
/captures
|
/captures
|
||||||
.externalNativeBuild
|
.externalNativeBuild
|
||||||
.cxx
|
.cxx
|
||||||
local.properties
|
local.properties
|
||||||
|
app/objectbox-models/*.json
|
||||||
|
app/objectbox-models/*.json.bak
|
||||||
|
|||||||
Generated
-3
@@ -1,3 +0,0 @@
|
|||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
Generated
-1
@@ -1 +0,0 @@
|
|||||||
DualScreen
|
|
||||||
Generated
-6
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="AndroidProjectSystem">
|
|
||||||
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
Generated
-6
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="CompilerConfiguration">
|
|
||||||
<bytecodeTargetLevel target="17" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
Generated
-18
@@ -1,18 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="deploymentTargetSelector">
|
|
||||||
<selectionStates>
|
|
||||||
<SelectionState runConfigName="app">
|
|
||||||
<option name="selectionMode" value="DROPDOWN" />
|
|
||||||
<DropdownSelection timestamp="2026-03-20T06:04:19.673022300Z">
|
|
||||||
<Target type="DEFAULT_BOOT">
|
|
||||||
<handle>
|
|
||||||
<DeviceId pluginId="Default" identifier="serial=192.168.1.16:5555;connection=571832d0" />
|
|
||||||
</handle>
|
|
||||||
</Target>
|
|
||||||
</DropdownSelection>
|
|
||||||
<DialogSelection />
|
|
||||||
</SelectionState>
|
|
||||||
</selectionStates>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
Generated
-13
@@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="DeviceTable">
|
|
||||||
<option name="columnSorters">
|
|
||||||
<list>
|
|
||||||
<ColumnSorterState>
|
|
||||||
<option name="column" value="Name" />
|
|
||||||
<option name="order" value="ASCENDING" />
|
|
||||||
</ColumnSorterState>
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
Generated
-20
@@ -1,20 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
|
||||||
<component name="GradleSettings">
|
|
||||||
<option name="linkedExternalProjectsSettings">
|
|
||||||
<GradleProjectSettings>
|
|
||||||
<option name="testRunner" value="CHOOSE_PER_TEST" />
|
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
|
||||||
<option name="gradleJvm" value="azul-17" />
|
|
||||||
<option name="modules">
|
|
||||||
<set>
|
|
||||||
<option value="$PROJECT_DIR$" />
|
|
||||||
<option value="$PROJECT_DIR$/app" />
|
|
||||||
<option value="$PROJECT_DIR$/lib_face" />
|
|
||||||
</set>
|
|
||||||
</option>
|
|
||||||
</GradleProjectSettings>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
-6
@@ -1,6 +0,0 @@
|
|||||||
<component name="InspectionProjectProfileManager">
|
|
||||||
<profile version="1.0">
|
|
||||||
<option name="myName" value="Project Default" />
|
|
||||||
<inspection_tool class="UsePropertyAccessSyntax" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
|
||||||
</profile>
|
|
||||||
</component>
|
|
||||||
Generated
-10
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="MaterialThemeProjectNewConfig">
|
|
||||||
<option name="metadata">
|
|
||||||
<MTProjectMetadataState>
|
|
||||||
<option name="userId" value="29face46:19ce5e8d9d0:-7fe0" />
|
|
||||||
</MTProjectMetadataState>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
Generated
-10
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectMigrations">
|
|
||||||
<option name="MigrateToGradleLocalJavaHome">
|
|
||||||
<set>
|
|
||||||
<option value="$PROJECT_DIR$" />
|
|
||||||
</set>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
Generated
-9
@@ -1,9 +0,0 @@
|
|||||||
<project version="4">
|
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="zulu-17" project-jdk-type="JavaSDK">
|
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectType">
|
|
||||||
<option name="id" value="Android" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
Generated
-17
@@ -1,17 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="RunConfigurationProducerService">
|
|
||||||
<option name="ignoredProducers">
|
|
||||||
<set>
|
|
||||||
<option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
|
|
||||||
<option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
|
|
||||||
<option value="com.intellij.execution.junit.PatternConfigurationProducer" />
|
|
||||||
<option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
|
|
||||||
<option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
|
|
||||||
<option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
|
|
||||||
<option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
|
|
||||||
<option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
|
|
||||||
</set>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
Generated
-6
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
{
|
|
||||||
"_note1": "KEEP THIS FILE! Check it into a version control system (VCS) like git.",
|
|
||||||
"_note2": "ObjectBox manages crucial IDs for your object model. See docs for details.",
|
|
||||||
"_note3": "If you have VCS merge conflicts, you must resolve them according to ObjectBox docs.",
|
|
||||||
"entities": [
|
|
||||||
{
|
|
||||||
"id": "1:594331511073099531",
|
|
||||||
"lastPropertyId": "11:7949771231314213889",
|
|
||||||
"name": "Food",
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"id": "1:2317727855243736226",
|
|
||||||
"name": "id",
|
|
||||||
"type": 6,
|
|
||||||
"flags": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "4:1528837175750321569",
|
|
||||||
"name": "foodVector",
|
|
||||||
"indexId": "1:6010838397086628487",
|
|
||||||
"type": 28,
|
|
||||||
"flags": 8
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "5:5561277398349179032",
|
|
||||||
"name": "collectId",
|
|
||||||
"type": 9
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "6:8313847979709019172",
|
|
||||||
"name": "foodId",
|
|
||||||
"type": 9
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "7:1375536603452792462",
|
|
||||||
"name": "foodName",
|
|
||||||
"type": 9
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "8:7942065542192169896",
|
|
||||||
"name": "version",
|
|
||||||
"type": 9
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "9:4394472487596452023",
|
|
||||||
"name": "otherField",
|
|
||||||
"type": 9
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "10:5704890122356491756",
|
|
||||||
"name": "createTime",
|
|
||||||
"type": 9
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "11:7949771231314213889",
|
|
||||||
"name": "isDel",
|
|
||||||
"type": 1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"relations": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"lastEntityId": "1:594331511073099531",
|
|
||||||
"lastIndexId": "1:6010838397086628487",
|
|
||||||
"lastRelationId": "0:0",
|
|
||||||
"lastSequenceId": "0:0",
|
|
||||||
"modelVersion": 5,
|
|
||||||
"modelVersionParserMinimum": 5,
|
|
||||||
"retiredEntityUids": [],
|
|
||||||
"retiredIndexUids": [],
|
|
||||||
"retiredPropertyUids": [
|
|
||||||
340951913928211738,
|
|
||||||
5484846939472684412
|
|
||||||
],
|
|
||||||
"retiredRelationUids": [],
|
|
||||||
"version": 1
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
{
|
|
||||||
"_note1": "KEEP THIS FILE! Check it into a version control system (VCS) like git.",
|
|
||||||
"_note2": "ObjectBox manages crucial IDs for your object model. See docs for details.",
|
|
||||||
"_note3": "If you have VCS merge conflicts, you must resolve them according to ObjectBox docs.",
|
|
||||||
"entities": [
|
|
||||||
{
|
|
||||||
"id": "1:594331511073099531",
|
|
||||||
"lastPropertyId": "11:7949771231314213889",
|
|
||||||
"name": "Food",
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"id": "1:2317727855243736226",
|
|
||||||
"name": "id",
|
|
||||||
"type": 6,
|
|
||||||
"flags": 1
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "4:1528837175750321569",
|
|
||||||
"name": "foodVector",
|
|
||||||
"indexId": "1:6010838397086628487",
|
|
||||||
"type": 28,
|
|
||||||
"flags": 8
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "5:5561277398349179032",
|
|
||||||
"name": "collectId",
|
|
||||||
"type": 9
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "6:8313847979709019172",
|
|
||||||
"name": "foodId",
|
|
||||||
"type": 9
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "7:1375536603452792462",
|
|
||||||
"name": "foodName",
|
|
||||||
"type": 9
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "8:7942065542192169896",
|
|
||||||
"name": "version",
|
|
||||||
"type": 9
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "9:4394472487596452023",
|
|
||||||
"name": "otherField",
|
|
||||||
"type": 9
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "10:5704890122356491756",
|
|
||||||
"name": "createTime",
|
|
||||||
"type": 9
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": "11:7949771231314213889",
|
|
||||||
"name": "isDel",
|
|
||||||
"type": 5
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"relations": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"lastEntityId": "1:594331511073099531",
|
|
||||||
"lastIndexId": "1:6010838397086628487",
|
|
||||||
"lastRelationId": "0:0",
|
|
||||||
"lastSequenceId": "0:0",
|
|
||||||
"modelVersion": 5,
|
|
||||||
"modelVersionParserMinimum": 5,
|
|
||||||
"retiredEntityUids": [],
|
|
||||||
"retiredIndexUids": [],
|
|
||||||
"retiredPropertyUids": [
|
|
||||||
340951913928211738,
|
|
||||||
5484846939472684412
|
|
||||||
],
|
|
||||||
"retiredRelationUids": [],
|
|
||||||
"version": 1
|
|
||||||
}
|
|
||||||
@@ -152,7 +152,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
private var bottomSheetDialog: CustomBottomSheetDialog? = null
|
private var bottomSheetDialog: CustomBottomSheetDialog? = null
|
||||||
private var lastWeight: Int = 0
|
private var lastWeight: Int = 0
|
||||||
private var lastPhotoUri: Uri? = null // 最后拍照的图片
|
private var lastPhotoUri: Uri? = null // 最后拍照的图片
|
||||||
private var debouncer = Debouncer(5000)
|
private var debouncer = Debouncer(2000)
|
||||||
private var isRecognitionFood = true
|
private var isRecognitionFood = true
|
||||||
private var isFirstOpen = true
|
private var isFirstOpen = true
|
||||||
|
|
||||||
@@ -290,26 +290,33 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
* 联合支付-即放即取模式
|
* 联合支付-即放即取模式
|
||||||
*/
|
*/
|
||||||
private fun loadJFJQBySettlement(weight: Int) {
|
private fun loadJFJQBySettlement(weight: Int) {
|
||||||
|
log("registerDataChange weight 联合支付-即放即取")
|
||||||
//即放即取+联合支付人脸查询订单完成
|
//即放即取+联合支付人脸查询订单完成
|
||||||
if (presentation!!.jointPaymentQueryFinish) {
|
if (presentation!!.jointPaymentQueryFinish) {
|
||||||
|
log("registerDataChange weight 联合支付-即放即取,人脸查询订单完成")
|
||||||
if (weight > WEIGHT_RESET_RECOGNIZE) {
|
if (weight > WEIGHT_RESET_RECOGNIZE) {
|
||||||
//已识别完成人脸并查询到订单数据,增加重量不再重新识别
|
//已识别完成人脸并查询到订单数据,增加重量不再重新识别
|
||||||
|
log("registerDataChange weight 联合支付-即放即取,不再重新识别")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//重量小于等于5克时改为识别中页面
|
log("registerDataChange weight 联合支付-即放即取,step1FoodRecognizing")
|
||||||
|
//重量小于等于10克时改为识别中页面
|
||||||
isAnalyzing = false
|
isAnalyzing = false
|
||||||
presentation?.step1FoodRecognizing()
|
presentation?.step1FoodRecognizing()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
log("registerDataChange weight 联合支付-即放即取,人脸查询订单没有完成")
|
||||||
if (weight <= WEIGHT_RESET_RECOGNIZE) {
|
if (weight <= WEIGHT_RESET_RECOGNIZE) {
|
||||||
//秤上重量过下,显示识别中页面
|
//秤上重量过小,显示识别中页面
|
||||||
|
log("registerDataChange weight 联合支付-即放即取,重量小于${WEIGHT_RESET_RECOGNIZE}g,step1FoodRecognizing")
|
||||||
presentation?.step1FoodRecognizing()
|
presentation?.step1FoodRecognizing()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
log("registerDataChange weight 联合支付-即放即取,recognizeByWeight")
|
||||||
// val isWeightChange = abs(weight - lastWeight) > 0.02
|
// val isWeightChange = abs(weight - lastWeight) > 0.02
|
||||||
val isWeightChange = weight - lastWeight > WEIGHT_CHANGE_VALUE
|
val isWeightChange = weight - lastWeight > WEIGHT_CHANGE_VALUE
|
||||||
if (weight != lastWeight) {
|
if (weight != lastWeight) {
|
||||||
log("recognizeByWeight---00001,weight=$weight,lastWeight=$lastWeight,isWeightChange=$isWeightChange")
|
log("registerDataChange weight 联合支付-即放即取,recognizeByWeight---00001,weight=$weight,lastWeight=$lastWeight,isWeightChange=$isWeightChange")
|
||||||
}
|
}
|
||||||
recognizeByWeight(weight, isWeightChange)
|
recognizeByWeight(weight, isWeightChange)
|
||||||
}
|
}
|
||||||
@@ -318,14 +325,18 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
* 联合支付-余量计量模式
|
* 联合支付-余量计量模式
|
||||||
*/
|
*/
|
||||||
private fun loadYLJLBySettlement(weight: Int) {
|
private fun loadYLJLBySettlement(weight: Int) {
|
||||||
|
log("registerDataChange weight 联合支付-余量计量")
|
||||||
if (weight <= WEIGHT_RESET_RECOGNIZE) {
|
if (weight <= WEIGHT_RESET_RECOGNIZE) {
|
||||||
|
log("registerDataChange weight 联合支付-余量计量,重量小于${WEIGHT_RESET_RECOGNIZE}g,step1FoodRecognizing")
|
||||||
//秤上重量过小,显示识别中页面
|
//秤上重量过小,显示识别中页面
|
||||||
presentation?.step1FoodRecognizing()
|
presentation?.step1FoodRecognizing()
|
||||||
lastWeight = weight
|
lastWeight = weight
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
log("registerDataChange weight 联合支付-余量计量,订单完成状态:${presentation!!.jointPaymentQueryFinish}")
|
||||||
//余量计量+联合支付人脸查询订单完成
|
//余量计量+联合支付人脸查询订单完成
|
||||||
if (presentation!!.jointPaymentQueryFinish) {
|
if (presentation!!.jointPaymentQueryFinish) {
|
||||||
|
log("registerDataChange weight 联合支付-余量计量,updateWeight")
|
||||||
presentation?.updateWeight(weight)
|
presentation?.updateWeight(weight)
|
||||||
lastWeight = weight
|
lastWeight = weight
|
||||||
return
|
return
|
||||||
@@ -342,10 +353,12 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (weight <= WEIGHT_RESET_RECOGNIZE) {
|
if (weight <= WEIGHT_RESET_RECOGNIZE) {
|
||||||
|
log("registerDataChange weight 秤重量小于${WEIGHT_RESET_RECOGNIZE}g")
|
||||||
//检测到秤上没有东西,重新启动识别菜品 && presentation?.mealPickupMode == 1
|
//检测到秤上没有东西,重新启动识别菜品 && presentation?.mealPickupMode == 1
|
||||||
checkedItem = null
|
checkedItem = null
|
||||||
}
|
}
|
||||||
if (settlementMode == 0) {
|
if (settlementMode == 0) {
|
||||||
|
log("registerDataChange weight 联合支付模式")
|
||||||
//联合支付-------------------------------------------
|
//联合支付-------------------------------------------
|
||||||
//0-即放即取,1-余量计量
|
//0-即放即取,1-余量计量
|
||||||
val mealPickupMode = SPUtil.getInstance().get(GlobalKey.KEY_PICKUP_MODE, 0) ?: 0
|
val mealPickupMode = SPUtil.getInstance().get(GlobalKey.KEY_PICKUP_MODE, 0) ?: 0
|
||||||
@@ -387,36 +400,46 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun recognizeByWeight(weight: Int, isWeightChange: Boolean, block: () -> Unit = {}) {
|
private fun recognizeByWeight(weight: Int, isWeightChange: Boolean, block: () -> Unit = {}) {
|
||||||
|
log("registerDataChange weight 开始识别")
|
||||||
if (weight != lastWeight) {
|
if (weight != lastWeight) {
|
||||||
val payTypeDesc = if (settlementMode == 0) "联合支付" else "独立支付"
|
val payTypeDesc = if (settlementMode == 0) "联合支付" else "独立支付"
|
||||||
log("readWeight-${payTypeDesc},weight=$weight,lastWeight=$lastWeight,isWeightChange=$isWeightChange")
|
log("registerDataChange weight readWeight-${payTypeDesc},weight=$weight,lastWeight=$lastWeight,isWeightChange=$isWeightChange")
|
||||||
}
|
}
|
||||||
presentation?.updateWeight(weight)
|
presentation?.updateWeight(weight)
|
||||||
|
|
||||||
if (weight <= WEIGHT_RESET_RECOGNIZE) {
|
if (weight <= WEIGHT_RESET_RECOGNIZE) {
|
||||||
log("recognizeByWeight---00002,秤重未超过${WEIGHT_RESET_RECOGNIZE}克")
|
log("registerDataChange weight recognizeByWeight---00002,秤重未超过${WEIGHT_RESET_RECOGNIZE}克")
|
||||||
//检测到秤上没有东西,重新启动识别菜品 && presentation?.mealPickupMode == 1
|
//检测到秤上没有东西,重新启动识别菜品 && presentation?.mealPickupMode == 1
|
||||||
isRecognitionFood = true
|
isRecognitionFood = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isWeightChange && isRecognitionFood) {
|
if (isWeightChange && isRecognitionFood) {
|
||||||
log("recognizeByWeight---00003,mealPickupMode=${presentation?.mealPickupMode}")
|
log("registerDataChange weight recognizeByWeight---00003,mealPickupMode=${presentation?.mealPickupMode}")
|
||||||
if (presentation?.mealPickupMode == 1 && checkedItem != null) {
|
if (presentation?.mealPickupMode == 1 && checkedItem != null) {
|
||||||
isRecognitionFood = false
|
isRecognitionFood = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
debouncer.debounce {
|
debouncer.debounce {
|
||||||
log("recognizeByWeight---00004")
|
log("registerDataChange weight recognizeByWeight---00004--recognizeFood")
|
||||||
recognizeFood()
|
recognizeFood()
|
||||||
if (presentation?.mealPickupMode == 0) {
|
if (presentation?.mealPickupMode == 0) {
|
||||||
|
log("registerDataChange weight recognizeByWeight---00004--recognizeFood,mealPickupMode == 0")
|
||||||
lastWeight = weight
|
lastWeight = weight
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
log("registerDataChange weight recognizeByWeight---block")
|
||||||
block()
|
block()
|
||||||
}
|
}
|
||||||
if (presentation?.mealPickupMode == 1 || settlementMode == 0) {
|
if (presentation?.mealPickupMode == 1 || settlementMode == 0) {
|
||||||
|
log("registerDataChange weight recognizeByWeight---lastWeight=${lastWeight}, weight=${weight}, checkedItem=${checkedItem}")
|
||||||
|
if (weight - lastWeight > WEIGHT_CHANGE_VALUE && checkedItem == null) {
|
||||||
|
debouncer.debounce {
|
||||||
|
log("registerDataChange weight重新进行菜品识别 ")
|
||||||
|
recognizeFood()
|
||||||
|
}
|
||||||
|
}
|
||||||
lastWeight = weight
|
lastWeight = weight
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -679,6 +702,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
|
|
||||||
binding.previewView.visible()
|
binding.previewView.visible()
|
||||||
binding.ivImg.gone()
|
binding.ivImg.gone()
|
||||||
|
checkedItem = null
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateDateTime() {
|
private fun updateDateTime() {
|
||||||
|
|||||||
@@ -485,6 +485,7 @@ class MainScreenPresentation(
|
|||||||
binding.nutritionInclude.tvUserName.text = userNutrition?.name.maskName()
|
binding.nutritionInclude.tvUserName.text = userNutrition?.name.maskName()
|
||||||
val recommendCalorie = (userNutrition?.recommendCalorie ?: 0.0).roundedDecimalPlace(1)
|
val recommendCalorie = (userNutrition?.recommendCalorie ?: 0.0).roundedDecimalPlace(1)
|
||||||
|
|
||||||
|
// binding.detailInclude.tvTotalWeight.text = "总重量:${userNutrition?.}克"
|
||||||
binding.nutritionInclude.tvRecommendHeat.text =
|
binding.nutritionInclude.tvRecommendHeat.text =
|
||||||
"推荐热量:${recommendCalorie.roundedDecimalPlace(1)}kcal"
|
"推荐热量:${recommendCalorie.roundedDecimalPlace(1)}kcal"
|
||||||
// binding.nutritionInclude.tvRecommendHeat.text = "推荐热量:${recommendCalorie.removeTrailingZeros()}kcal"
|
// binding.nutritionInclude.tvRecommendHeat.text = "推荐热量:${recommendCalorie.removeTrailingZeros()}kcal"
|
||||||
@@ -1041,7 +1042,7 @@ class MainScreenPresentation(
|
|||||||
return@runOnUiThread
|
return@runOnUiThread
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pauseCamera()
|
// pauseCamera()
|
||||||
step3ShowRecognizeResult(userId)
|
step3ShowRecognizeResult(userId)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -1306,29 +1307,33 @@ class MainScreenPresentation(
|
|||||||
|
|
||||||
val listIsEmpty = facePreviewInfoList.isEmpty()
|
val listIsEmpty = facePreviewInfoList.isEmpty()
|
||||||
val listFirstTrackId = if (listIsEmpty.not()) facePreviewInfoList[0].trackId else null
|
val listFirstTrackId = if (listIsEmpty.not()) facePreviewInfoList[0].trackId else null
|
||||||
Timber.tag(TAG)
|
// Timber.tag(TAG)
|
||||||
.d("listIsEmpty=$listIsEmpty,lastFaceTrackId=$lastFaceTrackId,listFirstTrackId=$listFirstTrackId")
|
// .d("drawPreviewInfo,listIsEmpty=$listIsEmpty,lastFaceTrackId=$lastFaceTrackId,listFirstTrackId=$listFirstTrackId")
|
||||||
if (listIsEmpty || (lastFaceTrackId != listFirstTrackId)) {
|
if (listIsEmpty || (lastFaceTrackId != listFirstTrackId)) {
|
||||||
if (lastFaceTrackId != -1 && currentUserId != null) {
|
if (lastFaceTrackId != -1 && currentUserId != null) {
|
||||||
//0-即放即取,1-余量计量
|
//0-即放即取,1-余量计量
|
||||||
mealPickupMode = SPUtil.getInstance().get(GlobalKey.KEY_PICKUP_MODE, 0) ?: 0
|
mealPickupMode = SPUtil.getInstance().get(GlobalKey.KEY_PICKUP_MODE, 0) ?: 0
|
||||||
Timber.tag(TAG).i("$lastFaceTrackId 用户离开")
|
Timber.tag(TAG).i("drawPreviewInfo,$lastFaceTrackId 用户离开")
|
||||||
lastFaceTrackId = -1
|
lastFaceTrackId = -1
|
||||||
//resumeCamera()
|
|
||||||
Timber.tag(TAG)
|
Timber.tag(TAG)
|
||||||
.d("postUserData userNutritionData是否null: ${userNutrition == null}, currentFood是否null: ${currentFood == null},currentUserId是否null:${currentUserId == null}")
|
.d("drawPreviewInfo,postUserData userNutritionData是否null: ${userNutrition == null}, currentFood是否null: ${currentFood == null},currentUserId是否null:${currentUserId == null}")
|
||||||
if (userNutrition == null || currentFood == null || currentUserId == null) {
|
if (userNutrition == null || currentFood == null || currentUserId == null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Timber.tag(TAG).d("drawPreviewInfo,开始提交订单")
|
||||||
createOrder(notEnoughOneBlock = {
|
createOrder(notEnoughOneBlock = {
|
||||||
|
Timber.tag(TAG).d("drawPreviewInfo,notEnoughOneBlock")
|
||||||
if (activity.settlementMode == 0) {
|
if (activity.settlementMode == 0) {
|
||||||
|
Timber.tag(TAG).d("drawPreviewInfo,notEnoughOneBlock,联合模式")
|
||||||
setTopInfoVisible()
|
setTopInfoVisible()
|
||||||
}
|
}
|
||||||
// if (mealPickupMode == 0) {
|
// if (mealPickupMode == 0) {
|
||||||
|
Timber.tag(TAG).d("drawPreviewInfo,notEnoughOneBlock,step2FaceRecognizing")
|
||||||
currentStep = 2
|
currentStep = 2
|
||||||
step2FaceRecognizing(currentFood!!)
|
step2FaceRecognizing(currentFood!!)
|
||||||
// }
|
// }
|
||||||
}, successBlock = {
|
}, successBlock = {
|
||||||
|
Timber.tag(TAG).d("drawPreviewInfo,successBlock,订单已生成")
|
||||||
// TODO: 测试人脸识别问题--------------------
|
// TODO: 测试人脸识别问题--------------------
|
||||||
//recognizeViewModel.updateRegisterStatus(REGISTER_STATUS_READY)
|
//recognizeViewModel.updateRegisterStatus(REGISTER_STATUS_READY)
|
||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
@@ -1342,13 +1347,17 @@ class MainScreenPresentation(
|
|||||||
// activity.isAnalyzing = false
|
// activity.isAnalyzing = false
|
||||||
// step1FoodRecognizing()
|
// step1FoodRecognizing()
|
||||||
// } else {
|
// } else {
|
||||||
|
Timber.tag(TAG).d("drawPreviewInfo,successBlock,订单已生成,mealPickupMode=$mealPickupMode")
|
||||||
if (mealPickupMode == 1) {
|
if (mealPickupMode == 1) {
|
||||||
|
Timber.tag(TAG).d("drawPreviewInfo,successBlock,订单已生成,step2FaceRecognizing")
|
||||||
step2FaceRecognizing(currentFood!!)
|
step2FaceRecognizing(currentFood!!)
|
||||||
isKeepFaceState = false
|
isKeepFaceState = false
|
||||||
if (activity.settlementMode == 0) {
|
if (activity.settlementMode == 0) {
|
||||||
|
Timber.tag(TAG).d("drawPreviewInfo,successBlock,订单已生成,step2FaceRecognizing,联合支付")
|
||||||
setTopInfoVisible()
|
setTopInfoVisible()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Timber.tag(TAG).d("drawPreviewInfo,successBlock,订单已生成,step1FoodRecognizing")
|
||||||
activity.isAnalyzing = false
|
activity.isAnalyzing = false
|
||||||
step1FoodRecognizing()
|
step1FoodRecognizing()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user