From 548dce0bcff06ee7a1795defe8e7789b9d7aad94 Mon Sep 17 00:00:00 2001 From: zuoxiao <470321431@qq.com> Date: 星期五, 25 四月 2025 16:52:50 +0800 Subject: [PATCH] refactor(nfc): 重构 NFC 读写助手类并优化相关功能 --- generallibrary/src/main/res/layout/fragment_card.xml | 307 +++++++++++++++++++++++++++++++------------------- 1 files changed, 188 insertions(+), 119 deletions(-) diff --git a/generallibrary/src/main/res/layout/fragment_card.xml b/generallibrary/src/main/res/layout/fragment_card.xml index 338af60..70eef09 100644 --- a/generallibrary/src/main/res/layout/fragment_card.xml +++ b/generallibrary/src/main/res/layout/fragment_card.xml @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout 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:background="@color/white"> @@ -12,7 +13,8 @@ android:layout_height="@dimen/dimen_title_height" android:background="@color/title_bar_bg" android:elevation="4dp" - app:centerText="鍒跺崱" /> + app:centerText="鍒跺崱" + tools:ignore="MissingConstraints" /> <ScrollView android:layout_width="match_parent" @@ -24,20 +26,20 @@ <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:padding="16dp"> + android:padding="12dp"> <androidx.cardview.widget.CardView android:id="@+id/home_newCard" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:layout_marginTop="16dp" - android:layout_marginEnd="8dp" + android:layout_marginStart="6dp" + android:layout_marginTop="12dp" + android:layout_marginEnd="6dp" android:clickable="true" android:focusable="true" android:foreground="?android:attr/selectableItemBackground" - app:cardCornerRadius="12dp" - app:cardElevation="4dp" + app:cardCornerRadius="10dp" + app:cardElevation="3dp" app:layout_constraintEnd_toStartOf="@+id/home_redCard" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> @@ -47,21 +49,21 @@ android:layout_height="wrap_content" android:gravity="center" android:orientation="vertical" - android:padding="16dp"> + android:padding="12dp"> <ImageView - android:layout_width="70dp" - android:layout_height="70dp" + android:layout_width="55dp" + android:layout_height="55dp" android:src="@drawable/home_add" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="8dp" + android:layout_marginTop="6dp" android:gravity="center" android:text="寮�鍗�" android:textColor="@color/text_selecter_color" - android:textSize="@dimen/home_text_size" /> + android:textSize="14sp" /> </LinearLayout> </androidx.cardview.widget.CardView> @@ -69,15 +71,15 @@ android:id="@+id/home_recharge" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:layout_marginTop="16dp" - android:layout_marginEnd="8dp" + android:layout_marginStart="6dp" + android:layout_marginTop="12dp" + android:layout_marginEnd="6dp" android:clickable="true" android:focusable="true" android:foreground="?android:attr/selectableItemBackground" android:visibility="gone" - app:cardCornerRadius="12dp" - app:cardElevation="4dp" + app:cardCornerRadius="10dp" + app:cardElevation="3dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> @@ -87,21 +89,21 @@ android:layout_height="wrap_content" android:gravity="center" android:orientation="vertical" - android:padding="16dp"> + android:padding="12dp"> <ImageView - android:layout_width="70dp" - android:layout_height="70dp" + android:layout_width="55dp" + android:layout_height="55dp" android:src="@drawable/home_recharge" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="8dp" + android:layout_marginTop="6dp" android:gravity="center" android:text="鍏呭��" android:textColor="@color/text_selecter_color" - android:textSize="@dimen/home_text_size" /> + android:textSize="14sp" /> </LinearLayout> </androidx.cardview.widget.CardView> @@ -109,14 +111,14 @@ android:id="@+id/home_redCard" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:layout_marginTop="16dp" - android:layout_marginEnd="8dp" + android:layout_marginStart="6dp" + android:layout_marginTop="12dp" + android:layout_marginEnd="6dp" android:clickable="true" android:focusable="true" android:foreground="?android:attr/selectableItemBackground" - app:cardCornerRadius="12dp" - app:cardElevation="4dp" + app:cardCornerRadius="10dp" + app:cardElevation="3dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/home_newCard" app:layout_constraintTop_toTopOf="parent"> @@ -126,21 +128,21 @@ android:layout_height="wrap_content" android:gravity="center" android:orientation="vertical" - android:padding="16dp"> + android:padding="12dp"> <ImageView - android:layout_width="70dp" - android:layout_height="70dp" + android:layout_width="55dp" + android:layout_height="55dp" android:src="@drawable/home_read" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="8dp" + android:layout_marginTop="6dp" android:gravity="center" android:text="璇诲崱" android:textColor="@color/text_selecter_color" - android:textSize="@dimen/home_text_size" /> + android:textSize="14sp" /> </LinearLayout> </androidx.cardview.widget.CardView> @@ -148,14 +150,14 @@ android:id="@+id/home_loss" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:layout_marginTop="24dp" - android:layout_marginEnd="8dp" + android:layout_marginStart="6dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="6dp" android:clickable="true" android:focusable="true" android:foreground="?android:attr/selectableItemBackground" - app:cardCornerRadius="12dp" - app:cardElevation="4dp" + app:cardCornerRadius="10dp" + app:cardElevation="3dp" app:layout_constraintEnd_toStartOf="@+id/home_replacement" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/home_newCard"> @@ -166,21 +168,21 @@ android:layout_height="wrap_content" android:gravity="center" android:orientation="vertical" - android:padding="16dp"> + android:padding="12dp"> <ImageView - android:layout_width="70dp" - android:layout_height="70dp" + android:layout_width="55dp" + android:layout_height="55dp" android:src="@drawable/home_report" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="8dp" + android:layout_marginTop="6dp" android:gravity="center" android:text="鎸傚け" android:textColor="@color/text_selecter_color" - android:textSize="@dimen/home_text_size" /> + android:textSize="14sp" /> </LinearLayout> </androidx.cardview.widget.CardView> @@ -191,7 +193,7 @@ android:gravity="center" android:text="瑙i櫎鎸傚け" android:textColor="@color/text_selecter_color" - android:textSize="@dimen/home_text_size" + android:textSize="14sp" android:visibility="gone" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> @@ -200,38 +202,156 @@ android:id="@+id/home_replacement" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:layout_marginTop="24dp" - android:layout_marginEnd="8dp" + android:layout_marginStart="6dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="6dp" android:clickable="true" android:focusable="true" android:foreground="?android:attr/selectableItemBackground" - app:cardCornerRadius="12dp" - app:cardElevation="4dp" + app:cardCornerRadius="10dp" + app:cardElevation="3dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/home_loss" app:layout_constraintTop_toBottomOf="@+id/home_redCard"> + + <LinearLayout + android:id="@+id/home_replaceLL" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center" + android:orientation="vertical" + android:padding="12dp"> + + <ImageView + android:layout_width="55dp" + android:layout_height="55dp" + android:src="@drawable/home_replacement" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="6dp" + android:gravity="center" + android:text="瑙f寕銆佽ˉ鍗�" + android:textColor="@color/text_selecter_color" + android:textSize="14sp" /> + </LinearLayout> + </androidx.cardview.widget.CardView> + + <androidx.cardview.widget.CardView + android:id="@+id/home_reverse" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="6dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="6dp" + android:clickable="true" + android:focusable="true" + android:foreground="?android:attr/selectableItemBackground" + app:cardCornerRadius="10dp" + app:cardElevation="3dp" + app:layout_constraintEnd_toStartOf="@+id/home_deduction" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/home_replacement"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:orientation="vertical" - android:padding="16dp"> + android:padding="12dp"> <ImageView - android:layout_width="70dp" - android:layout_height="70dp" - android:src="@drawable/home_replacement" /> + android:layout_width="55dp" + android:layout_height="55dp" + android:src="@drawable/chongzheng" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="8dp" + android:layout_marginTop="6dp" android:gravity="center" - android:text="琛ュ崱" + android:text="鍐叉" android:textColor="@color/text_selecter_color" - android:textSize="@dimen/home_text_size" /> + android:textSize="14sp" /> + </LinearLayout> + </androidx.cardview.widget.CardView> + + <androidx.cardview.widget.CardView + android:id="@+id/home_deduction" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="6dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="6dp" + android:clickable="true" + android:focusable="true" + android:foreground="?android:attr/selectableItemBackground" + app:cardCornerRadius="10dp" + app:cardElevation="3dp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@+id/home_reverse" + app:layout_constraintTop_toBottomOf="@+id/home_replacement"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center" + android:orientation="vertical" + android:padding="12dp"> + + <ImageView + android:layout_width="55dp" + android:layout_height="55dp" + android:src="@drawable/bukou" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="6dp" + android:gravity="center" + android:text="琛ユ墸" + android:textColor="@color/text_selecter_color" + android:textSize="14sp" /> + </LinearLayout> + </androidx.cardview.widget.CardView> + + <androidx.cardview.widget.CardView + android:id="@+id/home_rewrite" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="6dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="6dp" + android:clickable="true" + android:focusable="true" + android:foreground="?android:attr/selectableItemBackground" + app:cardCornerRadius="10dp" + app:cardElevation="3dp" + app:layout_constraintEnd_toStartOf="@+id/home_manage" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/home_reverse"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:gravity="center" + android:orientation="vertical" + android:padding="12dp"> + + <ImageView + android:layout_width="55dp" + android:layout_height="55dp" + android:src="@drawable/fanxie" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="6dp" + android:gravity="center" + android:text="鍙嶅啓" + android:textColor="@color/text_selecter_color" + android:textSize="14sp" /> </LinearLayout> </androidx.cardview.widget.CardView> @@ -239,19 +359,19 @@ android:id="@+id/home_manage" android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:layout_marginTop="24dp" - android:layout_marginEnd="8dp" - android:layout_marginBottom="16dp" + android:layout_marginStart="6dp" + android:layout_marginTop="16dp" + android:layout_marginEnd="6dp" + android:layout_marginBottom="12dp" android:clickable="true" android:focusable="true" android:foreground="?android:attr/selectableItemBackground" - app:cardCornerRadius="12dp" - app:cardElevation="4dp" + app:cardCornerRadius="10dp" + app:cardElevation="3dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/home_loss" + app:layout_constraintStart_toEndOf="@+id/home_rewrite" + app:layout_constraintTop_toBottomOf="@+id/home_deduction" app:layout_constraintVertical_bias="0.0"> <LinearLayout @@ -259,75 +379,24 @@ android:layout_height="wrap_content" android:gravity="center" android:orientation="vertical" - android:padding="16dp"> + android:padding="12dp"> <ImageView - android:layout_width="70dp" - android:layout_height="70dp" + android:layout_width="55dp" + android:layout_height="55dp" android:src="@drawable/home_system" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginTop="8dp" + android:layout_marginTop="6dp" android:gravity="center" android:text="鍒朵綔绠$悊鍗�" android:textColor="@color/text_selecter_color" - android:textSize="@dimen/home_text_size" /> + android:textSize="14sp" /> </LinearLayout> </androidx.cardview.widget.CardView> - <TextView - android:id="@+id/home_parameter" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:gravity="center" - android:text="鍙傛暟璁剧疆" - android:textColor="@color/text_selecter_color" - android:textSize="@dimen/home_text_size" - android:visibility="gone" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> - - <androidx.cardview.widget.CardView - android:id="@+id/home_my" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:layout_marginTop="24dp" - android:layout_marginEnd="8dp" - android:clickable="true" - android:focusable="true" - android:foreground="?android:attr/selectableItemBackground" - android:visibility="gone" - app:cardCornerRadius="12dp" - app:cardElevation="4dp" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/home_admin"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="center" - android:orientation="vertical" - android:padding="16dp"> - - <ImageView - android:layout_width="70dp" - android:layout_height="70dp" - android:src="@drawable/home_my" /> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="8dp" - android:gravity="center" - android:text="涓汉涓績" - android:textColor="@color/text_selecter_color" - android:textSize="@dimen/home_text_size" /> - </LinearLayout> - </androidx.cardview.widget.CardView> </androidx.constraintlayout.widget.ConstraintLayout> </ScrollView> </androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file -- Gitblit v1.8.0