feat(ui): 更新發票選擇對話框 UI 佈局為垂直排列
- 將發票選擇對話框 (InvoiceTypeDialog) 根佈局改為 ConstraintLayout,並加入半透明深色背景。 - 將發票選項(手機條碼、捐贈發票、公司統編)改為垂直排列,並移除副標題文字。 - 新增 invoice_button_height 定義發票選項卡片的高度。 - 調整返回按鈕位置,並優化倒數計時文字顯示邏輯。
This commit is contained in:
parent
a10a51ec10
commit
c7134fe712
@ -90,6 +90,13 @@ public class InvoiceTypeDialog extends DialogAbstract {
|
||||
binding = DialogInvoiceTypeBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
android.view.Window window = getWindow();
|
||||
if (window != null) {
|
||||
android.view.WindowManager.LayoutParams layoutParams = window.getAttributes();
|
||||
layoutParams.gravity = android.view.Gravity.CENTER;
|
||||
window.setAttributes(layoutParams);
|
||||
}
|
||||
|
||||
// 選擇:輸入載具(手機條碼)
|
||||
binding.cardVehicle.setOnClickListener(v -> {
|
||||
closeDialogCountdown.shutdown();
|
||||
@ -139,7 +146,7 @@ public class InvoiceTypeDialog extends DialogAbstract {
|
||||
}
|
||||
|
||||
public void setButtonCancelText(long countdown) {
|
||||
binding.buttonCancel.setText("返回支付方式(" + countdown + ")");
|
||||
binding.buttonCancel.setText("返回" + countdown + "秒");
|
||||
}
|
||||
|
||||
public static class CloseDialogOnThreadHandler extends HandlerMainCountdown {
|
||||
|
||||
@ -1,181 +1,172 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/linearLayoutInvoiceType"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/surface"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/transparent">
|
||||
|
||||
<!-- 標題 -->
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="選擇發票開立方式"
|
||||
android:textSize="30sp"
|
||||
android:textColor="@color/primary"
|
||||
android:padding="16dp"
|
||||
android:gravity="center"
|
||||
android:textStyle="bold" />
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/linearLayoutInvoiceType"
|
||||
android:layout_width="540dp"
|
||||
android:layout_height="720dp"
|
||||
android:background="@drawable/bg_rounded_surface"
|
||||
android:clipToOutline="true"
|
||||
android:paddingHorizontal="24dp"
|
||||
android:paddingTop="32dp"
|
||||
android:paddingBottom="32dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<!-- 三張卡片選項區 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:paddingBottom="16dp">
|
||||
|
||||
<!-- 卡片1:輸入載具 -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/cardVehicle"
|
||||
<!-- 上方:標題 (字距拉開) -->
|
||||
<TextView
|
||||
android:id="@+id/titleTextView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="200dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?attr/selectableItemBackground"
|
||||
app:cardBackgroundColor="@color/white"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="2dp"
|
||||
app:cardUseCompatPadding="true">
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="請選擇發票開立方式"
|
||||
android:textColor="@color/primary"
|
||||
android:textSize="36sp"
|
||||
android:textStyle="bold"
|
||||
android:letterSpacing="0.15"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<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="26sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="手機條碼 / 自然人憑證"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
android:gravity="center" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<!-- 卡片2:捐贈發票 -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/cardDonation"
|
||||
<!-- 中間:按鈕區域 (左右增加 padding, 按鈕高度使用維度變數) -->
|
||||
<LinearLayout
|
||||
android:id="@+id/cardContainer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="200dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?attr/selectableItemBackground"
|
||||
app:cardBackgroundColor="@color/white"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="2dp"
|
||||
app:cardUseCompatPadding="true">
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="32dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/bottomButtonLayout"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/titleTextView">
|
||||
|
||||
<LinearLayout
|
||||
<!-- 卡片1:輸入載具 -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/cardVehicle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:paddingVertical="16dp">
|
||||
android:layout_height="@dimen/invoice_button_height"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?attr/selectableItemBackground"
|
||||
app:cardBackgroundColor="@color/white"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="2dp"
|
||||
app:cardUseCompatPadding="true">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="捐贈發票"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="26sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="選擇捐贈機構"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
android:gravity="center" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="輸入載具"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="26sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<!-- 卡片3:公司統編 -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/cardCustomerIdentifier"
|
||||
<!-- 卡片2:捐贈發票 -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/cardDonation"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/invoice_button_height"
|
||||
android:layout_marginBottom="12dp"
|
||||
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">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="捐贈發票"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="26sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<!-- 卡片3:公司統編 -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/cardCustomerIdentifier"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/invoice_button_height"
|
||||
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">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="公司統編"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="26sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 下方:返回按鈕 -->
|
||||
<LinearLayout
|
||||
android:id="@+id/bottomButtonLayout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="200dp"
|
||||
android:layout_weight="1"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:foreground="?attr/selectableItemBackground"
|
||||
app:cardBackgroundColor="@color/white"
|
||||
app:cardCornerRadius="12dp"
|
||||
app:cardElevation="2dp"
|
||||
app:cardUseCompatPadding="true">
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/buttonCancel"
|
||||
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:paddingVertical="16dp">
|
||||
android:layout_height="64dp"
|
||||
android:backgroundTint="@color/warning"
|
||||
android:text="返回40秒"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp"
|
||||
app:cornerRadius="8dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="公司統編"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="26sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="center" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="輸入統一編號"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="16sp"
|
||||
android:gravity="center" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 底部:返回按鈕 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingHorizontal="16dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/buttonCancel"
|
||||
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:backgroundTint="@color/warning"
|
||||
android:text="返回支付方式(40)"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="20sp"
|
||||
app:cornerRadius="8dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@ -21,4 +21,7 @@
|
||||
<dimen name="menu_btn_icon_size">72dp</dimen>
|
||||
<dimen name="menu_btn_inset">8dp</dimen>
|
||||
<dimen name="menu_btn_corner_radius">16dp</dimen>
|
||||
|
||||
<!-- 發票選項按鈕高度 -->
|
||||
<dimen name="invoice_button_height">100dp</dimen>
|
||||
</resources>
|
||||
Loading…
Reference in New Issue
Block a user