From cf9bc941487df8dfb0780d3e8f1281f4e397b5fa Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期四, 06 三月 2025 10:33:57 +0800
Subject: [PATCH] fix: 3

---
 app/src/main/res/layout/fragment_dashboard.xml |  144 ++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 133 insertions(+), 11 deletions(-)

diff --git a/app/src/main/res/layout/fragment_dashboard.xml b/app/src/main/res/layout/fragment_dashboard.xml
index 166ab0e..5b9b473 100644
--- a/app/src/main/res/layout/fragment_dashboard.xml
+++ b/app/src/main/res/layout/fragment_dashboard.xml
@@ -6,17 +6,139 @@
     android:layout_height="match_parent"
     tools:context=".ui.dashboard.DashboardFragment">
 
-    <TextView
-        android:id="@+id/text_dashboard"
+    <!-- 时间范围选择器 -->
+    <com.google.android.material.tabs.TabLayout
+        android:id="@+id/tab_date_range"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginStart="8dp"
-        android:layout_marginTop="8dp"
-        android:layout_marginEnd="8dp"
-        android:textAlignment="center"
-        android:textSize="20sp"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
+        app:layout_constraintTop_toTopOf="parent">
+
+        <com.google.android.material.tabs.TabItem
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="天" />
+
+        <com.google.android.material.tabs.TabItem
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="周" />
+
+        <com.google.android.material.tabs.TabItem
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="月" />
+
+        <com.google.android.material.tabs.TabItem
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="年" />
+    </com.google.android.material.tabs.TabLayout>
+
+    <!-- 日期选择器 -->
+    <LinearLayout
+        android:id="@+id/layout_date_picker"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        android:padding="16dp"
+        app:layout_constraintTop_toBottomOf="@id/tab_date_range">
+
+        <ImageButton
+            android:id="@+id/btn_previous_date"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:background="?attr/selectableItemBackground"
+            android:src="@android:drawable/ic_media_previous" />
+
+        <TextView
+            android:id="@+id/text_current_date"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:textSize="16sp"
+            tools:text="2025年1月14日" />
+
+        <ImageButton
+            android:id="@+id/btn_next_date"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:background="?attr/selectableItemBackground"
+            android:src="@android:drawable/ic_media_next" />
+    </LinearLayout>
+
+    <!-- 包裹统计卡片 -->
+    <androidx.cardview.widget.CardView
+        android:id="@+id/card_package_stats"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_margin="16dp"
+        app:cardCornerRadius="8dp"
+        app:cardElevation="4dp"
+        app:layout_constraintTop_toBottomOf="@id/layout_date_picker">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal"
+            android:padding="16dp"
+            android:gravity="center_vertical">
+
+            <ImageView
+                android:layout_width="48dp"
+                android:layout_height="48dp"
+                android:src="@drawable/resource_package" />
+
+            <TextView
+                android:id="@+id/text_package_count"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_marginStart="16dp"
+                android:textSize="24sp"
+                android:textStyle="bold"
+                tools:text="4个" />
+
+        </LinearLayout>
+    </androidx.cardview.widget.CardView>
+
+    <!-- 年度统计布局 -->
+    <include
+        android:id="@+id/layout_year_stats"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:visibility="gone"
+        app:layout_constraintTop_toBottomOf="@id/card_package_stats"
+        layout="@layout/layout_year_stats" />
+
+    <!-- 包裹列表和统计图表 -->
+    <androidx.core.widget.NestedScrollView
+        android:layout_width="match_parent"
+        android:layout_height="0dp"
+        android:fillViewport="true"
+        app:layout_constraintTop_toBottomOf="@id/layout_year_stats"
+        app:layout_constraintBottom_toBottomOf="parent">
+
+        <ViewFlipper
+            android:id="@+id/view_flipper_stats"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content">
+
+            <!-- 日视图 -->
+            <androidx.recyclerview.widget.RecyclerView
+                android:id="@+id/recycler_packages"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:clipToPadding="false"
+                android:paddingBottom="16dp" />
+
+            <!-- 周视图 -->
+            <include
+                android:id="@+id/layout_week_stats"
+                layout="@layout/layout_week_stats"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content" />
+
+        </ViewFlipper>
+    </androidx.core.widget.NestedScrollView>
+
 </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file

--
Gitblit v1.9.3