Loading res/flag(com.android.documentsui.flags.use_material3)/drawable/progress_indeterminate_horizontal_material_trimmed.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -14,6 +14,7 @@ limitations under the License. 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 <!-- 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 draws the whole height of the progress bar instead having blank space above and below the bar. --> bar. --> Loading res/flag(com.android.documentsui.flags.use_material3)/layout/fragment_directory.xml +4 −4 Original line number Original line Diff line number Diff line Loading @@ -21,12 +21,12 @@ android:layout_height="match_parent" android:layout_height="match_parent" android:orientation="vertical"> android:orientation="vertical"> <ProgressBar <com.google.android.material.progressindicator.LinearProgressIndicator android:id="@+id/progressbar" android:id="@+id/progressbar" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="@dimen/progress_bar_height" android:layout_height="wrap_content" android:indeterminate="true" android:indeterminate="true" style="@style/TrimmedHorizontalProgressBar" app:trackColor="?attr/colorSecondaryContainer" android:visibility="gone" /> android:visibility="gone" /> <com.android.documentsui.dirlist.DocumentsSwipeRefreshLayout <com.android.documentsui.dirlist.DocumentsSwipeRefreshLayout Loading res/flag(com.android.documentsui.flags.use_material3)/values/dimens.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -37,6 +37,7 @@ <dimen name="zoom_icon_size">24dp</dimen> <dimen name="zoom_icon_size">24dp</dimen> <dimen name="list_item_thumbnail_size">40dp</dimen> <dimen name="list_item_thumbnail_size">40dp</dimen> <dimen name="grid_item_icon_size">30dp</dimen> <dimen name="grid_item_icon_size">30dp</dimen> <!-- TODO(b/379776735): remove this after M3 uplift --> <dimen name="progress_bar_height">4dp</dimen> <dimen name="progress_bar_height">4dp</dimen> <fraction name="grid_scale_min">85%</fraction> <fraction name="grid_scale_min">85%</fraction> <fraction name="grid_scale_max">200%</fraction> <fraction name="grid_scale_max">200%</fraction> Loading res/flag(com.android.documentsui.flags.use_material3)/values/styles.xml +0 −6 Original line number Original line Diff line number Diff line Loading @@ -55,12 +55,6 @@ <item name="cardElevation">@dimen/grid_item_elevation</item> <item name="cardElevation">@dimen/grid_item_elevation</item> </style> </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"> <style name="SnackbarButtonStyle" parent="@style/Widget.AppCompat.Button.Borderless"> <item name="android:textColor">?android:colorPrimary</item> <item name="android:textColor">?android:colorPrimary</item> </style> </style> Loading src/com/android/documentsui/dirlist/DocumentsSwipeRefreshLayout.java +29 −9 Original line number Original line Diff line number Diff line Loading @@ -16,10 +16,13 @@ package com.android.documentsui.dirlist; package com.android.documentsui.dirlist; import static com.android.documentsui.flags.Flags.useMaterial3; import android.content.Context; import android.content.Context; import android.content.res.TypedArray; import android.content.res.TypedArray; import android.util.AttributeSet; import android.util.AttributeSet; import android.util.Log; import android.util.Log; import android.util.TypedValue; import android.view.MotionEvent; import android.view.MotionEvent; import androidx.annotation.ColorRes; import androidx.annotation.ColorRes; Loading @@ -42,6 +45,22 @@ public class DocumentsSwipeRefreshLayout extends SwipeRefreshLayout { public DocumentsSwipeRefreshLayout(Context context, AttributeSet attrs) { public DocumentsSwipeRefreshLayout(Context context, AttributeSet attrs) { super(context, 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}; final int[] styledAttrs = {android.R.attr.colorAccent}; TypedArray a = context.obtainStyledAttributes(styledAttrs); TypedArray a = context.obtainStyledAttributes(styledAttrs); Loading @@ -53,6 +72,7 @@ public class DocumentsSwipeRefreshLayout extends SwipeRefreshLayout { a.recycle(); a.recycle(); setColorSchemeResources(colorId); setColorSchemeResources(colorId); } } } @Override @Override public boolean onInterceptTouchEvent(MotionEvent e) { public boolean onInterceptTouchEvent(MotionEvent e) { Loading Loading
res/flag(com.android.documentsui.flags.use_material3)/drawable/progress_indeterminate_horizontal_material_trimmed.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -14,6 +14,7 @@ limitations under the License. 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 <!-- 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 draws the whole height of the progress bar instead having blank space above and below the bar. --> bar. --> Loading
res/flag(com.android.documentsui.flags.use_material3)/layout/fragment_directory.xml +4 −4 Original line number Original line Diff line number Diff line Loading @@ -21,12 +21,12 @@ android:layout_height="match_parent" android:layout_height="match_parent" android:orientation="vertical"> android:orientation="vertical"> <ProgressBar <com.google.android.material.progressindicator.LinearProgressIndicator android:id="@+id/progressbar" android:id="@+id/progressbar" android:layout_width="match_parent" android:layout_width="match_parent" android:layout_height="@dimen/progress_bar_height" android:layout_height="wrap_content" android:indeterminate="true" android:indeterminate="true" style="@style/TrimmedHorizontalProgressBar" app:trackColor="?attr/colorSecondaryContainer" android:visibility="gone" /> android:visibility="gone" /> <com.android.documentsui.dirlist.DocumentsSwipeRefreshLayout <com.android.documentsui.dirlist.DocumentsSwipeRefreshLayout Loading
res/flag(com.android.documentsui.flags.use_material3)/values/dimens.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -37,6 +37,7 @@ <dimen name="zoom_icon_size">24dp</dimen> <dimen name="zoom_icon_size">24dp</dimen> <dimen name="list_item_thumbnail_size">40dp</dimen> <dimen name="list_item_thumbnail_size">40dp</dimen> <dimen name="grid_item_icon_size">30dp</dimen> <dimen name="grid_item_icon_size">30dp</dimen> <!-- TODO(b/379776735): remove this after M3 uplift --> <dimen name="progress_bar_height">4dp</dimen> <dimen name="progress_bar_height">4dp</dimen> <fraction name="grid_scale_min">85%</fraction> <fraction name="grid_scale_min">85%</fraction> <fraction name="grid_scale_max">200%</fraction> <fraction name="grid_scale_max">200%</fraction> Loading
res/flag(com.android.documentsui.flags.use_material3)/values/styles.xml +0 −6 Original line number Original line Diff line number Diff line Loading @@ -55,12 +55,6 @@ <item name="cardElevation">@dimen/grid_item_elevation</item> <item name="cardElevation">@dimen/grid_item_elevation</item> </style> </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"> <style name="SnackbarButtonStyle" parent="@style/Widget.AppCompat.Button.Borderless"> <item name="android:textColor">?android:colorPrimary</item> <item name="android:textColor">?android:colorPrimary</item> </style> </style> Loading
src/com/android/documentsui/dirlist/DocumentsSwipeRefreshLayout.java +29 −9 Original line number Original line Diff line number Diff line Loading @@ -16,10 +16,13 @@ package com.android.documentsui.dirlist; package com.android.documentsui.dirlist; import static com.android.documentsui.flags.Flags.useMaterial3; import android.content.Context; import android.content.Context; import android.content.res.TypedArray; import android.content.res.TypedArray; import android.util.AttributeSet; import android.util.AttributeSet; import android.util.Log; import android.util.Log; import android.util.TypedValue; import android.view.MotionEvent; import android.view.MotionEvent; import androidx.annotation.ColorRes; import androidx.annotation.ColorRes; Loading @@ -42,6 +45,22 @@ public class DocumentsSwipeRefreshLayout extends SwipeRefreshLayout { public DocumentsSwipeRefreshLayout(Context context, AttributeSet attrs) { public DocumentsSwipeRefreshLayout(Context context, AttributeSet attrs) { super(context, 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}; final int[] styledAttrs = {android.R.attr.colorAccent}; TypedArray a = context.obtainStyledAttributes(styledAttrs); TypedArray a = context.obtainStyledAttributes(styledAttrs); Loading @@ -53,6 +72,7 @@ public class DocumentsSwipeRefreshLayout extends SwipeRefreshLayout { a.recycle(); a.recycle(); setColorSchemeResources(colorId); setColorSchemeResources(colorId); } } } @Override @Override public boolean onInterceptTouchEvent(MotionEvent e) { public boolean onInterceptTouchEvent(MotionEvent e) { Loading