[FEAT] Phase2 支付:dialog_buy 支付選單改用 Travis 版(沿用現有 BuyDialog 邏輯)

- dialog_buy 換成 Travis 付款選擇版面(gridPaymentIcons + ConstraintLayout Flow)
- binding 契約相符(layoutNfcPay 在現有 BuyDialog 已停用、逐顆控制),無需改 Java

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
sky121113 2026-06-10 16:19:49 +08:00
parent 33d79076a6
commit 998b3ae89f

View File

@ -1,288 +1,482 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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:id="@+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/light_gray">
android:background="@color/surface"
android:orientation="vertical">
<!-- 購物車標題列(目前隱藏) -->
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@color/red"
android:gravity="center"
android:text="@string/cart"
android:visibility="gone"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold" />
<!-- 總金額列(目前隱藏) -->
<LinearLayout
android:id="@+id/linearLayout4"
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@color/light_gray"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="1dp"
android:background="@color/white"
android:visibility="gone"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@color/error"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.3"
android:gravity="center"
android:text="@string/cart"
android:visibility="gone"
android:textColor="@color/white"
android:textSize="20sp"
android:text="@string/total_amount"
android:textColor="@color/red"
android:textSize="30sp"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="1dp"
android:background="@color/white"
<TextView
android:id="@+id/textPrice"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="5dp"
android:layout_weight="1"
android:gravity="center"
android:text="0"
android:textColor="@color/red"
android:textSize="30sp"
android:textStyle="bold" />
</LinearLayout>
<!-- 商品列表 -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerDialogBuyList"
android:layout_width="match_parent"
android:layout_height="380dp" />
<!-- 頁籤切換按鈕群(目前隱藏) -->
<LinearLayout
android:id="@+id/layoutButton"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="10dp"
android:visibility="gone"
android:orientation="horizontal">
<Button
android:id="@+id/buttonPaymentTransactions"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="24sp"
android:text="@string/payment_transactions" />
<Button
android:id="@+id/buttonVerificationPickup"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="10dp"
android:textSize="24sp"
android:text="@string/pickup_by_number" />
<Button
android:id="@+id/buttonMemberTransactions"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="10dp"
android:visibility="gone"
android:gravity="center_vertical"
android:orientation="horizontal">
android:textSize="24sp"
android:text="@string/members_area" />
</LinearLayout>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.3"
android:gravity="center"
android:text="@string/total_amount"
android:textColor="@color/error"
android:textSize="30sp"
android:textStyle="bold" />
<!-- 支付方式標題 -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="請選擇支付方式"
android:textSize="30sp"
android:textColor="@color/primary"
android:padding="10dp"
android:gravity="center"
android:textStyle="bold" />
<TextView
android:id="@+id/textPrice"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="5dp"
android:layout_weight="1"
android:gravity="center"
android:text="0"
android:textColor="@color/error"
android:textSize="30sp"
android:textStyle="bold" />
</LinearLayout>
<!-- 支付方式按鈕區(可滾動) -->
<ScrollView
android:id="@+id/layoutPaymentTransactions"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerDialogBuyList"
android:layout_width="match_parent"
android:layout_height="380dp"
/>
<LinearLayout
android:id="@+id/layoutButton"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/gridPaymentIcons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:orientation="horizontal">
android:paddingVertical="0dp"
android:paddingHorizontal="16dp">
<Button
android:id="@+id/buttonPaymentTransactions"
android:layout_width="wrap_content"
<androidx.constraintlayout.helper.widget.Flow
android:id="@+id/paymentFlow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="24sp"
android:text="@string/payment_transactions" />
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:flow_wrapMode="aligned"
app:flow_maxElementsWrap="2"
app:flow_horizontalStyle="spread"
app:constraint_referenced_ids="buttonNfcCard,buttonNfcRecharge,buttonNfcPhone,buttonEsunPay,buttonTapPay,buttonCash,buttonLinePay,buttonAccessCode,buttonFreeGift" />
<View
android:layout_width="10dp"
android:layout_height="10dp"
android:visibility="visible" />
<androidx.cardview.widget.CardView
android:id="@+id/buttonNfcCard"
android:layout_width="0dp"
android:layout_height="200dp"
android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="12dp"
app:cardElevation="2dp"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingVertical="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:text="信用卡"
android:textColor="@color/black"
android:textSize="25sp" />
<ImageView
android:layout_width="350dp"
android:layout_height="80dp"
android:scaleType="fitCenter"
android:src="@drawable/pay_credit_card_method" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<Button
android:id="@+id/buttonVerificationPickup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="24sp"
android:text="@string/pickup_by_number" />
<androidx.cardview.widget.CardView
android:id="@+id/buttonNfcRecharge"
android:layout_width="0dp"
android:layout_height="200dp"
android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="12dp"
app:cardElevation="2dp"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingVertical="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:text="電子票證"
android:textColor="@color/black"
android:textSize="25sp"/>
<ImageView
android:layout_width="350dp"
android:layout_height="80dp"
android:scaleType="fitCenter"
android:src="@drawable/pay_smart_card_method" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<View
android:layout_width="10dp"
android:layout_height="10dp"
android:visibility="gone" />
<androidx.cardview.widget.CardView
android:id="@+id/buttonNfcPhone"
android:layout_width="0dp"
android:layout_height="200dp"
android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="12dp"
app:cardElevation="2dp"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingVertical="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:text="手機NFC"
android:textColor="@color/black"
android:textSize="25sp"
android:textStyle="" />
<ImageView
android:layout_width="350dp"
android:layout_height="80dp"
android:scaleType="fitCenter"
android:src="@drawable/pay_mobile_tap_method" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<Button
android:id="@+id/buttonMemberTransactions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
<androidx.cardview.widget.CardView
android:id="@+id/buttonEsunPay"
android:layout_width="0dp"
android:layout_height="200dp"
android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="12dp"
app:cardElevation="2dp"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingVertical="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:text="掃碼支付-玉山"
android:textColor="@color/black"
android:textSize="25sp" />
<ImageView
android:layout_width="350dp"
android:layout_height="120dp"
android:scaleType="fitCenter"
android:src="@drawable/pay_show_qr_barcode_method" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/buttonTapPay"
android:layout_width="0dp"
android:layout_height="200dp"
android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="12dp"
app:cardElevation="2dp"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingVertical="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:text="掃碼支付-TapPay"
android:textColor="@color/black"
android:textSize="25sp" />
<ImageView
android:layout_width="350dp"
android:layout_height="110dp"
android:scaleType="fitCenter"
android:src="@drawable/pay_show_qr_barcode_method" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/buttonCash"
android:layout_width="0dp"
android:layout_height="200dp"
android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="12dp"
app:cardElevation="2dp"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingVertical="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:text="現金支付"
android:textColor="@color/black"
android:textSize="25sp"/>
<ImageView
android:layout_width="350dp"
android:layout_height="110dp"
android:scaleType="fitCenter"
android:src="@drawable/pay_cash_method" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/buttonLinePay"
android:layout_width="0dp"
android:layout_height="200dp"
android:clickable="true"
android:focusable="true"
android:visibility="gone"
android:textSize="24sp"
android:text="@string/members_area" />
</LinearLayout>
<LinearLayout
android:id="@+id/layoutPaymentTransactions"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:visibility="visible"
android:orientation="vertical">
android:foreground="?attr/selectableItemBackground"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="12dp"
app:cardElevation="2dp"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingVertical="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="掃碼支付"
android:textColor="?attr/colorPrimary"
android:textSize="30sp"
android:textStyle="bold" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<GridLayout
android:id="@+id/gridPaymentIcons"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnCount="2"
android:rowCount="3"
android:padding="0dp"
android:orientation="horizontal">
<androidx.cardview.widget.CardView
android:id="@+id/buttonAccessCode"
android:layout_width="0dp"
android:layout_height="200dp"
android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="12dp"
app:cardElevation="2dp"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingVertical="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="通行碼"
android:textColor="@color/black"
android:textSize="30sp"
android:textStyle="bold" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<ImageButton
android:id="@+id/buttonNfcCard"
android:layout_width="0dp"
android:layout_height="200dp"
android:layout_columnWeight="1"
android:background="@null"
android:scaleType="fitCenter"
android:src="@drawable/pay_nfc_card1" />
<androidx.cardview.widget.CardView
android:id="@+id/buttonFreeGift"
android:layout_width="0dp"
android:layout_height="200dp"
android:clickable="true"
android:focusable="true"
android:visibility="gone"
android:foreground="?attr/selectableItemBackground"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="12dp"
app:cardElevation="2dp"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingVertical="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:text="贈品兌換"
android:textColor="?attr/colorPrimary"
android:textSize="30sp"
android:textStyle="bold" />
<ImageView
android:layout_width="110dp"
android:layout_height="110dp"
android:scaleType="fitCenter"
android:src="@drawable/freegift" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<ImageButton
android:id="@+id/buttonNfcRecharge"
android:layout_width="0dp"
android:layout_height="200dp"
android:layout_columnWeight="1"
android:background="@null"
android:scaleType="fitCenter"
android:src="@drawable/pay_nfc_recharge1" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageButton
android:id="@+id/buttonNfcPhone"
android:layout_width="0dp"
android:layout_height="200dp"
android:layout_columnWeight="1"
android:background="@null"
android:scaleType="fitCenter"
android:src="@drawable/pay_nfc_phone1" />
</ScrollView>
<ImageButton
android:id="@+id/buttonEsunPay"
android:layout_width="0dp"
android:layout_height="200dp"
android:layout_columnWeight="1"
android:background="@null"
android:scaleType="fitCenter"
android:src="@drawable/pay_other0" />
<!-- 驗證取貨區(動態填充) -->
<LinearLayout
android:id="@+id/layoutVerificationPickup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:orientation="vertical" />
<ImageButton
android:id="@+id/buttonTapPay"
android:layout_width="0dp"
android:layout_height="200dp"
android:layout_columnWeight="1"
android:background="@null"
android:scaleType="fitCenter"
android:src="@drawable/esun_pay_barcode" />
<!-- 會員交易區(動態填充) -->
<LinearLayout
android:id="@+id/layoutMemberTransactions"
android:layout_width="match_parent"
android:layout_height="0dp"
android:visibility="gone"
android:orientation="vertical" />
<ImageButton
android:id="@+id/buttonCash"
android:layout_width="0dp"
android:layout_height="200dp"
android:layout_columnWeight="1"
android:background="@null"
android:scaleType="fitCenter"
android:src="@drawable/pay_cash1" />
<!-- 底部操作按鈕列 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="10dp"
android:paddingVertical="5dp"
android:gravity="center"
android:orientation="horizontal">
<ImageButton
android:id="@+id/buttonLinePay"
android:layout_width="0dp"
android:layout_height="200dp"
android:layout_columnWeight="1"
android:background="@null"
android:scaleType="fitCenter"
android:visibility="gone"
android:src="@drawable/linepay_qrcode" />
<com.google.android.material.button.MaterialButton
android:id="@+id/buttonCancel"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_margin="10dp"
app:cornerRadius="10dp"
app:backgroundTint="@color/warning"
android:text="@string/cancel_40"
android:textSize="24sp"
android:textStyle="bold"
android:textColor="@color/white" />
</GridLayout>
<Button
android:id="@+id/buttonAddProduct"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_margin="10dp"
android:elevation="8dp"
android:backgroundTint="@color/white"
android:text="@string/add_to_cart"
android:textColor="@color/black"
android:textSize="24sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="@+id/layoutVerificationPickup"
android:layout_width="match_parent"
android:layout_height="400dp"
android:layout_gravity="center"
android:visibility="gone"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_gravity="start"
android:orientation="horizontal">
<ImageButton
android:id="@+id/buttonAccessCode"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_weight="1"
android:background="@null"
android:contentDescription="TODO"
android:scaleType="fitCenter"
android:src="@drawable/checkout_access_code"
android:text="@string/passcode" />
<ImageButton
android:id="@+id/buttonFreeGift"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_weight="1"
android:background="@null"
android:contentDescription="TODO"
android:scaleType="fitCenter"
android:visibility="gone"
android:src="@drawable/freegift"
android:text="@string/gifts" />
<View
android:id="@+id/placeholderView21"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:visibility="visible" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/layoutMemberTransactions"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:visibility="gone"
android:orientation="vertical">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="@+id/buttonCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="@color/white"
android:text="@string/cancel_40"
android:textSize="24sp"
android:textColor="@color/black" />
<Button
android:id="@+id/buttonAddProduct"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="@color/white"
android:text="@string/add_to_cart"
android:textColor="@color/black"
android:textSize="24sp"
android:visibility="visible" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>