联合支付功能
This commit is contained in:
@@ -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) {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
@@ -13,7 +13,7 @@
|
||||
<RadioGroup
|
||||
android:id="@+id/rgSetting"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="90dp"
|
||||
android:layout_height="75dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Space
|
||||
@@ -31,7 +31,7 @@
|
||||
android:maxLines="1"
|
||||
android:paddingHorizontal="50dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="35dp"
|
||||
android:paddingBottom="15dp"
|
||||
android:text="经营设置"
|
||||
android:textColor="@color/setting_radio"
|
||||
android:textSize="30sp"
|
||||
@@ -53,7 +53,7 @@
|
||||
android:maxLines="1"
|
||||
android:paddingHorizontal="50dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="35dp"
|
||||
android:paddingBottom="15dp"
|
||||
android:text="餐品采集"
|
||||
android:textColor="@color/setting_radio"
|
||||
android:textSize="30sp"
|
||||
|
||||
@@ -11,14 +11,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="32dp"
|
||||
android:background="@drawable/setting_border"
|
||||
android:paddingBottom="16dp">
|
||||
android:paddingBottom="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvChargeSetting"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:drawablePadding="17dp"
|
||||
android:text="餐品采集"
|
||||
android:textColor="@color/black"
|
||||
@@ -48,7 +48,7 @@
|
||||
android:id="@+id/flPreview"
|
||||
android:layout_width="456dp"
|
||||
android:layout_height="342dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginTop="20dp"
|
||||
app:layout_constraintStart_toStartOf="@id/tvChargeSetting"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvChargeSetting">
|
||||
|
||||
@@ -111,9 +111,9 @@
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvFoodList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="382dp"
|
||||
android:layout_height="358dp"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginVertical="10dp"
|
||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@@ -129,7 +129,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginHorizontal="32dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
@@ -164,22 +164,22 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="18dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:minHeight="348dp"
|
||||
android:layout_weight="1"
|
||||
app:spanCount="2"
|
||||
tools:itemCount="10"
|
||||
tools:itemCount="11"
|
||||
android:overScrollMode="never"
|
||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||
tools:listitem="@layout/list_item_search_food"/>
|
||||
tools:listitem="@layout/list_item_search_food3"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/btnSave"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:layout_marginHorizontal="32dp"
|
||||
android:layout_marginBottom="32dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="保存"
|
||||
android:background="@drawable/bg_btn_save"
|
||||
android:textColor="@color/white"
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="取餐明细"
|
||||
android:textColor="#ff33446a"
|
||||
android:textSize="30sp"
|
||||
android:textStyle="bold"
|
||||
android:drawablePadding="17dp"
|
||||
app:drawableStartCompat="@drawable/ic_take_food" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvUserName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="#FF889AC2"
|
||||
android:textSize="26sp"
|
||||
tools:text="张三" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="#FFDDE5F0" />
|
||||
|
||||
<include layout="@layout/layout_food_list_header" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="#FFDDE5F0" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
tools:listitem="@layout/layout_food_list_header" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTotalWeight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#ff889ac2"
|
||||
android:textSize="26sp"
|
||||
tools:text="总重量:680克"
|
||||
android:drawablePadding="17dp"
|
||||
app:drawableStartCompat="@drawable/ic_flag_weight" />
|
||||
|
||||
<Space
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTotalCalorie"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#ff889ac2"
|
||||
android:textSize="26sp"
|
||||
tools:text="总热量:793千卡"
|
||||
android:drawablePadding="17dp"
|
||||
app:drawableStartCompat="@drawable/ic_flag_calorie" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -2,7 +2,7 @@
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp">
|
||||
android:layout_height="130dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivPageBack"
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="212dp"
|
||||
android:layout_height="159dp"
|
||||
android:layout_margin="16dp"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginVertical="10dp"
|
||||
android:background="@drawable/bg_gray2">
|
||||
|
||||
<ImageView
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:layout_marginHorizontal="14dp"
|
||||
android:layout_marginVertical="14dp"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginVertical="16dp"
|
||||
android:paddingHorizontal="15dp"
|
||||
android:textAlignment="center"
|
||||
tools:textColor="@color/black"
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:layout_marginHorizontal="14dp"
|
||||
android:layout_marginVertical="14dp"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginVertical="16dp"
|
||||
android:paddingHorizontal="15dp"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/color_text_dialog"
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/tvFoodName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="90dp"
|
||||
tools:background="@drawable/bg_text_main"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginVertical="8dp"
|
||||
android:paddingHorizontal="15dp"
|
||||
android:textAlignment="center"
|
||||
tools:textColor="@color/black"
|
||||
android:textSize="30sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="肉沫干拌面" />
|
||||
@@ -13,11 +13,13 @@
|
||||
android:padding="28dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/llSignlePage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/setting_border"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="26dp">
|
||||
android:paddingBottom="26dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvFoodName"
|
||||
@@ -187,6 +189,15 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/detailInclude"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/setting_border"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="26dp"
|
||||
layout="@layout/layout_eat_detail"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/flBottomView"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
Reference in New Issue
Block a user