Skip to content

Commit 6e21627

Browse files
committed
feat: redesign library fragment to material3 expressive
1 parent dccc1f9 commit 6e21627

2 files changed

Lines changed: 96 additions & 126 deletions

File tree

app/src/main/java/com/github/libretube/ui/fragments/LibraryFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class LibraryFragment : DynamicLayoutManagerFragment(R.layout.fragment_library)
155155

156156
val binding = _binding ?: return@launch
157157

158-
binding.bookmarksCV.isVisible = bookmarks.isNotEmpty()
158+
binding.bookmarksContainer.isVisible = bookmarks.isNotEmpty()
159159
if (bookmarks.isNotEmpty()) {
160160
playlistBookmarkAdapter.submitList(bookmarks)
161161
}

app/src/main/res/layout/fragment_library.xml

Lines changed: 95 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
<com.github.libretube.ui.views.CustomSwipeToRefresh
1010
android:id="@+id/playlist_refresh"
1111
android:layout_width="match_parent"
12-
android:layout_height="match_parent"
13-
android:layout_margin="10dp">
12+
android:layout_height="match_parent">
1413

1514
<androidx.core.widget.NestedScrollView
1615
android:layout_width="match_parent"
@@ -22,160 +21,131 @@
2221
android:layout_height="wrap_content"
2322
android:orientation="vertical">
2423

25-
<com.google.android.material.card.MaterialCardView
26-
style="@style/Widget.Material3.CardView.Elevated"
24+
<LinearLayout
25+
android:layout_width="wrap_content"
26+
android:layout_height="wrap_content"
27+
android:orientation="horizontal"
28+
android:layout_gravity="center"
29+
android:paddingVertical="6dp">
30+
31+
<com.google.android.material.button.MaterialButton
32+
android:id="@+id/watch_history"
33+
android:layout_width="wrap_content"
34+
android:layout_height="wrap_content"
35+
android:paddingHorizontal="15dp"
36+
android:paddingVertical="15dp"
37+
android:text="@string/watch_history"
38+
android:textAlignment="viewStart"
39+
android:textSize="18sp"
40+
android:textStyle="bold"
41+
app:icon="@drawable/ic_time_outlined"
42+
android:layout_marginEnd="10dp"/>
43+
44+
<com.google.android.material.button.MaterialButton
45+
android:id="@+id/downloads"
46+
android:layout_width="wrap_content"
47+
android:layout_height="wrap_content"
48+
android:paddingHorizontal="15dp"
49+
android:paddingVertical="15dp"
50+
android:text="@string/downloads"
51+
android:textSize="18sp"
52+
android:textStyle="bold"
53+
app:icon="@drawable/ic_download"
54+
android:layout_gravity="end" />
55+
56+
</LinearLayout>
57+
58+
<LinearLayout
2759
android:layout_width="match_parent"
28-
android:layout_height="wrap_content">
60+
android:layout_height="wrap_content"
61+
android:orientation="vertical"
62+
android:paddingVertical="10dp">
2963

3064
<LinearLayout
3165
android:layout_width="match_parent"
3266
android:layout_height="wrap_content"
33-
android:orientation="vertical">
67+
android:orientation="horizontal">
3468

3569
<TextView
36-
android:id="@+id/watch_history"
37-
android:layout_width="match_parent"
70+
android:layout_width="0dp"
3871
android:layout_height="wrap_content"
39-
android:background="?attr/selectableItemBackground"
40-
android:drawablePadding="10dp"
41-
android:paddingHorizontal="15dp"
42-
android:paddingVertical="12dp"
43-
android:text="@string/watch_history"
72+
android:layout_weight="1"
73+
android:maxLines="1"
74+
android:padding="8dp"
75+
android:text="@string/playlists"
4476
android:textAlignment="viewStart"
4577
android:textSize="18sp"
46-
android:textStyle="bold"
47-
app:drawableStartCompat="@drawable/ic_time_outlined" />
78+
android:textStyle="bold" />
4879

49-
<TextView
50-
android:id="@+id/downloads"
51-
android:layout_width="match_parent"
80+
<com.google.android.material.button.MaterialButton
81+
style="?materialButtonTonalStyle"
82+
android:id="@+id/sortTV"
83+
android:layout_width="wrap_content"
5284
android:layout_height="wrap_content"
53-
android:background="?attr/selectableItemBackground"
54-
android:drawablePadding="10dp"
55-
android:paddingHorizontal="15dp"
56-
android:paddingVertical="12dp"
57-
android:text="@string/downloads"
58-
android:textAlignment="viewStart"
59-
android:textSize="18sp"
60-
android:textStyle="bold"
61-
app:drawableStartCompat="@drawable/ic_download" />
85+
android:ellipsize="end"
86+
android:maxLines="1"
87+
android:paddingHorizontal="10dp"
88+
android:text="@string/creation_date"
89+
android:tooltipText="@string/tooltip_sort"
90+
app:icon="@drawable/ic_sort"
91+
app:iconGravity="textEnd" />
6292

6393
</LinearLayout>
6494

