cloudroam
2025-03-04 2a117297daf83b2e1a104603e9641226d5beeba3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?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"
    tools:context=".ui.dashboard.DashboardFragment">
 
    <!-- 时间范围选择器 -->
    <com.google.android.material.tabs.TabLayout
        android:id="@+id/tab_date_range"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        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">
 
            <ImageView
                android:layout_width="0dp"
                android:layout_height="48dp"
                android:layout_weight="1"
                android:src="@drawable/resource_package" />
 
            <TextView
                android:id="@+id/text_package_count"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:layout_marginStart="16dp"
                android:layout_weight="1"
                android:textSize="24sp"
                android:textStyle="bold"
                tools:text="4个" />
        </LinearLayout>
    </androidx.cardview.widget.CardView>
 
    <!-- 包裹列表 -->
    <ViewFlipper
        android:id="@+id/view_flipper_stats"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintTop_toBottomOf="@id/card_package_stats">
 
        <!-- 日视图 -->
        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/recycler_packages"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
 
        <!-- 周视图 -->
        <include
            android:id="@+id/layout_week_stats"
            layout="@layout/layout_week_stats"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
 
        <!-- 月视图和年视图可以根据需要添加 -->
 
    </ViewFlipper>
 
</androidx.constraintlayout.widget.ConstraintLayout>