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

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

Merge "[DocsUI M3] Uplift File list loading spinner" into main

parents b3714e46 e4e9276a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
     limitations under the License.
-->

<!-- TODO(b/379776735): remove this file after M3 uplift -->
<!-- Variant of progress_indeterminate_horizontal_material in frameworks/base/core/res, which
     draws the whole height of the progress bar instead having blank space above and below the
     bar. -->
+4 −4
Original line number Diff line number Diff line
@@ -21,12 +21,12 @@
    android:layout_height="match_parent"
    android:orientation="vertical">

    <ProgressBar
    <com.google.android.material.progressindicator.LinearProgressIndicator
        android:id="@+id/progressbar"
        android:layout_width="match_parent"
        android:layout_height="@dimen/progress_bar_height"
        android:layout_height="wrap_content"
        android:indeterminate="true"
        style="@style/TrimmedHorizontalProgressBar"
        app:trackColor="?attr/colorSecondaryContainer"
        android:visibility="gone" />

    <com.android.documentsui.dirlist.DocumentsSwipeRefreshLayout
+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
    <dimen name="zoom_icon_size">24dp</dimen>
    <dimen name="list_item_thumbnail_size">40dp</dimen>
    <dimen name="grid_item_icon_size">30dp</dimen>
    <!-- TODO(b/379776735): remove this after M3 uplift -->
    <dimen name="progress_bar_height">4dp</dimen>
    <fraction name="grid_scale_min">85%</fraction>
    <fraction name="grid_scale_max">200%</fraction>
+0 −6
Original line number Diff line number Diff line
@@ -55,12 +55,6 @@
        <item name="cardElevation">@dimen/grid_item_elevation</item>
    </style>

    <style name="TrimmedHorizontalProgressBar" parent="android:Widget.Material.ProgressBar.Horizontal">
        <item name="android:indeterminateDrawable">@drawable/progress_indeterminate_horizontal_material_trimmed</item>
        <item name="android:minHeight">3dp</item>
        <item name="android:maxHeight">3dp</item>
    </style>

    <style name="SnackbarButtonStyle" parent="@style/Widget.AppCompat.Button.Borderless">
        <item name="android:textColor">?android:colorPrimary</item>
    </style>
+29 −9
Original line number Diff line number Diff line
@@ -16,10 +16,13 @@

package com.android.documentsui.dirlist;

import static com.android.documentsui.flags.Flags.useMaterial3;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.MotionEvent;

import androidx.annotation.ColorRes;
@@ -42,6 +45,22 @@ public class DocumentsSwipeRefreshLayout extends SwipeRefreshLayout {
    public DocumentsSwipeRefreshLayout(Context context, AttributeSet attrs) {
        super(context, attrs);

        if (useMaterial3()) {
            TypedValue spinnerColor = new TypedValue();
            context.getTheme()
                    .resolveAttribute(
                            com.google.android.material.R.attr.colorOnPrimaryContainer,
                            spinnerColor,
                            true);
            setColorSchemeResources(spinnerColor.resourceId);
            TypedValue spinnerBackgroundColor = new TypedValue();
            context.getTheme()
                    .resolveAttribute(
                            com.google.android.material.R.attr.colorPrimaryContainer,
                            spinnerBackgroundColor,
                            true);
            setProgressBackgroundColorSchemeResource(spinnerBackgroundColor.resourceId);
        } else {
            final int[] styledAttrs = {android.R.attr.colorAccent};

            TypedArray a = context.obtainStyledAttributes(styledAttrs);
@@ -53,6 +72,7 @@ public class DocumentsSwipeRefreshLayout extends SwipeRefreshLayout {
            a.recycle();
            setColorSchemeResources(colorId);
        }
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent e) {