65-
</com.google.android.material.card.MaterialCardView>
66-
67-
<com.google.android.material.card.MaterialCardView
68-
style="@style/Widget.Material3.CardView.Elevated"
69-
android:layout_width="match_parent"
70-
android:layout_height="wrap_content"
71-
android:layout_marginTop="20dp"
72-
android:layout_marginBottom="10dp"
73-
android:layout_weight="1">
74-
7595
<LinearLayout
96+
android:id="@+id/nothing_here"
7697
android:layout_width="match_parent"
77-
android:layout_height="wrap_content"
98+
android:layout_height="match_parent"
99+
android:layout_marginBottom="35dp"
78100
android:orientation="vertical"
79-
android:padding="10dp">
101+
android:visibility="gone">
80102

81-
<LinearLayout
82-
android:layout_width="match_parent"
83-
android:layout_height="wrap_content"
84-
android:orientation="horizontal">
85-
86-
<TextView
87-
android:layout_width="wrap_content"
88-
android:layout_height="wrap_content"
89-
android:maxLines="1"
90-
android:padding="8dp"
91-
android:text="@string/playlists"
92-
android:textAlignment="viewStart"
93-
android:textSize="18sp"
94-
android:textStyle="bold" />
95-
96-
<TextView
97-
android:id="@+id/sortTV"
98-
android:layout_width="0dp"
99-
android:tooltipText="@string/tooltip_sort"
100-
android:layout_height="wrap_content"
101-
android:layout_weight="1"
102-
android:drawablePadding="5dp"
103-
android:ellipsize="end"
104-
android:maxLines="1"
105-
android:paddingHorizontal="10dp"
106-
android:text="@string/creation_date"
107-
android:textAlignment="textEnd"
108-
android:textSize="16sp"
109-
app:drawableEndCompat="@drawable/ic_sort" />
110-
111-
</LinearLayout>
112-
113-
<LinearLayout
114-
android:id="@+id/nothing_here"
115-
android:layout_width="match_parent"
116-
android:layout_height="match_parent"
117-
android:layout_marginBottom="35dp"
118-
android:orientation="vertical"
119-
android:visibility="gone">
120-
121-
<ImageView
122-
android:layout_width="100dp"
123-
android:layout_height="100dp"
124-
android:layout_gravity="center"
125-
android:src="@drawable/ic_list" />
126-
127-
<TextView
128-
android:layout_width="wrap_content"
129-
android:layout_height="wrap_content"
130-
android:layout_gravity="center"
131-
android:text="@string/emptyList"
132-
android:textSize="20sp"
133-
android:textStyle="bold" />
134-
</LinearLayout>
135-
136-
<androidx.recyclerview.widget.RecyclerView
137-
android:id="@+id/playlist_recView"
138-
android:layout_width="match_parent"
139-
android:layout_height="wrap_content"
140-
android:nestedScrollingEnabled="false" />
103+
<ImageView
104+
android:layout_width="100dp"
105+
android:layout_height="100dp"
106+
android:layout_gravity="center"
107+
android:src="@drawable/ic_list" />
141108

109+
<TextView
110+
android:layout_width="wrap_content"
111+
android:layout_height="wrap_content"
112+
android:layout_gravity="center"
113+
android:text="@string/emptyList"
114+
android:textSize="20sp"
115+
android:textStyle="bold" />
142116
</LinearLayout>
143117

144-
</com.google.android.material.card.MaterialCardView>
118+
<androidx.recyclerview.widget.RecyclerView
119+
android:id="@+id/playlist_recView"
120+
android:layout_width="match_parent"
121+
android:layout_height="wrap_content"
122+
android:nestedScrollingEnabled="false" />
145123

146-
<com.google.android.material.card.MaterialCardView
147-
android:id="@+id/bookmarksCV"
148-
style="@style/Widget.Material3.CardView.Elevated"
124+
</LinearLayout>
125+
126+
<LinearLayout
127+
android:id="@+id/bookmarksContainer"
149128
android:layout_width="match_parent"
150129
android:layout_height="wrap_content"
151-
android:layout_marginTop="10dp"
152-
android:layout_marginBottom="10dp"
153-
android:layout_weight="1"
154-
android:visibility="gone">
130+
android:orientation="vertical"
131+
android:paddingVertical="10dp">
155132

156-
<LinearLayout
133+
<TextView
157134
android:layout_width="match_parent"
158135
android:layout_height="wrap_content"
159-
android:orientation="vertical"
160-
android:padding="10dp">
161-
162-
<TextView
163-
android:layout_width="match_parent"
164-
android:layout_height="wrap_content"
165-
android:padding="8dp"
166-
android:text="@string/bookmarks"
167-
android:textSize="18sp"
168-
android:textStyle="bold" />
136+
android:padding="8dp"
137+
android:text="@string/bookmarks"
138+
android:textSize="18sp"
139+
android:textStyle="bold" />
169140

170-
<androidx.recyclerview.widget.RecyclerView
171-
android:id="@+id/bookmarks_recView"
172-
android:layout_width="match_parent"
173-
android:layout_height="wrap_content"
174-
android:nestedScrollingEnabled="false" />
141+
<androidx.recyclerview.widget.RecyclerView
142+
android:id="@+id/bookmarks_recView"
143+
android:layout_width="match_parent"
144+
android:layout_height="wrap_content"
145+
android:nestedScrollingEnabled="false" />
175146

176-
</LinearLayout>
147+
</LinearLayout>
177148

178-
</com.google.android.material.card.MaterialCardView>
179149
</LinearLayout>
180150

181151
</androidx.core.widget.NestedScrollView>

0 commit comments

Comments
 (0)