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

Commit 50efe9da authored by Cassy Chun-Crogan's avatar Cassy Chun-Crogan Committed by Android (Google) Code Review
Browse files

Merge changes Id7dbf118,I379a9a97 into main

* changes:
  [DocsUI M3] Uplift ripple for grid items
  [DocsUI M3] Centre items in grid layout
parents 632b63c7 b7e3e6e6
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
+151 −144
Original line number Diff line number Diff line
@@ -13,19 +13,24 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/item_root"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clickable="true"
    android:defaultFocusHighlightEnabled="false"
    android:focusable="true">

    <RelativeLayout
        android:layout_width="@dimen/grid_width"
        android:layout_height="@dimen/grid_height"
        android:layout_margin="@dimen/grid_item_margin"
    android:clickable="true"
    android:defaultFocusHighlightEnabled="false"
    android:focusable="true"
        android:layout_gravity="center_horizontal"
        android:paddingEnd="@dimen/grid_item_padding_end"
        android:paddingStart="@dimen/grid_item_padding_start"
    android:paddingTop="@dimen/grid_item_padding_top">
        android:paddingTop="@dimen/grid_item_padding_top"
        android:duplicateParentState="true">

    <!-- Main item thumbnail.  Comprised of two overlapping images, the
             visibility of which is controlled by code in
@@ -173,3 +178,5 @@
        </LinearLayout>

    </RelativeLayout>

</FrameLayout>
 No newline at end of file