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

Commit b7e3e6e6 authored by Cassy Chun-Crogan's avatar Cassy Chun-Crogan
Browse files

[DocsUI M3] Uplift ripple for grid items

See bug for attached demo.

Bug: 404992153
Test: m DocumentsUIGoogle && manual inspection
Flag: com.android.documentsui.flags.use_material3
Change-Id: Id7dbf1186b6828824c44f36b77f39e703ca8a15a
parent b00d0c7f
Loading
Loading
Loading
Loading
+28 −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
  -->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_enabled="false" android:color="@android:color/transparent" />
    <!-- By default <ripple> introduces a gray-ish layer for the focused state which we don't
         want, hence explicitly setting focused ripple color to transparent to get rid of that.
    -->
    <item android:state_focused="true" android:color="@android:color/transparent" />
    <item android:state_selected="true" android:alpha="@dimen/ripple_overlay_alpha"
        android:color="?attr/colorOnPrimaryContainer" />
    <item android:alpha="@dimen/ripple_overlay_alpha"
        android:color="?attr/colorOnSurface" />
</selector>
+21 −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.
-->

<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <corners android:radius="@dimen/grid_item_nameplate_radius" />
    <!-- The color here doesn't matter, it's just being used as a mask. -->
    <solid android:color="@android:color/white" />
</shape>
 No newline at end of file
+112 −102
Original line number Diff line number Diff line
@@ -14,7 +14,15 @@
     limitations under the License.
-->

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

    <!-- The mask below only works for the ripple itself, doesn't work for other <item>s, we
         need to explicitly apply the drawable if the other items also need this mask. -->
    <item android:id="@android:id/mask" android:drawable="@drawable/grid_item_mask"/>

    <item>
        <selector>
            <!-- selected -->
            <item
                android:state_focused="true"
@@ -138,3 +146,5 @@
                </shape>
            </item>
        </selector>
    </item>
</ripple>
 No newline at end of file