Skip to content

Commit c88a00d

Browse files
Merge pull request #75 from MihaiCristianCondrea/codex/update-themes.xml-for-text-styles-and-shapes
feat: add emphasized text styles with material shape overlays
2 parents 95e1db4 + 14384cd commit c88a00d

File tree

5 files changed

+60
-12
lines changed

5 files changed

+60
-12
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
android:layout_width="wrap_content"
1212
android:layout_height="wrap_content"
1313
android:text="@string/show_dialog"
14+
android:textAppearance="@style/TextAppearance.BodyLargeEmphasized"
1415
app:layout_constraintBottom_toBottomOf="parent"
1516
app:layout_constraintEnd_toEndOf="parent"
1617
app:layout_constraintStart_toStartOf="parent"
17-
app:layout_constraintTop_toTopOf="parent" />
18+
app:layout_constraintTop_toTopOf="parent"
19+
app:shapeAppearanceOverlay="@style/ShapeTokens.Clover" />
1820

1921
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
2022
android:id="@+id/floating_button_show_syntax"
@@ -28,4 +30,4 @@
2830
app:icon="@drawable/ic_code"
2931
app:layout_constraintBottom_toBottomOf="parent"
3032
app:layout_constraintEnd_toEndOf="parent" />
31-
</androidx.constraintlayout.widget.ConstraintLayout>
33+
</androidx.constraintlayout.widget.ConstraintLayout>

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

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
app:layout_constraintEnd_toEndOf="parent"
1414
app:layout_constraintTop_toTopOf="parent"
1515
app:menu="@menu/menu_share"
16+
app:shapeAppearanceOverlay="@style/ShapeTokens.Clover"
1617
app:title="@string/android_start_project" />
1718

1819
<me.zhanghai.android.fastscroll.FastScrollScrollView
@@ -30,11 +31,11 @@
3031

3132
<com.google.android.material.textview.MaterialTextView
3233
android:id="@+id/text_view_first_step"
33-
style="@style/TextAppearance.Material3.HeadlineLarge"
3434
android:layout_width="wrap_content"
3535
android:layout_height="wrap_content"
3636
android:layout_margin="24dp"
3737
android:text="@string/step1"
38+
android:textAppearance="@style/TextAppearance.TitleLargeEmphasized"
3839
android:textColor="?attr/colorSecondary"
3940
app:layout_constraintStart_toStartOf="parent"
4041
app:layout_constraintTop_toTopOf="parent" />
@@ -45,6 +46,7 @@
4546
android:layout_height="wrap_content"
4647
android:layout_margin="24dp"
4748
android:text="@string/summary_first_step"
49+
android:textAppearance="@style/TextAppearance.BodyLargeEmphasized"
4850
app:layout_constraintStart_toStartOf="parent"
4951
app:layout_constraintTop_toBottomOf="@id/text_view_first_step" />
5052

@@ -54,10 +56,10 @@
5456
android:layout_width="match_parent"
5557
android:layout_height="256dp"
5658
android:layout_margin="24dp"
57-
app:cardCornerRadius="24dp"
5859
app:layout_constraintEnd_toEndOf="parent"
5960
app:layout_constraintStart_toStartOf="parent"
60-
app:layout_constraintTop_toBottomOf="@id/text_view_first_step_summary">
61+
app:layout_constraintTop_toBottomOf="@id/text_view_first_step_summary"
62+
app:shapeAppearanceOverlay="@style/ShapeTokens.Clover">
6163

6264
<androidx.appcompat.widget.AppCompatImageView
6365
android:layout_width="match_parent"
@@ -77,11 +79,11 @@
7779

7880
<com.google.android.material.textview.MaterialTextView
7981
android:id="@+id/text_view_second_step"
80-
style="@style/TextAppearance.Material3.HeadlineLarge"
8182
android:layout_width="wrap_content"
8283
android:layout_height="wrap_content"
8384
android:layout_margin="24dp"
8485
android:text="@string/step2"
86+
android:textAppearance="@style/TextAppearance.TitleLargeEmphasized"
8587
android:textColor="?attr/colorSecondary"
8688
app:layout_constraintStart_toStartOf="parent"
8789
app:layout_constraintTop_toBottomOf="@id/ad_view" />
@@ -92,6 +94,7 @@
9294
android:layout_height="wrap_content"
9395
android:layout_margin="24dp"
9496
android:text="@string/summary_second_step"
97+
android:textAppearance="@style/TextAppearance.BodyLargeEmphasized"
9598
app:layout_constraintStart_toStartOf="parent"
9699
app:layout_constraintTop_toBottomOf="@id/text_view_second_step" />
97100

@@ -101,10 +104,10 @@
101104
android:layout_width="match_parent"
102105
android:layout_height="256dp"
103106
android:layout_margin="24dp"
104-
app:cardCornerRadius="24dp"
105107
app:layout_constraintEnd_toEndOf="parent"
106108
app:layout_constraintStart_toStartOf="parent"
107-
app:layout_constraintTop_toBottomOf="@id/text_view_second_step_summary">
109+
app:layout_constraintTop_toBottomOf="@id/text_view_second_step_summary"
110+
app:shapeAppearanceOverlay="@style/ShapeTokens.Clover">
108111

