Skip to content

Commit c685368

Browse files
Refine theme selection UI and add tools namespace
1 parent 1a4ae7a commit c685368

File tree

16 files changed

+75
-67
lines changed

16 files changed

+75
-67
lines changed

app/src/main/java/com/d4rk/androidtutorials/java/ui/screens/onboarding/ThemeFragment.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ public void saveSelection() {
3939
value = values[1];
4040
} else if (checkedId == R.id.radio_dark) {
4141
value = values[2];
42-
} else if (checkedId == R.id.radio_auto_battery) {
43-
value = values[3];
4442
}
4543
viewModel.setTheme(value);
4644
}
Lines changed: 54 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,67 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
2+
<androidx.constraintlayout.widget.ConstraintLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
34
xmlns:app="http://schemas.android.com/apk/res-auto"
5+
xmlns:tools="http://schemas.android.com/tools"
46
android:layout_width="match_parent"
5-
android:layout_height="match_parent">
7+
android:layout_height="match_parent"
8+
android:padding="24dp"
9+
tools:theme="@style/Theme.Material3.Dark">
610

7-
<LinearLayout
8-
android:layout_width="match_parent"
11+
<com.google.android.material.textview.MaterialTextView
12+
android:id="@+id/title"
13+
android:layout_width="wrap_content"
914
android:layout_height="wrap_content"
15+
android:layout_marginTop="32dp"
16+
android:text="@string/choose_your_style"
17+
android:textAppearance="?attr/textAppearanceHeadlineMedium"
18+
app:layout_constraintTop_toTopOf="parent"
19+
app:layout_constraintStart_toStartOf="parent"
20+
app:layout_constraintEnd_toEndOf="parent" />
21+
22+
<com.google.android.material.textview.MaterialTextView
23+
android:id="@+id/description"
24+
android:layout_width="0dp"
25+
android:layout_height="wrap_content"
26+
android:layout_marginTop="8dp"
27+
android:text="@string/select_how_you_d_like_the_app_to_look"
28+
android:textAppearance="?attr/textAppearanceBodyMedium"
29+
android:textColor="?attr/colorOnSurfaceVariant"
30+
app:layout_constraintTop_toBottomOf="@id/title"
31+
app:layout_constraintStart_toStartOf="parent"
32+
app:layout_constraintEnd_toEndOf="parent" />
33+
34+
<RadioGroup
35+
android:id="@+id/theme_group"
36+
android:layout_width="0dp"
37+
android:layout_height="wrap_content"
38+
android:layout_marginTop="24dp"
1039
android:orientation="vertical"
11-
android:padding="24dp">
40+
app:layout_constraintTop_toBottomOf="@id/description"
41+
app:layout_constraintStart_toStartOf="parent"
42+
app:layout_constraintEnd_toEndOf="parent">
1243

13-
<com.google.android.material.card.MaterialCardView
44+
<com.google.android.material.radiobutton.MaterialRadioButton
45+
android:id="@+id/radio_system"
1446
android:layout_width="match_parent"
1547
android:layout_height="wrap_content"
16-
android:padding="16dp"
17-
app:cardElevation="0dp">
18-
19-
<LinearLayout
20-
android:layout_width="match_parent"
21-
android:layout_height="wrap_content"
22-
android:orientation="vertical">
23-
24-
<com.google.android.material.textview.MaterialTextView
25-
style="@style/TextAppearance.Material3.TitleLarge"
26-
android:layout_width="wrap_content"
27-
android:layout_height="wrap_content"
28-
android:layout_marginBottom="16dp"
29-
android:text="@string/theme" />
48+
android:checked="true"
49+
android:text="@string/follow_system"
50+
android:layout_marginBottom="16dp" />
3051

31-
<RadioGroup
32-
android:id="@+id/theme_group"
33-
android:layout_width="match_parent"
34-
android:layout_height="wrap_content">
35-
36-
<com.google.android.material.radiobutton.MaterialRadioButton
37-
android:id="@+id/radio_system"
38-
android:layout_width="wrap_content"
39-
android:layout_height="wrap_content"
40-
android:checked="true"
41-
android:text="@string/follow_system" />
42-
43-
<com.google.android.material.radiobutton.MaterialRadioButton
44-
android:id="@+id/radio_light"
45-
android:layout_width="wrap_content"
46-
android:layout_height="wrap_content"
47-
android:text="@string/light_mode" />
52+
<com.google.android.material.radiobutton.MaterialRadioButton
53+
android:id="@+id/radio_light"
54+
android:layout_width="match_parent"
55+
android:layout_height="wrap_content"
56+
android:text="@string/light_mode"
57+
android:layout_marginBottom="16dp" />
4858

