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

Commit b306a686 authored by Bill Lin's avatar Bill Lin
Browse files

Allow to customize OverflowMenu by RRO theme

Define OverflowMenuStyle and let menu not overlap the anchor.
Support to customize OverflowMenu background and selector via RRO.

Test: atest DocumentsUITests
Change-Id: If592318c9181e6901b319ef1a86a0778970ad407
Fix: 117198534
parent 6d679996
Loading
Loading
Loading
Loading
+46 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2019 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <!-- Panel shadow -->
    <item>
        <shape
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="rectangle"
            android:tint="?android:attr/colorBackground">
            <stroke android:width="2dp" android:color="#3C4043" />
            <solid android:color="#5F6368" />
            <corners
                android:topRightRadius="@dimen/material_round_radius"
                android:topLeftRadius="@dimen/material_round_radius"
                android:bottomRightRadius="@dimen/material_round_radius"
                android:bottomLeftRadius="@dimen/material_round_radius"/>
        </shape>
    </item>
    <!-- Panel surface -->
    <item android:bottom="2dp">
        <shape
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="rectangle"
            android:tint="?android:attr/colorBackground">
            <corners
                android:topRightRadius="@dimen/material_round_radius"
                android:topLeftRadius="@dimen/material_round_radius"
                android:bottomRightRadius="@dimen/material_round_radius"
                android:bottomLeftRadius="@dimen/material_round_radius"/>
        </shape>
    </item>
</layer-list>
+1 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
    <style name="DocumentsTheme" parent="@style/Theme.MaterialComponents.NoActionBar">

        <item name="actionModeStyle">@style/ActionModeStyle</item>
        <item name="actionOverflowMenuStyle">@style/OverflowMenuStyle</item>
        <item name="bottomSheetDialogTheme">@style/BottomSheetDialogStyle</item>
        <item name="snackbarButtonStyle">@style/SnackbarButtonStyle</item>

+3 −0
Original line number Diff line number Diff line
@@ -15,6 +15,9 @@
-->

<resources>
    <!-- Material design rounded radius -->
    <dimen name="material_round_radius">2dp</dimen>

    <dimen name="grid_container_padding">4dp</dimen>
    <dimen name="list_container_padding">0dp</dimen>
    <dimen name="icon_size">40dp</dimen>
+7 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
-->

<resources xmlns:android="http://schemas.android.com/apk/res/android">

    <style name="ActionModeStyle" parent="Widget.AppCompat.ActionMode">
        <!-- attr "height" was used by support lib should not in overlay scope -->
        <item name="height">@dimen/action_bar_space_height</item>
@@ -82,6 +83,12 @@
        <item name="android:background">@drawable/bottom_sheet_dialog_background</item>
    </style>

    <style name="OverflowMenuStyle" parent="@style/Widget.AppCompat.PopupMenu.Overflow">
        <item name="android:popupBackground">@drawable/menu_dropdown_panel</item>
        <item name="android:dropDownWidth">wrap_content</item>
        <item name="android:overlapAnchor">false</item>
    </style>

    <style name="SubMenuStyle">
        <item name="android:textColorSecondary">?android:attr/textColorPrimary</item>
    </style>
+1 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
    <style name="DocumentsTheme" parent="@style/Theme.MaterialComponents.Light.NoActionBar">

        <item name="actionModeStyle">@style/ActionModeStyle</item>
        <item name="actionOverflowMenuStyle">@style/OverflowMenuStyle</item>
        <item name="bottomSheetDialogTheme">@style/BottomSheetDialogStyle</item>
        <item name="snackbarButtonStyle">@style/SnackbarButtonStyle</item>