diff options
author | 2024-11-18 23:36:18 +0000 | |
---|---|---|
committer | 2024-11-18 23:47:24 +0000 | |
commit | e201475d416b893d88f4608c5888a91da23e3f18 (patch) | |
tree | 83d50555fc2d556753b3dd46aa663aebff4d5689 | |
parent | 215371885bbbc451005fc5b398a775e3e5dade7a (diff) |
[DocsUI M3] Use Material3 Themes
* Remove the DocumentsDefaultM3Theme because now we have M3 stuff
in the res/flag(use_material3) folder.
* Update the parent theme to the Material3 one in themes.xml from
the res/flag(use_material3) folder.
Bug: 377771271
Test: build and run DocumentsUIGoogle with the flag on
Flag: com.android.documentsui.flags.use_material3
Change-Id: Ie87016739afeab9151d1e51179bac06863e1fce5
3 files changed, 3 insertions, 64 deletions
diff --git a/res/flag(!com.android.documentsui.flags.use_material3)/values/themes.xml b/res/flag(!com.android.documentsui.flags.use_material3)/values/themes.xml index d6e3af0fe..443374282 100644 --- a/res/flag(!com.android.documentsui.flags.use_material3)/values/themes.xml +++ b/res/flag(!com.android.documentsui.flags.use_material3)/values/themes.xml @@ -77,36 +77,6 @@ <item name="android:itemTextAppearance">@style/MenuItemTextAppearance</item> </style> - <!-- Theme used for Material 3 uplift, hidden behind the use_material3 flag. --> - <style name="DocumentsDefaultM3Theme" parent="@style/Theme.Material3.DynamicColors.DayNight.NoActionBar"> - - <!-- This only used by support lib, not allow to overlay --> - <item name="windowActionBar">false</item> - <item name="windowActionModeOverlay">true</item> - - <!-- For material design widget, chips, buttons, not support attr--> - <item name="colorPrimary">@color/primary</item> - <item name="colorAccent">@color/primary</item> - - <!-- TODO need to solve the error handle in GridItemThumbnail --> - <item name="gridItemTint">@color/item_doc_grid_tint</item> - - <item name="actionBarTheme">@style/ActionBarTheme</item> - <item name="actionModeStyle">@style/ActionModeStyle</item> - <item name="actionOverflowButtonStyle">@style/OverflowButtonStyle</item> - <item name="actionOverflowMenuStyle">@style/OverflowMenuStyle</item> - <item name="alertDialogTheme">@style/AlertDialogTheme</item> - <item name="autoCompleteTextViewStyle">@style/AutoCompleteTextViewStyle</item> - <item name="bottomSheetDialogTheme">@style/BottomSheetDialogStyle</item> - <item name="materialButtonStyle">@style/MaterialButton</item> - <item name="materialButtonOutlinedStyle">@style/MaterialOutlinedButton</item> - <item name="materialCardViewStyle">@style/CardViewStyle</item> - <item name="materialAlertDialogTheme">@style/MaterialAlertDialogTheme</item> - <item name="queryBackground">@color/menu_search_background</item> - <item name="snackbarButtonStyle">@style/SnackbarButtonStyle</item> - <item name="android:itemTextAppearance">@style/MenuItemTextAppearance</item> - </style> - <style name="TabTheme" parent="@android:style/Theme.DeviceDefault.DayNight"> <item name="colorPrimary">@color/edge_effect</item> </style> diff --git a/res/flag(com.android.documentsui.flags.use_material3)/values/themes.xml b/res/flag(com.android.documentsui.flags.use_material3)/values/themes.xml index 73d2ceb26..8f145fd38 100644 --- a/res/flag(com.android.documentsui.flags.use_material3)/values/themes.xml +++ b/res/flag(com.android.documentsui.flags.use_material3)/values/themes.xml @@ -48,37 +48,7 @@ </style> - <style name="DocumentsDefaultTheme" parent="@style/Theme.MaterialComponents.DayNight.NoActionBar"> - - <!-- This only used by support lib, not allow to overlay --> - <item name="windowActionBar">false</item> - <item name="windowActionModeOverlay">true</item> - - <!-- For material design widget, chips, buttons, not support attr--> - <item name="colorPrimary">@color/primary</item> - <item name="colorAccent">@color/primary</item> - - <!-- TODO need to solve the error handle in GridItemThumbnail --> - <item name="gridItemTint">@color/item_doc_grid_tint</item> - - <item name="actionBarTheme">@style/ActionBarTheme</item> - <item name="actionModeStyle">@style/ActionModeStyle</item> - <item name="actionOverflowButtonStyle">@style/OverflowButtonStyle</item> - <item name="actionOverflowMenuStyle">@style/OverflowMenuStyle</item> - <item name="alertDialogTheme">@style/AlertDialogTheme</item> - <item name="autoCompleteTextViewStyle">@style/AutoCompleteTextViewStyle</item> - <item name="bottomSheetDialogTheme">@style/BottomSheetDialogStyle</item> - <item name="materialButtonStyle">@style/MaterialButton</item> - <item name="materialButtonOutlinedStyle">@style/MaterialOutlinedButton</item> - <item name="materialCardViewStyle">@style/CardViewStyle</item> - <item name="materialAlertDialogTheme">@style/MaterialAlertDialogTheme</item> - <item name="queryBackground">@color/menu_search_background</item> - <item name="snackbarButtonStyle">@style/SnackbarButtonStyle</item> - <item name="android:itemTextAppearance">@style/MenuItemTextAppearance</item> - </style> - - <!-- Theme used for Material 3 uplift, hidden behind the use_material3 flag. --> - <style name="DocumentsDefaultM3Theme" parent="@style/Theme.Material3.DynamicColors.DayNight.NoActionBar"> + <style name="DocumentsDefaultTheme" parent="@style/Theme.Material3.DayNight.NoActionBar"> <!-- This only used by support lib, not allow to overlay --> <item name="windowActionBar">false</item> diff --git a/src/com/android/documentsui/BaseActivity.java b/src/com/android/documentsui/BaseActivity.java index 45a2b91a1..b3439d585 100644 --- a/src/com/android/documentsui/BaseActivity.java +++ b/src/com/android/documentsui/BaseActivity.java @@ -181,11 +181,10 @@ public abstract class BaseActivity // ToDo Create tool to check resource version before applyStyle for the theme // If version code is not match, we should reset overlay package to default, // in case Activity continuously encounter resource not found exception. + getTheme().applyStyle(R.style.DocumentsDefaultTheme, false); + if (useMaterial3() && SdkLevel.isAtLeastS()) { - getTheme().applyStyle(R.style.DocumentsDefaultM3Theme, false); DynamicColors.applyToActivityIfAvailable(this); - } else { - getTheme().applyStyle(R.style.DocumentsDefaultTheme, false); } super.onCreate(savedInstanceState); |