<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2024 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"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:color="@color/item_root_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/root_item_selector"/>

    <item>
        <selector>
            <!-- Selected (activated). -->
            <!-- Highlight: when dragging files over the item. -->
            <item android:state_activated="true" app:state_highlighted="true">
                <layer-list>
                    <item>
                        <shape>
                            <corners android:radius="@dimen/drawer_item_height"/>
                            <solid android:color="?attr/colorSecondaryContainer"/>
                        </shape>
                    </item>
                    <item>
                        <shape android:tint="?attr/colorOnSecondaryContainer">
                            <corners android:radius="@dimen/drawer_item_height"/>
                            <solid android:color="@color/overlay_hover_color_percentage"/>
                        </shape>
                    </item>
                </layer-list>
            </item>
            <item android:state_activated="true" android:state_pressed="true">
                <layer-list>
                    <item>
                        <shape>
                            <corners android:radius="@dimen/drawer_item_height"/>
                            <solid android:color="?attr/colorSecondaryContainer"/>
                        </shape>
                    </item>
                    <item>
                        <shape android:tint="?attr/colorOnSecondaryContainer">
                            <corners android:radius="@dimen/drawer_item_height"/>
                            <solid android:color="@color/overlay_hover_color_percentage"/>
                        </shape>
                    </item>
                </layer-list>
            </item>
            <item android:state_activated="true" android:state_focused="true">
                <layer-list>
                    <item>
                        <shape>
                            <corners android:radius="@dimen/drawer_item_height"/>
                            <solid android:color="?attr/colorSecondaryContainer"/>
                        </shape>
                    </item>
                    <item>
                        <shape>
                            <corners android:radius="@dimen/drawer_item_height"/>
                            <stroke android:width="@dimen/focus_ring_width" android:color="?attr/colorSecondary"/>
                        </shape>
                    </item>
                </layer-list>
            </item>
            <item android:state_activated="true" android:state_hovered="true">
                <layer-list>
                    <item>
                        <shape>
                            <corners android:radius="@dimen/drawer_item_height"/>
                            <solid android:color="?attr/colorSecondaryContainer"/>
                        </shape>
                    </item>
                    <item>
                        <shape android:tint="?attr/colorOnSecondaryContainer">
                            <corners android:radius="@dimen/drawer_item_height"/>
                            <solid android:color="@color/overlay_hover_color_percentage"/>
                        </shape>
                    </item>
                </layer-list>
            </item>
            <item android:state_activated="true" android:drawable="@drawable/root_item_selector"/>

            <!-- Unselected. -->
            <item app:state_highlighted="true">
                <shape android:tint="?attr/colorOnSurface">
                    <corners android:radius="@dimen/drawer_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/drawer_item_height"/>
                    <solid android:color="@color/overlay_hover_color_percentage"/>
                </shape>
            </item>
            <item android:state_focused="true">
                <shape>
                    <corners android:radius="@dimen/drawer_item_height"/>
                    <stroke android:width="@dimen/focus_ring_width" android:color="?attr/colorSecondary"/>
                </shape>
            </item>
            <item android:state_hovered="true">
                <shape android:tint="?attr/colorOnSurface">
                    <corners android:radius="@dimen/drawer_item_height"/>
                    <solid android:color="@color/overlay_hover_color_percentage"/>
                </shape>
            </item>

            <!-- Default: use the container background. -->
            <item
                android:drawable="@android:color/transparent"/>
        </selector>
    </item>
</ripple>