From d0a0e8e242e293ad35dfbee1217f1103302818cd Mon Sep 17 00:00:00 2001 From: zuojincheng <lf_zuo@163.com> Date: 星期四, 03 四月 2025 10:22:48 +0800 Subject: [PATCH] refactor(generallibrary):重构卡片和用户搜索功能 --- generallibrary/src/main/res/layout/fragment_card.xml | 302 ++++++++++++++++++++++++++++++------------------- 1 files changed, 185 insertions(+), 117 deletions(-) diff --git a/generallibrary/src/main/res/layout/fragment_card.xml b/generallibrary/src/main/res/layout/fragment_card.xml index 338af60..fbc41d1 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,14 +202,14 @@ 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"> @@ -217,21 +219,138 @@ 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_replacement" /> <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> + + <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="12dp"> + + <ImageView + 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="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_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/home_system" /> + + <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/home_system" /> + + <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 +358,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 +378,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