联合支付功能

This commit is contained in:
2026-03-19 17:44:13 +08:00
parent b51be58c64
commit 549e8d303f
15 changed files with 160 additions and 29 deletions
@@ -134,7 +134,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
private var bottomSheetDialog: CustomBottomSheetDialog? = null
private var lastWeight: Double = 0.0
private var lastPhotoUri: Uri? = null // 最后拍照的图片
private var debouncer = Debouncer(2000)
private var debouncer = Debouncer(5000)
private var isRecognitionFood = true
private var isFirstOpen = true
@@ -263,7 +263,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
//0.05
// val isWeightChange = abs(weight - lastWeight) > 0.02
val isWeightChange = weight - lastWeight > 0.02
log("recognizeByWeight---00001,weight=$weight,lastWeight=$lastWeight,isWeightChange=$isWeightChange")
if (weight != lastWeight) {
log("recognizeByWeight---00001,weight=$weight,lastWeight=$lastWeight,isWeightChange=$isWeightChange")
}
recognizeByWeight(weight, isWeightChange)
}
}
@@ -278,7 +280,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
return
}
if (isWeightChange && isRecognitionFood) { // 大于50g
if (isWeightChange && isRecognitionFood) {
log("recognizeByWeight---00003,mealPickupMode=${presentation?.mealPickupMode}")
if (presentation?.mealPickupMode == 1) {
isRecognitionFood = false
@@ -293,8 +295,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
} else {
block()
}
if (presentation?.mealPickupMode == 1) {
//0-联合支付,1-独立支付
val settlementMode = SPUtil.getInstance().get(GlobalKey.KEY_SETTLEMENT_MODE, 1)
if (presentation?.mealPickupMode == 1 || settlementMode == 0) {
lastWeight = weight
}
}
@@ -1085,6 +1088,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
}
}
/**
* 隐藏搜索按钮
*/
fun hideSearchView() {
binding.tvToSearch.gone()
}
// @Subscribe(threadMode = ThreadMode.MAIN)
// public fun onResetBox(event: ResetBoxEvent) {
// ObjectBox.boxStore.close()
@@ -7,17 +7,17 @@ import androidx.core.graphics.toColorInt
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.QuickViewHolder
import com.sw.dualscreen.R
import com.sw.dualscreen.databinding.ListItemSearchFoodBinding
import com.sw.dualscreen.databinding.ListItemSearchFood3Binding
import com.sw.dualscreen.ext.format2String
import com.sw.dualscreen.model.response.FoodInfo
class CollectFoodListAdapter(var list: MutableList<FoodInfo>) :
BaseQuickAdapter<FoodInfo, CollectFoodListAdapter.VH>(list) {
inner class VH(var binding: ListItemSearchFoodBinding) : QuickViewHolder(binding.root)
inner class VH(var binding: ListItemSearchFood3Binding) : QuickViewHolder(binding.root)
override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): VH {
val inflater = LayoutInflater.from(context)
val binding = ListItemSearchFoodBinding.inflate(inflater, parent, false)
val binding = ListItemSearchFood3Binding.inflate(inflater, parent, false)
return VH(binding)
}
@@ -519,6 +519,7 @@ class MainScreenPresentation(
pauseCamera()
activity.clearFoodList()
activity.hideSearchView()
}
// fun foodRecSuccess(foodInfo: FoodInfo) {