Skip to content

Commit 2d3471f

Browse files
pekingmedrchen
authored andcommitted
[Theme] Added the Expressive themes.
PiperOrigin-RevId: 724438050
1 parent 755981a commit 2d3471f

File tree

14 files changed

+364
-81
lines changed

14 files changed

+364
-81
lines changed

catalog/java/io/material/catalog/application/theme/res/values/themes.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
-->
1717
<resources xmlns:tools="http://schemas.android.com/tools">
1818

19-
<style name="Theme.Catalog" parent="Theme.Material3.DayNight.NoActionBar">
19+
<style name="Theme.Catalog" parent="Theme.Material3Expressive.DayNight.NoActionBar">
2020
<item name="preferenceTheme">@style/CatalogPreferenceThemeOverlay</item>
2121
<item name="catalogToolbarStyle">@style/Widget.Catalog.Toolbar</item>
2222
<item name="catalogToolbarWithCloseButtonStyle">@style/Widget.Catalog.Toolbar.WithCloseButton</item>

lib/java/com/google/android/material/dialog/res/values/themes.xml

Lines changed: 61 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,43 +15,48 @@
1515
~ limitations under the License.
1616
-->
1717
<resources>
18-
<!-- Themes for MaterialComponents Dialogs. -->
18+
<!-- Themes for M3 Expressive Dialogs. -->
1919

2020
<!--
21-
Themes in the "Theme.MaterialComponents" family will contain a default full color scheme.
21+
Themes in the "Theme.Material3Expressive" family will contain a default full color scheme.
2222
2323
These theme declarations contain any version-independent specification. Items
2424
that need to vary based on platform version should be defined in the corresponding
2525
"Base.Theme" theme.
2626
-->
2727

28-
<style name="Theme.MaterialComponents.Dialog" parent="Base.Theme.MaterialComponents.Dialog"/>
29-
30-
<style name="Theme.MaterialComponents.Light.Dialog" parent="Base.Theme.MaterialComponents.Light.Dialog"/>
28+
<style name="Theme.Material3Expressive.Light.Dialog" parent="Base.Theme.Material3Expressive.Light.Dialog"/>
29+
<style name="Theme.Material3Expressive.Dark.Dialog" parent="Base.Theme.Material3Expressive.Dark.Dialog"/>
3130

3231
<!--
33-
Material theme for alert dialog windows, which is used by the AlertDialog class.
32+
Material 3 Expressive theme for alert dialog windows, which is used by the AlertDialog class.
3433
This is basically a dialog but sets the background to empty so it can do
3534
two-tone backgrounds. For applications targeting Honeycomb or newer, this is the default
3635
AlertDialog theme.
3736
-->
38-
<style name="Theme.MaterialComponents.Dialog.Alert" parent="Base.Theme.MaterialComponents.Dialog.Alert"/>
37+
<style name="Theme.Material3Expressive.Light.Dialog.Alert" parent="Base.Theme.Material3Expressive.Light.Dialog">
38+
<item name="windowMinWidthMajor">@dimen/abc_dialog_min_width_major</item>
39+
<item name="windowMinWidthMinor">@dimen/abc_dialog_min_width_minor</item>
40+
</style>
3941

40-
<style name="Theme.MaterialComponents.Light.Dialog.Alert" parent="Base.Theme.MaterialComponents.Light.Dialog.Alert"/>
42+
<style name="Theme.Material3Expressive.Dark.Dialog.Alert" parent="Base.Theme.Material3Expressive.Dark.Dialog">
43+
<item name="windowMinWidthMajor">@dimen/abc_dialog_min_width_major</item>
44+
<item name="windowMinWidthMinor">@dimen/abc_dialog_min_width_minor</item>
45+
</style>
4146

4247
<!--
43-
Variant of Theme.MaterialComponents.Dialog that has a nice minimum width for a regular dialog.
48+
Variant of Theme.Material3Expressive.Dialog that has a nice minimum width for a regular dialog.
4449
-->
45-
<style name="Theme.MaterialComponents.Dialog.MinWidth" parent="Base.Theme.MaterialComponents.Dialog.MinWidth"/>
46-
47-
<style name="Theme.MaterialComponents.Light.Dialog.MinWidth" parent="Base.Theme.MaterialComponents.Light.Dialog.MinWidth"/>
50+
<style name="Theme.Material3Expressive.Light.Dialog.MinWidth" parent="Base.Theme.Material3Expressive.Light.Dialog">
51+
<item name="windowMinWidthMajor">@dimen/abc_dialog_min_width_major</item>
52+
<item name="windowMinWidthMinor">@dimen/abc_dialog_min_width_minor</item>
53+
</style>
4854

49-
<!--
50-
Variant of Theme.MaterialComponents.Dialog that has a fixed size for a regular dialog.
51-
-->
52-
<style name="Theme.MaterialComponents.Dialog.FixedSize" parent="Base.Theme.MaterialComponents.Dialog.FixedSize"/>
55+
<style name="Theme.Material3Expressive.Dark.Dialog.MinWidth" parent="Base.Theme.Material3Expressive.Dark.Dialog">
56+
<item name="windowMinWidthMajor">@dimen/abc_dialog_min_width_major</item>
57+
<item name="windowMinWidthMinor">@dimen/abc_dialog_min_width_minor</item>
58+
</style>
5359

54-
<style name="Theme.MaterialComponents.Light.Dialog.FixedSize" parent="Base.Theme.MaterialComponents.Light.Dialog.FixedSize"/>
5560

