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

Commit f6144f05 authored by Ben Reich's avatar Ben Reich
Browse files

Update the Pick and Save bottom bars for material 3

There are a few changes made outside the normal realm of a resyle:

  - The R.layout.fragment_pick has been updated to use a
    ConstraintLayout. This was done as the FrameLayout was not playing
    nice with the right alignment of the buttons. The FrameLayout is
    used for intercepting clicks when the button is disabled.
  - The R.layout.fragment_save currently has a text field and a single
    button. When the second "Cancel" button is added it takes almost
    50% of the width on a mobile device. To avoid this, let's not
    include the Cancel button on <600dp layouts only on FEATURE_PC
    devices.

Bug: 381929144
Test: m DocumentsUIGoogle && manual inspection
Flag: com.android.documentsui.flags.use_material3

Change-Id: Ib95c5731a1ea78276f542ff9b31d89c65ba1a52b
parent 2e15b59c
Loading
Loading
Loading
Loading
+26 −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.
-->
<com.google.android.material.button.MaterialButton
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@android:id/button2"
    style="@style/MaterialTonalButton"
    app:cornerRadius="@dimen/button_corner_radius"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginStart="4dp"
    android:layout_marginEnd="4dp"
    android:text="@android:string/cancel"/>
+1 −1
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@
                    android:id="@+id/container_save"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="?android:attr/colorBackgroundFloating" />
                    android:background="?attr/colorSurfaceContainer" />

            </LinearLayout>

+1 −2
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@
        android:paddingTop="@dimen/layout_padding_top"
        android:paddingBottom="@dimen/layout_padding_bottom"
        android:paddingEnd="@dimen/layout_padding_end">

        <!-- Navigation: left hand side. -->
        <FrameLayout
            android:id="@+id/container_roots"
@@ -124,7 +123,7 @@
                android:id="@+id/container_save"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="?android:attr/colorBackgroundFloating"
                android:background="?attr/colorSurfaceContainer"
                android:elevation="8dp" />

        </LinearLayout>
+39 −28
Original line number Diff line number Diff line
@@ -13,48 +13,59 @@
     limitations under the License.
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingTop="@dimen/picker_saver_container_padding_top"
    android:paddingBottom="@dimen/picker_saver_container_padding_bottom">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:baselineAligned="false"
        android:background="?attr/colorSurfaceContainer"
        android:gravity="center_vertical|end"
        android:paddingStart="@dimen/bottom_bar_padding"
    android:paddingEnd="@dimen/bottom_bar_padding">
        android:paddingEnd="@dimen/bottom_bar_padding"
        android:paddingTop="@dimen/picker_saver_padding_top"
        android:paddingBottom="@dimen/picker_saver_padding_bottom">

        <com.google.android.material.button.MaterialButton
            android:id="@android:id/button2"
        style="?attr/materialButtonOutlinedStyle"
            style="@style/MaterialTonalButton"
            app:cornerRadius="@dimen/button_corner_radius"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
        android:layout_marginStart="4dp"
        android:layout_marginEnd="4dp"
            android:layout_marginStart="@dimen/picker_saver_button_gap"
            android:layout_marginEnd="@dimen/picker_saver_button_gap"
            android:text="@android:string/cancel" />

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <com.google.android.material.button.MaterialButton
            android:id="@android:id/button1"
            style="?attr/materialButtonStyle"
            style="@style/MaterialButton"
            app:cornerRadius="@dimen/button_corner_radius"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="4dp"
            android:backgroundTint="@color/fragment_pick_button_background_color"
            android:textColor="@color/fragment_pick_button_text_color"
            android:layout_marginEnd="4dp" />

    </LinearLayout>

    <!-- Handles touch events when button1 is disabled. -->
        <FrameLayout
    <View
        android:id="@+id/pick_button_overlay"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:background="@android:color/transparent"
        android:visibility="gone"
        android:importantForAccessibility="no"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"/>

    </FrameLayout>

</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
+31 −33
Original line number Diff line number Diff line
@@ -18,42 +18,40 @@
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingStart="@dimen/list_item_padding"
    android:paddingTop="@dimen/picker_saver_container_padding_top"
    android:paddingBottom="@dimen/picker_saver_container_padding_bottom">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="@dimen/picker_saver_padding_top"
        android:paddingBottom="@dimen/picker_saver_padding_bottom"
        android:paddingEnd="@dimen/bottom_bar_padding"
        android:orientation="horizontal"
        android:baselineAligned="false"
    android:gravity="center_vertical"
    android:minHeight="?android:attr/listPreferredItemHeightSmall">

    <FrameLayout
        android:layout_width="@dimen/icon_size"
        android:layout_height="@dimen/icon_size"
        android:layout_marginEnd="16dp">

        <ImageView
            android:id="@android:id/icon"
            android:layout_width="@dimen/root_icon_size"
            android:layout_height="match_parent"
            android:scaleType="centerInside"
            android:contentDescription="@null" />

    </FrameLayout>
        android:gravity="center_vertical|end"
        android:paddingStart="@dimen/list_item_padding">

    <EditText
        android:id="@android:id/title"
        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/title_wrapper"
            style="?attr/textInputFilledStyle"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:hint="@string/file_name_hint">
            <com.google.android.material.textfield.TextInputEditText
                android:id="@android:id/title"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:singleLine="true"
                android:selectAllOnFocus="true" />
        </com.google.android.material.textfield.TextInputLayout>

    <FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent">
        <include layout="@layout/fragment_save_cancel_button" />

        <com.google.android.material.button.MaterialButton
            android:id="@android:id/button1"
            style="@style/Widget.Material3.Button.UnelevatedButton"
            style="@style/MaterialButton"
            app:cornerRadius="@dimen/button_corner_radius"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
@@ -61,7 +59,7 @@
            android:layout_marginEnd="4dp"
            android:text="@string/menu_save"/>

        <ProgressBar
        <com.google.android.material.progressindicator.CircularProgressIndicator
            android:id="@android:id/progress"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
@@ -69,8 +67,8 @@
            android:visibility="gone"
            android:indeterminate="true"
            android:padding="8dp"
            style="?android:attr/progressBarStyle" />
            app:trackColor="?attr/colorSecondaryContainer" />

    </FrameLayout>
    </LinearLayout>

</LinearLayout>
Loading