From b8ed2b19e0aaf3c357e2f601d8304acdc525f4f9 Mon Sep 17 00:00:00 2001 From: zuoxiao <470321431@qq.com> Date: 星期五, 25 四月 2025 16:54:02 +0800 Subject: [PATCH] refactor(nfc): 优化 NFC 读卡工具类 --- generallibrary/src/main/res/layout/item_card_replace.xml | 180 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 180 insertions(+), 0 deletions(-) diff --git a/generallibrary/src/main/res/layout/item_card_replace.xml b/generallibrary/src/main/res/layout/item_card_replace.xml new file mode 100644 index 0000000..c5ca568 --- /dev/null +++ b/generallibrary/src/main/res/layout/item_card_replace.xml @@ -0,0 +1,180 @@ +<?xml version="1.0" encoding="utf-8"?> +<layout 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"> + + <data> + <variable + name="cardInfo" + type="com.dayu.general.bean.net.CardReplaceInfo" /> + </data> + + <androidx.cardview.widget.CardView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginHorizontal="10dp" + android:layout_marginVertical="6dp" + app:cardCornerRadius="10dp" + app:cardElevation="3dp" + app:cardBackgroundColor="@color/white"> + + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:padding="12dp"> + + <!-- 椤堕儴淇℃伅锛氬崱鍙峰拰鐘舵�� --> + <TextView + android:id="@+id/tv_card_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="鍗″彿" + android:textColor="@color/title_bar_text" + android:textSize="14sp" + android:textStyle="bold" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/tv_card_number" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginEnd="16dp" + android:text="@{cardInfo.cardNum}" + android:textColor="@color/colorPrimary" + android:textSize="16sp" + android:textStyle="bold" + app:layout_constraintStart_toEndOf="@+id/tv_card_label" + app:layout_constraintTop_toTopOf="@+id/tv_card_label" + app:layout_constraintEnd_toStartOf="@+id/tv_status" + tools:text="123456789" /> + + <TextView + android:id="@+id/tv_status" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:background="@drawable/shape_status_bg" + android:paddingHorizontal="10dp" + android:paddingVertical="3dp" + android:text="@{cardInfo.stateName}" + android:textColor="@color/white" + android:textSize="12sp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:text="宸叉寕澶�" /> + + <!-- 鍒嗛殧绾� --> + <View + android:id="@+id/divider" + android:layout_width="match_parent" + android:layout_height="0.5dp" + android:layout_marginTop="12dp" + android:background="@color/light_grey" + app:layout_constraintTop_toBottomOf="@+id/tv_card_number" /> + + <!-- 瀹㈡埛淇℃伅 --> + <TextView + android:id="@+id/tv_client_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="12dp" + android:text="瀹㈡埛" + android:textColor="@color/title_bar_text" + android:textSize="14sp" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/divider" /> + + <TextView + android:id="@+id/tv_client_name" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="@{cardInfo.clientName}" + android:textColor="@color/title_bar_text" + android:textSize="14sp" + android:textStyle="bold" + app:layout_constraintStart_toEndOf="@+id/tv_client_label" + app:layout_constraintTop_toTopOf="@+id/tv_client_label" + tools:text="寮犱笁" /> + + <!-- 鍗$被鍨嬩俊鎭紙浜ゆ崲鍒板鎴风紪鍙风殑浣嶇疆锛� --> + <TextView + android:id="@+id/tv_card_type_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="30dp" + android:text="鍗$被鍨�" + android:textColor="@color/title_bar_text" + android:textSize="14sp" + app:layout_constraintStart_toEndOf="@+id/tv_client_name" + app:layout_constraintTop_toTopOf="@+id/tv_client_name" /> + + <TextView + android:id="@+id/tv_card_type" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="@{cardInfo.cardType}" + android:textColor="@color/title_bar_text" + android:textSize="14sp" + app:layout_constraintStart_toEndOf="@+id/tv_card_type_label" + app:layout_constraintTop_toTopOf="@+id/tv_card_type_label" + tools:text="鏅�氬崱" /> + + <!-- 瀹㈡埛缂栧彿淇℃伅锛堜氦鎹㈠埌鍗$被鍨嬬殑浣嶇疆锛� --> + <TextView + android:id="@+id/tv_client_number_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:text="缂栧彿" + android:textColor="@color/title_bar_text" + android:textSize="14sp" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tv_client_label" /> + + <TextView + android:id="@+id/tv_client_number" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="@{cardInfo.clientNum}" + android:textColor="@color/title_bar_text" + android:textSize="14sp" + app:layout_constraintStart_toEndOf="@+id/tv_client_number_label" + app:layout_constraintTop_toTopOf="@+id/tv_client_number_label" + tools:text="C12345" /> + + <!-- 浣欓淇℃伅锛堟斁澶у瓧浣擄級 --> + <TextView + android:id="@+id/tv_money_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="12dp" + android:text="浣欓" + android:textColor="@color/colorAccent" + android:textSize="16sp" + android:textStyle="bold" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/tv_client_number_label" + app:layout_constraintVertical_bias="1.0" /> + + <TextView + android:id="@+id/tv_money" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:text="@{cardInfo.money.concat(" 鍏�")}" + android:textColor="@color/colorAccent" + android:textSize="20sp" + android:textStyle="bold" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintTop_toTopOf="@+id/tv_money_label" + tools:text="100.00 鍏�" /> + + </androidx.constraintlayout.widget.ConstraintLayout> + </androidx.cardview.widget.CardView> +</layout> \ No newline at end of file -- Gitblit v1.8.0