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

Commit e453b759 authored by Wenbo Jie (介文博)'s avatar Wenbo Jie (介文博) Committed by Android (Google) Code Review
Browse files

Merge "[DocsUI M3] Add hover/ripple back to file list" into main

parents b3e89ca5 eec845be
Loading
Loading
Loading
Loading
+24 −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" />
    <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>
+101 −54
Original line number Diff line number Diff line
@@ -16,8 +16,16 @@

<!-- Use @color/list_item_selected_background_color instead of the "?attr/colorPrimaryContainer"
     because the variable is exposed in overlayable.xml. -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- selected -->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    android:color="@color/list_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/list_item_mask"/>

    <item>
        <selector>
            <!-- Selected -->
            <item android:state_selected="true" android:state_drag_hovered="true">
                <layer-list>
                    <item>
@@ -27,7 +35,23 @@
                        </shape>
                    </item>
                    <item>
                <shape android:tint="?attr/colorOnPrimary">
                        <shape android:tint="?attr/colorOnPrimaryContainer">
                            <corners android:radius="@dimen/list_item_height" />
                            <solid android:color="@color/overlay_hover_color_percentage" />
                        </shape>
                    </item>
                </layer-list>
            </item>
            <item android:state_selected="true" android:state_pressed="true">
                <layer-list>
                    <item>
                        <shape>
                            <corners android:radius="@dimen/list_item_height" />
                            <solid android:color="@color/list_item_selected_background_color" />
                        </shape>
                    </item>
                    <item>
                        <shape android:tint="?attr/colorOnPrimaryContainer">
                            <corners android:radius="@dimen/list_item_height" />
                            <solid android:color="@color/overlay_hover_color_percentage" />
                        </shape>
@@ -57,11 +81,21 @@
                </layer-list>
            </item>
            <item android:state_selected="true" android:state_hovered="true">
                <layer-list>
                    <item>
                        <shape>
                            <corners android:radius="@dimen/list_item_height" />
                            <solid android:color="@color/list_item_selected_background_color" />
                        </shape>
                    </item>
                    <item>
                        <shape android:tint="?attr/colorOnPrimaryContainer">
                            <corners android:radius="@dimen/list_item_height" />
                            <solid android:color="@color/overlay_hover_color_percentage" />
                        </shape>
                    </item>
                </layer-list>
            </item>
            <item android:state_selected="true">
                <shape>
                    <corners android:radius="@dimen/list_item_height" />
@@ -69,13 +103,19 @@
                </shape>
            </item>

    <!-- unselected -->
            <!-- Unselected -->
            <item android:state_drag_hovered="true">
                <shape android:tint="?attr/colorOnSurface">
                    <corners android:radius="@dimen/list_item_height" />
                    <solid android:color="@color/overlay_hover_color_percentage" />
                </shape>
            </item>
            <item android:state_pressed="true">
                <shape android:tint="?attr/colorOnSurface">
                    <corners android:radius="@dimen/list_item_height" />
                    <solid android:color="@color/overlay_hover_color_percentage" />
                </shape>
            </item>
            <item android:state_focused="true">
                <shape>
                    <corners android:radius="@dimen/list_item_height" />
@@ -85,9 +125,16 @@
                </shape>
            </item>
            <item android:state_hovered="true">
        <color android:color="@android:color/transparent"/>
                <shape android:tint="?attr/colorOnSurface">
                    <corners android:radius="@dimen/list_item_height" />
                    <solid android:color="@color/overlay_hover_color_percentage" />
                </shape>
            </item>

            <!-- Default: use the container background. -->
            <item>
        <color android:color="?attr/colorSurfaceBright"/>
                <color android:color="@android:color/transparent"/>
            </item>
        </selector>
    </item>
</ripple>
 No newline at end of file
+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/list_item_height" />
    <!-- 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
+1 −0
Original line number Diff line number Diff line
@@ -205,6 +205,7 @@
    <dimen name="cross_profile_button_message_margin_top">4dp</dimen>

    <dimen name="focus_ring_width">3dp</dimen>
    <!-- 3dp focus ring width + 2dp gap between the ring and the content -->
    <dimen name="focus_ring_gap">5dp</dimen>
    <dimen name="hover_overlay_alpha">0.08</dimen>
    <dimen name="ripple_overlay_alpha">0.10</dimen>