109112
<androidx.appcompat.widget.AppCompatImageView
110113
android:layout_width="match_parent"
@@ -115,11 +118,11 @@
115118

116119
<com.google.android.material.textview.MaterialTextView
117120
android:id="@+id/text_view_third_step"
118-
style="@style/TextAppearance.Material3.HeadlineLarge"
119121
android:layout_width="wrap_content"
120122
android:layout_height="wrap_content"
121123
android:layout_margin="24dp"
122124
android:text="@string/step3"
125+
android:textAppearance="@style/TextAppearance.TitleLargeEmphasized"
123126
android:textColor="?attr/colorSecondary"
124127
app:layout_constraintStart_toStartOf="parent"
125128
app:layout_constraintTop_toBottomOf="@id/card_view_second_step" />
@@ -130,6 +133,7 @@
130133
android:layout_height="wrap_content"
131134
android:layout_margin="24dp"
132135
android:text="@string/summary_third_step"
136+
android:textAppearance="@style/TextAppearance.BodyLargeEmphasized"
133137
app:layout_constraintStart_toStartOf="parent"
134138
app:layout_constraintTop_toBottomOf="@id/text_view_third_step" />
135139

@@ -139,10 +143,10 @@
139143
android:layout_width="match_parent"
140144
android:layout_height="256dp"
141145
android:layout_margin="24dp"
142-
app:cardCornerRadius="24dp"
143146
app:layout_constraintEnd_toEndOf="parent"
144147
app:layout_constraintStart_toStartOf="parent"
145-
app:layout_constraintTop_toBottomOf="@id/text_view_third_step_summary">
148+
app:layout_constraintTop_toBottomOf="@id/text_view_third_step_summary"
149+
app:shapeAppearanceOverlay="@style/ShapeTokens.Clover">
146150

147151
<androidx.appcompat.widget.AppCompatImageView
148152
android:layout_width="match_parent"

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
android:layout_width="match_parent"
1616
android:layout_height="wrap_content"
1717
app:navigationIcon="@drawable/ic_menu"
18+
app:shapeAppearanceOverlay="@style/ShapeTokens.Clover"
1819
app:title="@string/app_name" />
1920
</com.google.android.material.appbar.AppBarLayout>
2021

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<resources>
2+
<!-- Base style required for Material 3 shape tokens -->
3+
<style name="ShapeTokens" />
4+
5+
<style name="ShapeTokens.Clover" parent="ShapeTokens">
6+
<item name="cornerFamily">rounded</item>
7+
<item name="cornerSizeTopLeft">24dp</item>
8+
<item name="cornerSizeTopRight">24dp</item>
9+
<item name="cornerSizeBottomLeft">8dp</item>
10+
<item name="cornerSizeBottomRight">8dp</item>
11+
</style>
12+
</resources>

app/src/main/res/values/themes.xml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,35 @@
2828
<item name="dialogCornerRadius">28dp</item>
2929
<item name="alertDialogTheme">@style/ThemeOverlay.Material3.MaterialAlertDialog</item>
3030
<item name="switchPreferenceCompatStyle">@style/switchPreferenceCompatStyle</item>
31+
<!-- Apply emphasized text appearances -->
32+
<item name="textAppearanceTitleLarge">@style/TextAppearance.TitleLargeEmphasized</item>
33+
<item name="textAppearanceBodyLarge">@style/TextAppearance.BodyLargeEmphasized</item>
34+
<!-- Map custom widget styles using Material 3 shape tokens -->
35+
<item name="toolbarStyle">@style/Widget.App.Toolbar.Clover</item>
36+
<item name="materialCardViewStyle">@style/Widget.App.CardView.Clover</item>
37+
<item name="materialButtonStyle">@style/Widget.App.Button.Clover</item>
38+
</style>
39+
40+
<!-- Emphasized text appearances -->
41+
<style name="TextAppearance.TitleLargeEmphasized" parent="TextAppearance.Material3.TitleLarge">
42+
<item name="android:textStyle">bold</item>
43+
</style>
44+
45+
<style name="TextAppearance.BodyLargeEmphasized" parent="TextAppearance.Material3.BodyLarge">
46+
<item name="android:textStyle">bold</item>
47+
</style>
48+
49+
<!-- Widget styles using Material 3 shape tokens -->
50+
<style name="Widget.App.Toolbar.Clover" parent="@style/Widget.Material3.Toolbar">
51+
<item name="shapeAppearanceOverlay">@style/ShapeTokens.Clover</item>
52+
</style>
53+
54+
<style name="Widget.App.CardView.Clover" parent="@style/Widget.Material3.CardView.Outlined">
55+
<item name="shapeAppearanceOverlay">@style/ShapeTokens.Clover</item>
56+
</style>
57+
58+
<style name="Widget.App.Button.Clover" parent="@style/Widget.Material3.Button">
59+
<item name="shapeAppearance">@style/ShapeTokens.Clover</item>
3160
</style>
3261

3362
<style name="ShapeAppearanceOverlay.CardView" parent="">
@@ -61,4 +90,4 @@
6190
<style name="switchPreferenceCompatStyle" parent="@style/Preference.SwitchPreferenceCompat.Material">
6291
<item name="widgetLayout">@layout/preference_switch_widget_layout</item>
6392
</style>
64-
</resources>
93+
</resources>

0 commit comments

Comments
 (0)