49-
<com.google.android.material.radiobutton.MaterialRadioButton
50-
android:id="@+id/radio_dark"
51-
android:layout_width="wrap_content"
52-
android:layout_height="wrap_content"
53-
android:text="@string/dark_mode" />
59+
<com.google.android.material.radiobutton.MaterialRadioButton
60+
android:id="@+id/radio_dark"
61+
android:layout_width="match_parent"
62+
android:layout_height="wrap_content"
63+
android:text="@string/dark_mode" />
5464

55-
<com.google.android.material.radiobutton.MaterialRadioButton
56-
android:id="@+id/radio_auto_battery"
57-
android:layout_width="wrap_content"
58-
android:layout_height="wrap_content"
59-
android:text="@string/auto_battery_mode" />
60-
</RadioGroup>
61-
</LinearLayout>
62-
</com.google.android.material.card.MaterialCardView>
65+
</RadioGroup>
6366

64-
</LinearLayout>
65-
</ScrollView>
67+
</androidx.constraintlayout.widget.ConstraintLayout>

app/src/main/res/values-bg-rBG/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version='1.0' encoding='utf-8'?>
2-
<resources>
2+
<resources xmlns:tools="http://schemas.android.com/tools">
33
<string name="image_view_preview_desc">Преглед на изображението</string>
44
<string name="app_short_description">Научете как да създавате прости Java приложения в Android Studio. 📱</string>
55
<string name="notification_update_title">Налична е нова актуализация.</string>

app/src/main/res/values-fil-rPH/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version='1.0' encoding='utf-8'?>
2-
<resources>
2+
<resources xmlns:tools="http://schemas.android.com/tools">
33
<string name="image_view_preview_desc">Paunang tingin sa image view</string>
44
<string name="app_short_description">Alamin kung paano gumawa ng mga simpleng Java app sa Android Studio. 📱</string>
55
<string name="notification_update_title">May bagong update na available.</string>

app/src/main/res/values-hu-rHU/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<resources>
2+
<resources xmlns:tools="http://schemas.android.com/tools">
33
<string name="image_view_preview_desc">Képnézet előnézete</string>
44
<string name="app_short_description">Tanuld meg, hogyan készíts egyszerű Java alkalmazásokat az Android Studioban. 📱</string>
55
<string name="notification_update_title">Új frissítés érhető el.</string>

app/src/main/res/values-in-rID/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version='1.0' encoding='utf-8'?>
2-
<resources>
2+
<resources xmlns:tools="http://schemas.android.com/tools">
33
<string name="image_view_preview_desc">Pratinjau tampilan gambar</string>
44
<string name="app_short_description">Pelajari cara membuat aplikasi sederhana di Android Studio. 📱</string>
55
<string name="notification_update_title">Pembaruan baru tersedia.</string>

app/src/main/res/values-ko-rKR/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version='1.0' encoding='utf-8'?>
2-
<resources>
2+
<resources xmlns:tools="http://schemas.android.com/tools">
33
<string name="image_view_preview_desc">이미지 뷰 미리보기</string>
44
<string name="app_short_description">Android Studio에서 간단한 Java 앱을 만드는 방법을 배워보세요. 📱</string>
55
<string name="notification_update_title">새로운 업데이트가 있습니다.</string>

app/src/main/res/values-pl-rPL/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<resources>
2+
<resources xmlns:tools="http://schemas.android.com/tools">
33
<string name="image_view_preview_desc">Podgląd widoku obrazu</string>
44
<string name="app_short_description">Naucz się tworzyć proste aplikacje Java w Android Studio. 📱</string>
55
<string name="notification_update_title">Dostępna jest nowa aktualizacja.</string>

app/src/main/res/values-ru-rRU/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version='1.0' encoding='utf-8'?>
2-
<resources>
2+
<resources xmlns:tools="http://schemas.android.com/tools">
33
<string name="image_view_preview_desc">Предпросмотр изображения</string>
44
<string name="app_short_description">Узнайте, как создавать простые приложения в Android Studio. 📱</string>
55
<string name="notification_update_title">Доступно новое обновление.</string>

app/src/main/res/values-sv-rSE/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version='1.0' encoding='utf-8'?>
2-
<resources>
2+
<resources xmlns:tools="http://schemas.android.com/tools">
33
<string name="image_view_preview_desc">Förhandsgranskning av bildvy</string>
44
<string name="app_short_description">Lär dig hur man skapar enkla Java-appar i Android Studio. 📱</string>
55
<string name="notification_update_title">En ny uppdatering finns tillgänglig.</string>

0 commit comments

Comments
 (0)