Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e201475d authored by Wenbo Jie's avatar Wenbo Jie
Browse files

[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
parent 21537188
Loading
Loading
Loading
Loading
+0 −30
Original line number Diff line number Diff line
@@ -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>
+1 −31
Original line number Diff line number Diff line
@@ -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>
+2 −3
Original line number Diff line number Diff line
@@ -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);