-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit cd83f64
committed
Refactor preferences and Android Studio lessons to use Material 3 components
This commit updates the styling of preference items and Android Studio lesson items to align with Material 3 guidelines.
Specific changes include:
- Renamed layout files:
- `item_android_studio_lesson.xml` to `item_preference.xml`
- `item_android_studio_category.xml` to `item_preference_category.xml`
- Updated `AndroidStudioFragment.java`:
- Inflates `item_preference.xml` and `item_preference_category.xml` directly instead of using data binding for these layouts.
- Updated `LessonHolder` and `CategoryHolder` to use standard `findViewById` with new Android system IDs for title, summary, icon, etc.
- `LessonHolder` now inflates `item_preference_widget_open_in_new.xml` into its `widgetFrame`.
- Handles visibility and clickability of the external link button more robustly.
- Updated `preferences_settings.xml`:
- Assigns `item_preference_category.xml` as the layout for `PreferenceCategory`.
- Assigns `item_preference.xml` as the layout for individual `Preference` and `ListPreference` items.
- Assigns `widget_preference_switch.xml` as the `widgetLayout` for `SwitchPreferenceCompat`.
- Assigns `item_preference_widget_open_notifications.xml` and `item_preference_widget_open_in_new.xml` as `widgetLayout` for specific preferences.
- Sets `app:iconSpaceReserved="false"` for preferences to allow icon visibility to be controlled by the presence of an icon.
- Created `SettingsFragment.java`:
- Implements custom styling for preference items within a `RecyclerView`.
- Adds `PreferenceSpacingDecoration` to manage spacing between preference items.
- Dynamically updates the corner radius of `MaterialCardView` for preferences to create a grouped appearance within categories (first item has rounded top corners, last item has rounded bottom corners).
- Synchronizes the visibility of icon frames and widget frames based on the visibility of their content.
- Added new layout files:
- `item_preference_widget_open_notifications.xml`: Layout for an icon button to open notification settings.
- `item_preference_widget_open_in_new.xml`: Layout for an icon button to open links in a new window/browser.
- Added `ic_arrow_outward.xml` drawable.
- Modified `widget_preference_switch.xml`:
- Changed ID to `@android:id/switch_widget`.
- Set `clickable` and `focusable` to true.
- Added `preference_list_vertical_padding` dimension in `dimens.xml`.
- Added padding to the bottom of `activity_help.xml`'s ScrollView content.1 parent 7810403 commit cd83f64
File tree
10 files changed
+425
-55
lines changed- app/src/main
- java/com/d4rk/androidtutorials/java/ui/screens
- android
- settings
- res
- layout
- values
- xml
10 files changed
+425
-55
lines changedLines changed: 40 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | + | ||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | - | ||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | - | ||
34 | - | ||
35 | 33 | | |
36 | 34 | | |
37 | 35 | | |
38 | 36 | | |
37 | + | ||
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
| |||
375 | 374 | | |
376 | 375 | | |
377 | 376 | | |
378 | - | ||
379 | - | ||
380 | - | ||
377 | + | ||
378 | + | ||
379 | + | ||
381 | 380 | | |
382 | - | ||
383 | - | ||
384 | - | ||
381 | + | ||
382 | + | ||
383 | + | ||
385 | 384 | | |
386 | 385 | | |
387 | 386 | | |
| |||
425 | 424 | | |
426 | 425 | | |
427 | 426 | | |
428 | - | ||
427 | + | ||
429 | 428 | | |
430 | 429 | | |
430 | + | ||
431 | 431 | | |
432 | + | ||
432 | 433 | | |
433 | - | ||
434 | - | ||
435 | - | ||
436 | - | ||
437 | - | ||
438 | - | ||
439 | - | ||
434 | + | ||
435 | + | ||
436 | + | ||
437 | + | ||
438 | + | ||
439 | + | ||
440 | + | ||
441 | + | ||
442 | + | ||
443 | + | ||
444 | + | ||
440 | 445 | | |
441 | 446 | | |
442 | 447 | | |
443 | 448 | | |
444 | 449 | | |
445 | 450 | | |
451 | + | ||
452 | + | ||
453 | + | ||
446 | 454 | | |
447 | 455 | | |
456 | + | ||
457 | + | ||
458 | + | ||
448 | 459 | | |
449 | 460 | | |
450 | 461 | | |
| |||
454 | 465 | | |
455 | 466 | | |
456 | 467 | | |
468 | + | ||
457 | 469 | | |
470 | + | ||
471 | + | ||
458 | 472 | | |
473 | + | ||
474 | + | ||
475 | + | ||
459 | 476 | | |
460 | 477 | | |
478 | + | ||
479 | + | ||
480 | + | ||
461 | 481 | | |
462 | 482 | | |
463 | 483 | | |
| |||
485 | 505 | | |
486 | 506 | | |
487 | 507 | | |
488 | - | ||
489 | - | ||
490 | - | ||
508 | + | ||
509 | + | ||
510 | + | ||
491 | 511 | | |
492 | 512 | | |
493 | 513 | | |
| |||
Lines changed: 227 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | + | ||
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
13 | + | ||
14 | + | ||
15 | + | ||
16 | + | ||
12 | 17 | | |
13 | 18 | | |
19 | + | ||
20 | + | ||
14 | 21 | | |
15 | 22 | | |
23 | + | ||
16 | 24 | | |
25 | + | ||
17 | 26 | | |
27 | + | ||
18 | 28 | | |
19 | 29 | | |
20 | 30 | | |
21 | 31 | | |
32 | + | ||
33 | + | ||
34 | + | ||
22 | 35 | | |
23 | 36 | | |
37 | + | ||
38 | + | ||
39 | + | ||
40 | + | ||
41 | + | ||
42 | + | ||
43 | + | ||
44 | + | ||
45 | + | ||
24 | 46 | | |
25 | 47 | | |
26 | 48 | | |
| |||
96 | 118 | | |
97 | 119 | | |
98 | 120 | | |
99 | - | ||
121 | + | ||
122 | + | ||
123 | + | ||
124 | + | ||
125 | + | ||
126 | + | ||
127 | + | ||
128 | + | ||
129 | + | ||
130 | + | ||
131 | + | ||
132 | + | ||
133 | + | ||
134 | + | ||
135 | + | ||
136 | + | ||
137 | + | ||
138 | + | ||
139 | + | ||
140 | + | ||
141 | + | ||
142 | + | ||
143 | + | ||
144 | + | ||
145 | + | ||
146 | + | ||
147 | + | ||
148 | + | ||
149 | + | ||
150 | + | ||
151 | + | ||
152 | + | ||
153 | + | ||
154 | + | ||
155 | + | ||
156 | + | ||
157 | + | ||
158 | + | ||
159 | + | ||
160 | + | ||
161 | + | ||
162 | + | ||
163 | + | ||
164 | + | ||
165 | + | ||
166 | + | ||
167 | + | ||
168 | + | ||
169 | + | ||
170 | + | ||
171 | + | ||
172 | + | ||
173 | + | ||
174 | + | ||
175 | + | ||
176 | + | ||
177 | + | ||
178 | + | ||
179 | + | ||
180 | + | ||
181 | + | ||
182 | + | ||
183 | + | ||
184 | + | ||
185 | + | ||
186 | + | ||
187 | + | ||
188 | + | ||
189 | + | ||
190 | + | ||
191 | + | ||
192 | + | ||
193 | + | ||
194 | + | ||
195 | + | ||
196 | + | ||
197 | + | ||
198 | + | ||
199 | + | ||
200 | + | ||
201 | + | ||
202 | + | ||
203 | + | ||
204 | + | ||
205 | + | ||
206 | + | ||
207 | + | ||
208 | + | ||
209 | + | ||
210 | + | ||
211 | + | ||
212 | + | ||
213 | + | ||
214 | + | ||
215 | + | ||
216 | + | ||
217 | + | ||
218 | + | ||
219 | + | ||
220 | + | ||
221 | + | ||
222 | + | ||
223 | + | ||
224 | + | ||
225 | + | ||
226 | + | ||
227 | + | ||
228 | + | ||
229 | + | ||
230 | + | ||
231 | + | ||
232 | + | ||
233 | + | ||
234 | + | ||
235 | + | ||
236 | + | ||
237 | + | ||
238 | + | ||
239 | + | ||
240 | + | ||
241 | + | ||
242 | + | ||
243 | + | ||
244 | + | ||
245 | + | ||
246 | + | ||
247 | + | ||
248 | + | ||
249 | + | ||
250 | + | ||
251 | + | ||
252 | + | ||
253 | + | ||
254 | + | ||
255 | + | ||
256 | + | ||
257 | + | ||
258 | + | ||
259 | + | ||
260 | + | ||
261 | + | ||
262 | + | ||
263 | + | ||
264 | + | ||
265 | + | ||
266 | + | ||
267 | + | ||
268 | + | ||
269 | + | ||
270 | + | ||
271 | + | ||
272 | + | ||
273 | + | ||
274 | + | ||
275 | + | ||
276 | + | ||
277 | + | ||
278 | + | ||
279 | + | ||
280 | + | ||
281 | + | ||
282 | + | ||
283 | + | ||
284 | + | ||
285 | + | ||
286 | + | ||
287 | + | ||
288 | + | ||
289 | + | ||
290 | + | ||
291 | + | ||
292 | + | ||
293 | + | ||
294 | + | ||
295 | + | ||
296 | + | ||
297 | + | ||
298 | + | ||
299 | + | ||
300 | + | ||
301 | + | ||
302 | + | ||
303 | + | ||
304 | + | ||
305 | + | ||
306 | + | ||
307 | + | ||
308 | + | ||
309 | + | ||
310 | + | ||
311 | + | ||
312 | + | ||
313 | + | ||
314 | + | ||
315 | + | ||
316 | + | ||
317 | + | ||
318 | + | ||
319 | + | ||
320 | + | ||
321 | + | ||
322 | + | ||
323 | + | ||
324 | + | ||
325 | + | ||
0 commit comments