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

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

[DocsUI M3] Restyle Sort by menu bottom sheet

* In order to show hover effect on the bottom sheet menu items,
we need to add clickable/focusable on the level item, which
unfortunately breaks the onClick and onKey event, we need to
explicitly handle them.
* The "checkMark" from the CheckedTextView component shows a weird
ripple effect, to avoid that we need to use compound drawable
manually to show the check mark.

Check the attached bug for the demo.

Bug: 404985320
Test: m DocumentsUIGoogle && manual inspection
Flag: com.android.documentsui.flags.use_material3
Change-Id: I67249c67b4351aea93141ed4c3c953bd15215940
parent 24a15be8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<!-- TODO(b/379776735): remove this file after use_material3 flag is launched. -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:state_checked="true"
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">

    <solid android:color="?android:attr/colorBackground" />
    <solid android:color="?attr/colorSurfaceContainerLow" />

    <corners
        android:topLeftRadius="@dimen/bottom_sheet_dialog_radius"
+6 −6
Original line number Diff line number Diff line
@@ -16,9 +16,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0">
    android:viewportWidth="960"
    android:viewportHeight="960">
    <path
        android:fillColor="?android:colorAccent"
        android:pathData="M9,16.2L4.8,12l-1.4,1.4L9,19 21,7l-1.4,-1.4L9,16.2z"/>
        android:fillColor="?attr/colorOnSurfaceVariant"
        android:pathData="M382,720L154,492L211,435L382,606L749,239L806,296L382,720Z"/>
</vector>
+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<!-- TODO(b/379776735): remove this file after use_material3 flag is launched. -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:state_checked="true"
+47 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2025 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.
-->

<ripple
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:color="@color/menu_item_ripple_color">

    <item>
        <selector>
            <item android:state_pressed="true">
                <shape android:tint="?attr/colorOnSurface">
                    <solid android:color="@color/overlay_hover_color_percentage" />
                </shape>
            </item>
            <item android:state_selected="true">
                <shape>
                    <stroke
                        android:width="@dimen/focus_ring_width"
                        android:color="?attr/colorSecondary" />
                </shape>
            </item>
            <item android:state_hovered="true">
                <shape android:tint="?attr/colorOnSurface">
                    <solid android:color="@color/overlay_hover_color_percentage" />
                </shape>
            </item>

            <!-- Default: use the container background. -->
            <item>
                <color android:color="@android:color/transparent"/>
            </item>
        </selector>
    </item>
</ripple>
 No newline at end of file
Loading