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

Commit 9c6cb86f authored by Ben Reich's avatar Ben Reich
Browse files

Update the AppsRow to Material 3

This follows the spec. There are still some outstandings questions
(please see attached bug) mainly around the margins between items. Until
these are answered, let's land this part as it looks fine for now.

Bug: 406671405
Test: atest com.android.documentsui.AppsRowManagerTest
Flag: com.android.documentsui.flags.use_material3
Change-Id: I80c953c4ad7ae30a8d4674fad3c4c5c6048503dc
parent 308ab18b
Loading
Loading
Loading
Loading
+20 −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"
    android:shape="rectangle">
    <solid android:color="?attr/colorSurfaceContainerLow" />
    <corners android:radius="16dp" />
</shape>
+6 −10
Original line number Diff line number Diff line
@@ -21,26 +21,24 @@
    android:layout_weight="1"
    android:minWidth="@dimen/apps_row_item_width"
    android:paddingBottom="@dimen/apps_row_exit_icon_margin_bottom"
    android:paddingStart="@dimen/apps_row_item_padding_horizontal"
    android:paddingEnd="@dimen/apps_row_item_padding_horizontal"
    android:orientation="vertical"
    android:background="@drawable/generic_ripple_background"
    android:background="@drawable/nav_rail_item_icon_background"
    android:gravity="center_horizontal">

    <ImageView
        android:id="@+id/app_icon"
        android:layout_width="@dimen/apps_row_app_icon_size"
        android:layout_height="@dimen/apps_row_app_icon_size"
        android:layout_marginTop="@dimen/apps_row_app_icon_margin_top"
        android:layout_marginBottom="@dimen/apps_row_app_icon_margin_bottom"
        android:layout_marginStart="@dimen/apps_row_app_icon_margin_horizontal"
        android:layout_marginEnd="@dimen/apps_row_app_icon_margin_horizontal"/>
        android:layout_marginTop="@dimen/apps_row_app_icon_margin_vertical"
        android:layout_marginBottom="@dimen/apps_row_app_icon_margin_vertical"/>

    <com.google.android.material.textview.MaterialTextView
        android:id="@android:id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/apps_row_item_text_margin_horizontal"
        android:layout_marginEnd="@dimen/apps_row_item_text_margin_horizontal"
        android:textAppearance="@style/AppsItemText"
        android:textAppearance="@style/AppsRowTitle"
        android:maxLines="1"
        android:ellipsize="end"
        android:gravity="center"/>
@@ -49,8 +47,6 @@
        android:id="@+id/summary"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/apps_row_item_text_margin_horizontal"
        android:layout_marginEnd="@dimen/apps_row_item_text_margin_horizontal"
        android:textAppearance="@style/AppsItemSubText"
        android:maxLines="1"
        android:ellipsize="end"
+12 −10
Original line number Diff line number Diff line
@@ -14,24 +14,26 @@
     limitations under the License.
-->

<!-- TODO(b/379776735): Remove this after use_material3 flag is launched.
    Currently it's being referenced in AppsRowManager.
-->
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/apps_row"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/apps_row_background"
    android:layout_marginTop="@dimen/apps_row_margin_vertical"
    android:layout_marginBottom="@dimen/apps_row_margin_vertical"
    android:layout_marginStart="@dimen/apps_row_margin_horizontal"
    android:layout_marginEnd="@dimen/apps_row_margin_horizontal"
    android:padding="@dimen/apps_row_padding"
    android:orientation="vertical">

    <com.google.android.material.textview.MaterialTextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:minHeight="@dimen/apps_row_title_height"
        android:paddingStart="@dimen/apps_row_title_padding_start"
        android:textAppearance="@style/SortTitle"
        android:layout_gravity="center_horizontal"
        android:layout_marginBottom="@dimen/apps_row_title_padding"
        android:textAppearance="@style/AppsRowTitle"
        android:text="@string/apps_row_title"
        android:textAllCaps="true"
        android:gravity="center" />

    <HorizontalScrollView
+8 −10
Original line number Diff line number Diff line
@@ -209,18 +209,16 @@
    <dimen name="dialog_content_padding_top">@dimen/space_small_1</dimen>
    <dimen name="dialog_content_padding_bottom">@dimen/space_small_4</dimen>

    <dimen name="apps_row_title_height">48dp</dimen>
    <dimen name="apps_row_title_padding_start">24dp</dimen>
    <dimen name="apps_row_item_width">92dp</dimen>
    <dimen name="apps_row_item_height">82dp</dimen>
    <dimen name="apps_row_app_icon_size">32dp</dimen>
    <dimen name="apps_row_app_icon_margin_horizontal">30dp</dimen>
    <dimen name="apps_row_app_icon_margin_top">6dp</dimen>
    <dimen name="apps_row_app_icon_margin_bottom">10dp</dimen>
    <dimen name="apps_row_exit_icon_size">12dp</dimen>
    <dimen name="apps_row_item_width">96dp</dimen>
    <dimen name="apps_row_app_icon_size">24dp</dimen>
    <dimen name="apps_row_exit_icon_margin_top">2dp</dimen>
    <dimen name="apps_row_exit_icon_margin_bottom">6dp</dimen>
    <dimen name="apps_row_item_text_margin_horizontal">8dp</dimen>
    <dimen name="apps_row_item_padding_horizontal">8dp</dimen>
    <dimen name="apps_row_margin_vertical">@dimen/space_extra_small_4</dimen>
    <dimen name="apps_row_margin_horizontal">@dimen/space_small_1</dimen>
    <dimen name="apps_row_padding">@dimen/space_extra_small_4</dimen>
    <dimen name="apps_row_app_icon_margin_vertical">@dimen/space_extra_small_4</dimen>
    <dimen name="apps_row_title_padding">@dimen/space_extra_small_4</dimen>

    <dimen name="profile_tab_radius">12dp</dimen>

+6 −12
Original line number Diff line number Diff line
@@ -14,11 +14,6 @@
     limitations under the License.
-->
<resources>
    <style name="SortTitle" parent="@style/TextAppearance.Material3.TitleLarge">
        <item name="android:textColor">?android:attr/textColorPrimary</item>
        <item name="android:textSize">11sp</item>
    </style>

    <style name="SectionHeader" parent="@style/TextAppearance.Material3.TitleMedium">
        <item name="android:textColor">?android:attr/textColorPrimary</item>
        <item name="android:textAllCaps">true</item>
@@ -41,15 +36,14 @@
        <item name="fontFamily">@string/config_fontFamilyMedium</item>
    </style>

    <style name="AppsItemText">
        <item name="android:textColor">?android:attr/textColorPrimary</item>
        <item name="android:textSize">12sp</item>
        <item name="fontFamily">@string/config_fontFamily</item>
    <style name="AppsRowTitle" parent="@style/TextAppearance.Material3.LabelMedium">
        <item name="android:textColor">?attr/colorOnSurfaceVariant</item>
        <item name="fontFamily">@string/config_fontFamilyMedium</item>
    </style>

    <style name="AppsItemSubText">
        <item name="android:textColor">?android:attr/textColorSecondary</item>
        <item name="android:textSize">11sp</item>
    <style name="AppsItemSubText" parent="@style/TextAppearance.Material3.LabelSmall">
        <item name="android:textColor">?attr/colorOnSurfaceVariant</item>
        <item name="fontFamily">@string/config_fontFamilyMedium</item>
    </style>

    <style name="AutoCompleteText" parent="@style/TextAppearance.AppCompat.Medium">
Loading