Migrate themes to Material3
This CL only migrates the themes but not necessarily the widget styles and other things. It also makes changes to keep things visually as they are.
I'll follow up with more CLs to clean up the themes and styles and try to improve things further.
Binary-Size: There is no mitigation for the increase
Bug: 1157905
Change-Id: If06f73ecdf0b9e9acd5ef0ba0b7e2405af975aea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5262950
Commit-Queue: Sinan Sahin <sinansahin@google.com>
Reviewed-by: Theresa Sullivan <twellington@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1291619}
diff --git a/chrome/android/expectations/monochrome_64_32_public_bundle__chrome.AndroidManifest.expected b/chrome/android/expectations/monochrome_64_32_public_bundle__chrome.AndroidManifest.expected
index 1aabb25b..c2aef50 100644
--- a/chrome/android/expectations/monochrome_64_32_public_bundle__chrome.AndroidManifest.expected
+++ b/chrome/android/expectations/monochrome_64_32_public_bundle__chrome.AndroidManifest.expected
@@ -402,7 +402,7 @@
android:name="org.chromium.chrome.browser.sync.ui.SyncTrustedVaultProxyActivity"
android:excludeFromRecents="true"
android:exported="false"
- android:theme="@style/Theme.MaterialComponents">
+ android:theme="@style/Theme.Material3.DayNight">
</activity> # DIFF-ANCHOR: 45a98fa4
<activity # DIFF-ANCHOR: 43bfa5de
android:name="org.chromium.chrome.browser.test_dummy.TestDummyActivity"
@@ -410,7 +410,7 @@
android:excludeFromRecents="true"
android:exported="true"
android:noHistory="true"
- android:theme="@style/Theme.MaterialComponents">
+ android:theme="@style/Theme.Material3.DayNight">
</activity> # DIFF-ANCHOR: 43bfa5de
<activity # DIFF-ANCHOR: 9bb1f409
android:name="org.chromium.chrome.browser.webapps.ActivateWebApkActivity"
diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml
index 347c68c..20563ed 100644
--- a/chrome/android/java/AndroidManifest.xml
+++ b/chrome/android/java/AndroidManifest.xml
@@ -570,7 +570,7 @@
@android:style/Theme.NoDisplay can't be used here.
-->
<activity android:name="org.chromium.chrome.browser.sync.ui.SyncTrustedVaultProxyActivity"
- android:theme="@style/Theme.MaterialComponents"
+ android:theme="@style/Theme.Material3.DayNight"
android:excludeFromRecents="true"
android:exported="false">
</activity>
@@ -1191,7 +1191,7 @@
android:excludeFromRecents="true"
android:exported="true"
android:noHistory="true"
- android:theme="@style/Theme.MaterialComponents"
+ android:theme="@style/Theme.Material3.DayNight"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|mcc|mnc|screenLayout|smallestScreenSize" >
</activity>
diff --git a/chrome/android/java/res/layout/incognito_toggle_tabs.xml b/chrome/android/java/res/layout/incognito_toggle_tabs.xml
index 6ad3464..1d11444 100644
--- a/chrome/android/java/res/layout/incognito_toggle_tabs.xml
+++ b/chrome/android/java/res/layout/incognito_toggle_tabs.xml
@@ -7,4 +7,7 @@
<!-- The incognito toggle toolbar button. -->
<org.chromium.chrome.browser.toolbar.IncognitoToggleTabLayout
- style="@style/ToolbarButton" />
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ style="@style/ToolbarButton"
+ app:tabIndicator="@drawable/m3_tabs_line_indicator"
+ app:tabIndicatorFullWidth="true" />
diff --git a/chrome/android/java/res/layout/sync_passphrase_types.xml b/chrome/android/java/res/layout/sync_passphrase_types.xml
index 5779cb2..e4efa97 100644
--- a/chrome/android/java/res/layout/sync_passphrase_types.xml
+++ b/chrome/android/java/res/layout/sync_passphrase_types.xml
@@ -23,7 +23,7 @@
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:text="@string/sync_passphrase_type_keystore"
- android:textAppearance="?android:attr/textAppearanceListItemSmall" />
+ android:textAppearance="?android:attr/textAppearanceListItem" />
<CheckedTextView android:id="@+id/explicit_passphrase_checkbox"
android:layout_width="match_parent"
@@ -36,7 +36,7 @@
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:text="@string/sync_passphrase_type_custom"
- android:textAppearance="?android:attr/textAppearanceListItemSmall" />
+ android:textAppearance="?android:attr/textAppearanceListItem" />
<org.chromium.ui.widget.TextViewWithClickableSpans
android:id="@+id/reset_sync_link"
diff --git a/chrome/android/java/res/values/dimens.xml b/chrome/android/java/res/values/dimens.xml
index d8746e7..de037c4 100644
--- a/chrome/android/java/res/values/dimens.xml
+++ b/chrome/android/java/res/values/dimens.xml
@@ -123,8 +123,8 @@
<dimen name="tab_modal_scrim_vertical_margin">16dp</dimen>
<!-- Should match toolbar_height_no_shadow -->
- <dimen name="control_container_height">56dp</dimen>
- <dimen name="custom_tabs_control_container_height">56dp</dimen>
+ <dimen name="control_container_height">@dimen/default_action_bar_height</dimen>
+ <dimen name="custom_tabs_control_container_height">@dimen/default_action_bar_height</dimen>
<!-- Find in Page dimensions -->
<dimen name="find_in_page_popup_width">375dp</dimen>
diff --git a/chrome/android/java/res/values/styles.xml b/chrome/android/java/res/values/styles.xml
index 64f5bf80a..c0febf5 100644
--- a/chrome/android/java/res/values/styles.xml
+++ b/chrome/android/java/res/values/styles.xml
@@ -87,6 +87,8 @@
<!-- Text style attributes used by the preference_material.xml layout. -->
<item name="android:textAppearanceListItem">@style/TextAppearance.TextLarge.Primary</item>
+ <item name="android:textAppearanceListItemSmall">@style/TextAppearance.TextSmall.Primary</item>
+ <item name="android:textAppearanceListItemSecondary">@style/TextAppearance.TextMedium.Secondary</item>
<item name="android:textColorSecondary">@color/default_text_color_secondary_list</item>
</style>
<style name="Base.V27.Theme.Chromium.Settings" parent="Base.Theme.Chromium.Settings" />
@@ -186,7 +188,7 @@
<!-- Settings -->
- <style name="SettingsToolbarStyle" parent="Widget.MaterialComponents.Toolbar">
+ <style name="SettingsToolbarStyle" parent="Widget.Material3.Toolbar">
<item name="titleTextAppearance">@style/TextAppearance.Headline.Primary</item>
<item name="titleTextColor">?attr/colorOnSurface</item>
<item name="navigationIconTint">?attr/colorOnSurface</item>
diff --git a/chrome/browser/hub/internal/android/res/layout/hub_toolbar_layout.xml b/chrome/browser/hub/internal/android/res/layout/hub_toolbar_layout.xml
index d3eb41b..25353dc 100644
--- a/chrome/browser/hub/internal/android/res/layout/hub_toolbar_layout.xml
+++ b/chrome/browser/hub/internal/android/res/layout/hub_toolbar_layout.xml
@@ -38,7 +38,9 @@
android:layout_height="match_parent"
android:layout_gravity="center"
android:visibility="gone"
- android:layout_marginBottom="3dp"/>
+ android:layout_marginBottom="3dp"
+ app:tabIndicator="@drawable/m3_tabs_line_indicator"
+ app:tabIndicatorFullWidth="true"/>
<FrameLayout
android:layout_width="wrap_content"
diff --git a/chrome/browser/privacy_guide/android/java/res/layout/privacy_guide_steps.xml b/chrome/browser/privacy_guide/android/java/res/layout/privacy_guide_steps.xml
index beb24761..b3943e3 100644
--- a/chrome/browser/privacy_guide/android/java/res/layout/privacy_guide_steps.xml
+++ b/chrome/browser/privacy_guide/android/java/res/layout/privacy_guide_steps.xml
@@ -55,6 +55,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:importantForAccessibility="no"
+ android:background="@android:color/transparent"
app:tabBackground="@drawable/tab_selector"
app:tabGravity="center"
app:tabIndicatorHeight="0dp"
diff --git a/chrome/browser/ui/android/multiwindow/java/res/values/styles.xml b/chrome/browser/ui/android/multiwindow/java/res/values/styles.xml
index fe70932e..7a2ea9d 100644
--- a/chrome/browser/ui/android/multiwindow/java/res/values/styles.xml
+++ b/chrome/browser/ui/android/multiwindow/java/res/values/styles.xml
@@ -7,7 +7,7 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- The dim amount should match the alpha of modal_dialog_scrim_color. -->
- <style name="Theme.Chromium.Multiwindow.CloseConfirmDialog" parent="ThemeOverlay.MaterialComponents.Dialog">
+ <style name="Theme.Chromium.Multiwindow.CloseConfirmDialog" parent="ThemeOverlay.Material3.Dialog">
<item name="android:windowFrame">@null</item>
<item name="android:backgroundDimAmount">0.65</item>
<item name="android:windowSoftInputMode">adjustResize|stateHidden</item>
diff --git a/chrome/browser/ui/android/omnibox/java/res/values/dimens.xml b/chrome/browser/ui/android/omnibox/java/res/values/dimens.xml
index 883dced..363e557 100644
--- a/chrome/browser/ui/android/omnibox/java/res/values/dimens.xml
+++ b/chrome/browser/ui/android/omnibox/java/res/values/dimens.xml
@@ -8,7 +8,7 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Toolbar dimensions -->
- <dimen name="toolbar_height_no_shadow">56dp</dimen>
+ <dimen name="toolbar_height_no_shadow">@dimen/default_action_bar_height</dimen>
<!-- toolbar_height_no_shadow_focused = toolbar_height_no_shadow + toolbar_url_focus_height_increase -->
<dimen name="toolbar_height_no_shadow_focused">64dp</dimen>
<dimen name="toolbar_url_focus_height_increase">8dp</dimen>
diff --git a/components/browser_ui/modaldialog/android/java/res/values-large/themes.xml b/components/browser_ui/modaldialog/android/java/res/values-large/themes.xml
index 1b01ccc..9c95842e 100644
--- a/components/browser_ui/modaldialog/android/java/res/values-large/themes.xml
+++ b/components/browser_ui/modaldialog/android/java/res/values-large/themes.xml
@@ -6,5 +6,5 @@
-->
<resources xmlns:tools="http://schemas.android.com/tools">
- <style name="ThemeOverlay.BrowserUI.Fullscreen.DialogWhenLarge" parent="ThemeOverlay.MaterialComponents.Dialog"/>
+ <style name="ThemeOverlay.BrowserUI.Fullscreen.DialogWhenLarge" parent="ThemeOverlay.Material3.Dialog"/>
</resources>
diff --git a/components/browser_ui/styles/android/java/res/values/dimens.xml b/components/browser_ui/styles/android/java/res/values/dimens.xml
index 77a6727..76a7293 100644
--- a/components/browser_ui/styles/android/java/res/values/dimens.xml
+++ b/components/browser_ui/styles/android/java/res/values/dimens.xml
@@ -17,6 +17,7 @@
<dimen name="dialog_padding_sides">@dimen/abc_dialog_padding_material</dimen>
<!-- Toolbar dimensions -->
+ <dimen name="default_action_bar_height">56dp</dimen>
<dimen name="toolbar_shadow_height">8dp</dimen>
<dimen name="toolbar_hairline_height">1dp</dimen>
diff --git a/components/browser_ui/styles/android/java/res/values/styles.xml b/components/browser_ui/styles/android/java/res/values/styles.xml
index 42a8323..ed1d805 100644
--- a/components/browser_ui/styles/android/java/res/values/styles.xml
+++ b/components/browser_ui/styles/android/java/res/values/styles.xml
@@ -43,7 +43,7 @@
</style>
<style name="OverflowMenuThemeOverlay" parent="Base.OverflowMenuThemeOverlay" />
- <style name="AlertDialogButtonStyle" parent="Widget.MaterialComponents.Button.TextButton.Dialog">
+ <style name="AlertDialogButtonStyle" parent="Widget.Material3.Button.TextButton.Dialog">
<item name="android:textAppearance">@style/TextAppearance.Button.Text.Blue</item>
</style>
@@ -95,7 +95,7 @@
<item name="android:background">@macro/default_bg_color</item>
</style>
- <style name="Base.ModernToolbar" parent="Widget.MaterialComponents.Toolbar">
+ <style name="Base.ModernToolbar" parent="Widget.Material3.Toolbar">
<item name="titleTextAppearance">@style/TextAppearance.Headline.Primary</item>
<item name="titleTextColor">@macro/default_text_color</item>
<item name="windowActionBarOverlay">true</item>
diff --git a/components/browser_ui/theme/android/java/res/values/themes.xml b/components/browser_ui/theme/android/java/res/values/themes.xml
index 319d7a2..29251da 100644
--- a/components/browser_ui/theme/android/java/res/values/themes.xml
+++ b/components/browser_ui/theme/android/java/res/values/themes.xml
@@ -8,7 +8,7 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Colors should be mirrored by Theme.BrowserUI.DialogWhenLarge and
Theme.BrowserUI.AlertDialog.NoActionBar. -->
- <style name="Base.V21.Theme.BrowserUI" parent="Theme.MaterialComponents.DayNight.NoActionBar">
+ <style name="Base.V21.Theme.BrowserUI" parent="Theme.Material3.DayNight.NoActionBar">
<item name="dynamicColorThemeOverlay">@style/ThemeOverlay.BrowserUI.DynamicColors</item>
<!-- Color palettes -->
@@ -58,18 +58,14 @@
<item name="globalLinkTextColor">?attr/colorPrimary</item>
<item name="globalClickableSpanColor">?attr/colorPrimary</item>
- <item name="materialSwitchStyle">@style/Widget.BrowserUI.Switch</item>
-
<!-- Switches style workaround for UI that might use SwitchPreferenceCompat while not
using the theme for SettingsActivity (e.g. PageInfoView) -->
<item name="switchPreferenceCompatStyle">@style/SwitchPreference</item>
<item name="android:elegantTextHeight">false</item>
- </style>
- <style name="Base.V31.Theme.BrowserUI" parent="Base.V21.Theme.BrowserUI" />
- <style name="Base.V35.Theme.BrowserUI" parent="Base.V31.Theme.BrowserUI" />
- <style name="Base.Theme.BrowserUI" parent="Base.V35.Theme.BrowserUI" />
- <style name="Theme.BrowserUI" parent="Base.Theme.BrowserUI">
+
+ <item name="actionBarSize">@dimen/default_action_bar_height</item>
+
<!-- Control styles -->
<item name="checkboxStyle">@style/Widget.BrowserUI.CheckBox</item>
<item name="radioButtonStyle">@style/Widget.BrowserUI.RadioButton</item>
@@ -91,23 +87,33 @@
<!-- Set android popup menu attributes for context menu styles because the context menus are
OS-dependent. -->
<item name="android:popupMenuStyle">@style/PopupMenuStyle</item>
+ <item name="android:contextPopupMenuStyle" tools:targetApi="24">@style/PopupMenuStyle</item>
+
+ <!-- Text styles -->
<item name="android:textAppearanceLargePopupMenu">
@style/TextAppearance.TextLarge.Primary
</item>
<item name="android:textAppearanceSmallPopupMenu">
@style/TextAppearance.TextLarge.Primary
</item>
- <item name="android:contextPopupMenuStyle" tools:targetApi="24">@style/PopupMenuStyle</item>
+ <item name="android:textAppearanceListItem">@style/TextAppearance.TextLarge.Primary</item>
+ <item name="android:textAppearanceListItemSmall">@style/TextAppearance.TextSmall.Primary</item>
+ <item name="android:textAppearanceListItemSecondary">@style/TextAppearance.TextMedium.Secondary</item>
<!-- This is for keeping the current TextInputLayout style.
TODO(crbug.com/40764906): Remove or update once the design for the app is updated. -->
<item name="textInputStyle">@style/Widget.BrowserUI.TextInputLayout</item>
</style>
+
+ <style name="Base.V31.Theme.BrowserUI" parent="Base.V21.Theme.BrowserUI" />
+ <style name="Base.V35.Theme.BrowserUI" parent="Base.V31.Theme.BrowserUI" />
+ <style name="Base.Theme.BrowserUI" parent="Base.V35.Theme.BrowserUI" />
+ <style name="Theme.BrowserUI" parent="Base.Theme.BrowserUI" />
<!-- Overridden by night mode. -->
<style name="Theme.BrowserUI.DayNight" parent="Theme.BrowserUI" />
<!-- Colors should be mirrored by Base.V21.Theme.BrowserUI. -->
- <style name="Theme.BrowserUI.DialogWhenLarge" parent="Theme.MaterialComponents.DayNight.DialogWhenLarge">
+ <style name="Theme.BrowserUI.DialogWhenLarge" parent="Theme.Material3.DayNight.DialogWhenLarge">
<item name="dynamicColorThemeOverlay">@style/ThemeOverlay.BrowserUI.DynamicColors</item>
<!-- Color palettes -->
@@ -173,7 +179,7 @@
an activity theme on its own. In addition to mirroring |Base.V21.Theme.BrowserUI|, this
should include all the attributes that |ThemeOverlay.BrowserUI.AlertDialog| has.
-->
- <style name="Theme.BrowserUI.AlertDialog.NoActionBar" parent="Theme.MaterialComponents.DayNight.Dialog.Alert">
+ <style name="Theme.BrowserUI.AlertDialog.NoActionBar" parent="Theme.Material3.DayNight.Dialog.Alert">
<item name="dynamicColorThemeOverlay">@style/ThemeOverlay.BrowserUI.DynamicColors</item>
<!-- Color palettes -->
diff --git a/components/browser_ui/widget/android/java/res/values/styles.xml b/components/browser_ui/widget/android/java/res/values/styles.xml
index 1131519..c016ca7c 100644
--- a/components/browser_ui/widget/android/java/res/values/styles.xml
+++ b/components/browser_ui/widget/android/java/res/values/styles.xml
@@ -8,7 +8,7 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- AlertDialog styles -->
<!-- |Theme.BrowserUI.AlertDialog.NoActionBar| should have all the attributes this has. -->
- <style name="ThemeOverlay.BrowserUI.AlertDialog" parent="ThemeOverlay.MaterialComponents.Dialog.Alert">
+ <style name="ThemeOverlay.BrowserUI.AlertDialog" parent="ThemeOverlay.Material3.Dialog.Alert">
<item name="android:textColorPrimary">@macro/default_text_color</item>
<item name="android:windowBackground">@drawable/dialog_bg_no_shadow</item>
<item name="android:windowTitleStyle">@style/TextAppearance.AlertDialogTitleStyle</item>