5661
<!-- Themes for M3 Dialogs. -->
5762

@@ -67,7 +72,7 @@
6772
<style name="Theme.Material3.Dark.Dialog" parent="Base.Theme.Material3.Dark.Dialog"/>
6873

6974
<!--
70-
Material theme for alert dialog windows, which is used by the AlertDialog class.
75+
Material 3 theme for alert dialog windows, which is used by the AlertDialog class.
7176
This is basically a dialog but sets the background to empty so it can do
7277
two-tone backgrounds. For applications targeting Honeycomb or newer, this is the default
7378
AlertDialog theme.
@@ -95,4 +100,42 @@
95100
<item name="windowMinWidthMinor">@dimen/abc_dialog_min_width_minor</item>
96101
</style>
97102

103+
<!-- Themes for MaterialComponents Dialogs. -->
104+
105+
<!--
106+
Themes in the "Theme.MaterialComponents" family will contain a default full color scheme.
107+
108+
These theme declarations contain any version-independent specification. Items
109+
that need to vary based on platform version should be defined in the corresponding
110+
"Base.Theme" theme.
111+
-->
112+
113+
<style name="Theme.MaterialComponents.Dialog" parent="Base.Theme.MaterialComponents.Dialog"/>
114+
115+
<style name="Theme.MaterialComponents.Light.Dialog" parent="Base.Theme.MaterialComponents.Light.Dialog"/>
116+
117+
<!--
118+
Material theme for alert dialog windows, which is used by the AlertDialog class.
119+
This is basically a dialog but sets the background to empty so it can do
120+
two-tone backgrounds. For applications targeting Honeycomb or newer, this is the default
121+
AlertDialog theme.
122+
-->
123+
<style name="Theme.MaterialComponents.Dialog.Alert" parent="Base.Theme.MaterialComponents.Dialog.Alert"/>
124+
125+
<style name="Theme.MaterialComponents.Light.Dialog.Alert" parent="Base.Theme.MaterialComponents.Light.Dialog.Alert"/>
126+
127+
<!--
128+
Variant of Theme.MaterialComponents.Dialog that has a nice minimum width for a regular dialog.
129+
-->
130+
<style name="Theme.MaterialComponents.Dialog.MinWidth" parent="Base.Theme.MaterialComponents.Dialog.MinWidth"/>
131+
132+
<style name="Theme.MaterialComponents.Light.Dialog.MinWidth" parent="Base.Theme.MaterialComponents.Light.Dialog.MinWidth"/>
133+
134+
<!--
135+
Variant of Theme.MaterialComponents.Dialog that has a fixed size for a regular dialog.
136+
-->
137+
<style name="Theme.MaterialComponents.Dialog.FixedSize" parent="Base.Theme.MaterialComponents.Dialog.FixedSize"/>
138+
139+
<style name="Theme.MaterialComponents.Light.Dialog.FixedSize" parent="Base.Theme.MaterialComponents.Light.Dialog.FixedSize"/>
140+
98141
</resources>

lib/java/com/google/android/material/dialog/res/values/themes_base.xml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,41 @@
1919
<!-- All new attributes should be set in the follow four Base.V14 themes. -->
2020
<eat-comment/>
2121

22+
<!-- Base themes of Theme.Material3Expressive themes for dialogs. -->
23+
24+
<style name="Base.Theme.Material3Expressive.Light.Dialog" parent="Theme.Material3.Light.Dialog">
25+
<!-- Color palettes. -->
26+
<item name="colorOnPrimaryContainer">@color/m3_ref_palette_primary30</item>
27+
<item name="colorOnSecondaryContainer">@color/m3_ref_palette_secondary30</item>
28+
<item name="colorOnTertiaryContainer">@color/m3_ref_palette_tertiary30</item>
29+
<item name="colorOnErrorContainer">@color/m3_ref_palette_error30</item>
30+
31+
<!-- Widget styles. -->
32+
33+
</style>
34+
35+
<style name="Base.Theme.Material3Expressive.Dark.Dialog" parent="Theme.Material3.Dark.Dialog">
36+
37+
<!-- Widget styles. -->
38+
39+
</style>
40+
41+
<style name="Base.Theme.Material3Expressive.Light.Dialog.FixedSize">
42+
<item name="windowFixedWidthMajor">@dimen/abc_dialog_fixed_width_major</item>
43+
<item name="windowFixedWidthMinor">@dimen/abc_dialog_fixed_width_minor</item>
44+
<item name="windowFixedHeightMajor">@dimen/abc_dialog_fixed_height_major</item>
45+
<item name="windowFixedHeightMinor">@dimen/abc_dialog_fixed_height_minor</item>
46+
</style>
47+
48+
<style name="Base.Theme.Material3Expressive.Dark.Dialog.FixedSize">
49+
<item name="windowFixedWidthMajor">@dimen/abc_dialog_fixed_width_major</item>
50+
<item name="windowFixedWidthMinor">@dimen/abc_dialog_fixed_width_minor</item>
51+
<item name="windowFixedHeightMajor">@dimen/abc_dialog_fixed_height_major</item>
52+
<item name="windowFixedHeightMinor">@dimen/abc_dialog_fixed_height_minor</item>
53+
</style>
54+
55+
<!-- Base themes of Theme.Material3 themes for dialogs. -->
56+
2257
<style name="Base.V14.Theme.Material3.Light.Dialog" parent="Theme.MaterialComponents.Light.Dialog">
2358
<item name="isMaterial3Theme">true</item>
2459

0 commit comments

Comments
 (0)