From b878fc3209d72270d5a30e376e561bf4dfca8162 Mon Sep 17 00:00:00 2001 From: leticiars Date: Thu, 11 Nov 2021 13:23:18 -0500 Subject: [PATCH 1/9] [a11y][ExposedDropdownMenu] accessibilityManager.isEnabled() is not reliable to check if component is in a11y mode, as it may return true unexpectedly. Automated g4 rollback of changelist 408655618 PiperOrigin-RevId: 409182047 --- .../android/material/textfield/DropdownMenuEndIconDelegate.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/java/com/google/android/material/textfield/DropdownMenuEndIconDelegate.java b/lib/java/com/google/android/material/textfield/DropdownMenuEndIconDelegate.java index 19ede5a4d..11f657d7a 100644 --- a/lib/java/com/google/android/material/textfield/DropdownMenuEndIconDelegate.java +++ b/lib/java/com/google/android/material/textfield/DropdownMenuEndIconDelegate.java @@ -131,7 +131,7 @@ class DropdownMenuEndIconDelegate extends EndIconDelegate { // If dropdown is non editable, layout click is what triggers showing/hiding the popup // list. Otherwise, arrow icon alone is what triggers it. if (event.getEventType() == TYPE_VIEW_CLICKED - && accessibilityManager.isEnabled() + && accessibilityManager.isTouchExplorationEnabled() && !isEditable(textInputLayout.getEditText())) { showHideDropdown(editText); } From 022a05f526300517d412f6367b820d1e59cc23fa Mon Sep 17 00:00:00 2001 From: serniebanders Date: Thu, 11 Nov 2021 15:17:10 -0500 Subject: [PATCH 2/9] [BottomSheetBehavior] Add margin flags to BottomSheetBehavior for system inset bars. Updates bottom sheet styles to default to left and right margins, top and bottom padding. Resolves: https://github.com/material-components/material-components-android/issues/2221 PiperOrigin-RevId: 409212345 --- .../bottomsheet/BottomSheetBehavior.java | 40 +++++++++++++++++-- .../material/bottomsheet/res/values/attrs.xml | 3 ++ .../bottomsheet/res/values/styles.xml | 6 +++ .../bottomsheet/res/values/themes_base.xml | 4 -- .../internal/res-public/values/public.xml | 3 ++ .../material/internal/res/values/attrs.xml | 3 ++ 6 files changed, 51 insertions(+), 8 deletions(-) diff --git a/lib/java/com/google/android/material/bottomsheet/BottomSheetBehavior.java b/lib/java/com/google/android/material/bottomsheet/BottomSheetBehavior.java index 950b64715..e77cb87ee 100644 --- a/lib/java/com/google/android/material/bottomsheet/BottomSheetBehavior.java +++ b/lib/java/com/google/android/material/bottomsheet/BottomSheetBehavior.java @@ -32,6 +32,7 @@ import android.os.Build.VERSION; import android.os.Build.VERSION_CODES; import android.os.Parcel; import android.os.Parcelable; +import android.support.v4.graphics.Insets; import androidx.core.view.ViewCompat; import androidx.core.view.WindowInsetsCompat; import androidx.core.view.accessibility.AccessibilityNodeInfoCompat; @@ -231,6 +232,9 @@ public class BottomSheetBehavior extends CoordinatorLayout.Behav private boolean paddingLeftSystemWindowInsets; private boolean paddingRightSystemWindowInsets; private boolean paddingTopSystemWindowInsets; + private boolean marginLeftSystemWindowInsets; + private boolean marginRightSystemWindowInsets; + private boolean marginTopSystemWindowInsets; private int insetBottom; private int insetTop; @@ -375,6 +379,12 @@ public class BottomSheetBehavior extends CoordinatorLayout.Behav // this is a breaking change from the old behavior the default is true. paddingTopSystemWindowInsets = a.getBoolean(R.styleable.BottomSheetBehavior_Layout_paddingTopSystemWindowInsets, true); + marginLeftSystemWindowInsets = + a.getBoolean(R.styleable.BottomSheetBehavior_Layout_marginLeftSystemWindowInsets, false); + marginRightSystemWindowInsets = + a.getBoolean(R.styleable.BottomSheetBehavior_Layout_marginRightSystemWindowInsets, false); + marginTopSystemWindowInsets = + a.getBoolean(R.styleable.BottomSheetBehavior_Layout_marginTopSystemWindowInsets, false); a.recycle(); ViewConfiguration configuration = ViewConfiguration.get(context); @@ -1462,6 +1472,10 @@ public class BottomSheetBehavior extends CoordinatorLayout.Behav if (!paddingBottomSystemWindowInsets && !paddingLeftSystemWindowInsets && !paddingRightSystemWindowInsets + && !paddingTopSystemWindowInsets + && !marginLeftSystemWindowInsets + && !marginRightSystemWindowInsets + && !marginTopSystemWindowInsets && !shouldHandleGestureInsets) { return; } @@ -1471,7 +1485,11 @@ public class BottomSheetBehavior extends CoordinatorLayout.Behav @Override public WindowInsetsCompat onApplyWindowInsets( View view, WindowInsetsCompat insets, RelativePadding initialPadding) { - insetTop = insets.getSystemWindowInsetTop(); + Insets systemBarInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars()); + Insets mandatoryGestureInsets = + insets.getInsets(WindowInsetsCompat.Type.mandatorySystemGestures()); + + insetTop = systemBarInsets.top; boolean isRtl = ViewUtils.isLayoutRtl(view); @@ -1480,13 +1498,13 @@ public class BottomSheetBehavior extends CoordinatorLayout.Behav int rightPadding = view.getPaddingRight(); if (paddingBottomSystemWindowInsets) { - insetBottom = insets.getSystemWindowInsetBottom(); + insetBottom = systemBarInsets.bottom; bottomPadding = initialPadding.bottom + insetBottom; } if (paddingLeftSystemWindowInsets) { leftPadding = isRtl ? initialPadding.end : initialPadding.start; - leftPadding += insets.getSystemWindowInsetLeft(); + leftPadding += systemBarInsets.left; } if (paddingRightSystemWindowInsets) { @@ -1494,10 +1512,24 @@ public class BottomSheetBehavior extends CoordinatorLayout.Behav rightPadding += insets.getSystemWindowInsetRight(); } + MarginLayoutParams mlp = (MarginLayoutParams) view.getLayoutParams(); + if (marginLeftSystemWindowInsets) { + mlp.leftMargin = systemBarInsets.left; + } + + if (marginRightSystemWindowInsets) { + mlp.rightMargin = systemBarInsets.right; + } + + if (marginTopSystemWindowInsets) { + mlp.topMargin = systemBarInsets.top; + } + + view.setLayoutParams(mlp); view.setPadding(leftPadding, view.getPaddingTop(), rightPadding, bottomPadding); if (shouldHandleGestureInsets) { - gestureInsetBottom = insets.getMandatorySystemGestureInsets().bottom; + gestureInsetBottom = mandatoryGestureInsets.bottom; } // Don't update the peek height to be above the navigation bar or gestures if these diff --git a/lib/java/com/google/android/material/bottomsheet/res/values/attrs.xml b/lib/java/com/google/android/material/bottomsheet/res/values/attrs.xml index 729f0e5ba..fc1ac051c 100644 --- a/lib/java/com/google/android/material/bottomsheet/res/values/attrs.xml +++ b/lib/java/com/google/android/material/bottomsheet/res/values/attrs.xml @@ -81,6 +81,9 @@ + + + diff --git a/lib/java/com/google/android/material/bottomsheet/res/values/styles.xml b/lib/java/com/google/android/material/bottomsheet/res/values/styles.xml index 43ee4ad71..7a4e5079e 100644 --- a/lib/java/com/google/android/material/bottomsheet/res/values/styles.xml +++ b/lib/java/com/google/android/material/bottomsheet/res/values/styles.xml @@ -67,6 +67,12 @@ @@ -244,8 +247,6 @@ false false - false - 32dp 8dp @@ -291,9 +292,7 @@ false false - false @color/m3_chip_assist_text_color - @color/m3_assist_chip_icon_tint_color 32dp @@ -305,6 +304,8 @@ 0dp 0dp 8dp + + @style/ThemeOverlay.Material3.Chip.Assist + @color/m3_chip_text_color + + + From fba1a341c31cbe2c5d71c239afc8bcc14af9d968 Mon Sep 17 00:00:00 2001 From: conradchen Date: Thu, 11 Nov 2021 17:15:47 -0500 Subject: [PATCH 5/9] [M3][DatePicker] Fix M3 date picker styles Some attributes were wrongly added to the styles. We need to remove them to make the color correct. PiperOrigin-RevId: 409241943 --- .../google/android/material/datepicker/res/values/styles.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/java/com/google/android/material/datepicker/res/values/styles.xml b/lib/java/com/google/android/material/datepicker/res/values/styles.xml index 087b74db6..414da6f87 100644 --- a/lib/java/com/google/android/material/datepicker/res/values/styles.xml +++ b/lib/java/com/google/android/material/datepicker/res/values/styles.xml @@ -234,7 +234,6 @@ @@ -306,7 +305,6 @@ ?attr/colorPrimary ?attr/colorOnPrimary 0dp - ?attr/colorPrimary From d5729d59352ba1a5e1ff3c1f3154be55dadaa322 Mon Sep 17 00:00:00 2001 From: serniebanders Date: Thu, 11 Nov 2021 20:07:43 -0500 Subject: [PATCH 6/9] Automated g4 rollback of changelist 409212345 PiperOrigin-RevId: 409279906 --- .../bottomsheet/BottomSheetBehavior.java | 40 ++----------------- .../material/bottomsheet/res/values/attrs.xml | 3 -- .../bottomsheet/res/values/styles.xml | 6 --- .../bottomsheet/res/values/themes_base.xml | 4 ++ .../internal/res-public/values/public.xml | 3 -- .../material/internal/res/values/attrs.xml | 3 -- 6 files changed, 8 insertions(+), 51 deletions(-) diff --git a/lib/java/com/google/android/material/bottomsheet/BottomSheetBehavior.java b/lib/java/com/google/android/material/bottomsheet/BottomSheetBehavior.java index e77cb87ee..950b64715 100644 --- a/lib/java/com/google/android/material/bottomsheet/BottomSheetBehavior.java +++ b/lib/java/com/google/android/material/bottomsheet/BottomSheetBehavior.java @@ -32,7 +32,6 @@ import android.os.Build.VERSION; import android.os.Build.VERSION_CODES; import android.os.Parcel; import android.os.Parcelable; -import android.support.v4.graphics.Insets; import androidx.core.view.ViewCompat; import androidx.core.view.WindowInsetsCompat; import androidx.core.view.accessibility.AccessibilityNodeInfoCompat; @@ -232,9 +231,6 @@ public class BottomSheetBehavior extends CoordinatorLayout.Behav private boolean paddingLeftSystemWindowInsets; private boolean paddingRightSystemWindowInsets; private boolean paddingTopSystemWindowInsets; - private boolean marginLeftSystemWindowInsets; - private boolean marginRightSystemWindowInsets; - private boolean marginTopSystemWindowInsets; private int insetBottom; private int insetTop; @@ -379,12 +375,6 @@ public class BottomSheetBehavior extends CoordinatorLayout.Behav // this is a breaking change from the old behavior the default is true. paddingTopSystemWindowInsets = a.getBoolean(R.styleable.BottomSheetBehavior_Layout_paddingTopSystemWindowInsets, true); - marginLeftSystemWindowInsets = - a.getBoolean(R.styleable.BottomSheetBehavior_Layout_marginLeftSystemWindowInsets, false); - marginRightSystemWindowInsets = - a.getBoolean(R.styleable.BottomSheetBehavior_Layout_marginRightSystemWindowInsets, false); - marginTopSystemWindowInsets = - a.getBoolean(R.styleable.BottomSheetBehavior_Layout_marginTopSystemWindowInsets, false); a.recycle(); ViewConfiguration configuration = ViewConfiguration.get(context); @@ -1472,10 +1462,6 @@ public class BottomSheetBehavior extends CoordinatorLayout.Behav if (!paddingBottomSystemWindowInsets && !paddingLeftSystemWindowInsets && !paddingRightSystemWindowInsets - && !paddingTopSystemWindowInsets - && !marginLeftSystemWindowInsets - && !marginRightSystemWindowInsets - && !marginTopSystemWindowInsets && !shouldHandleGestureInsets) { return; } @@ -1485,11 +1471,7 @@ public class BottomSheetBehavior extends CoordinatorLayout.Behav @Override public WindowInsetsCompat onApplyWindowInsets( View view, WindowInsetsCompat insets, RelativePadding initialPadding) { - Insets systemBarInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars()); - Insets mandatoryGestureInsets = - insets.getInsets(WindowInsetsCompat.Type.mandatorySystemGestures()); - - insetTop = systemBarInsets.top; + insetTop = insets.getSystemWindowInsetTop(); boolean isRtl = ViewUtils.isLayoutRtl(view); @@ -1498,13 +1480,13 @@ public class BottomSheetBehavior extends CoordinatorLayout.Behav int rightPadding = view.getPaddingRight(); if (paddingBottomSystemWindowInsets) { - insetBottom = systemBarInsets.bottom; + insetBottom = insets.getSystemWindowInsetBottom(); bottomPadding = initialPadding.bottom + insetBottom; } if (paddingLeftSystemWindowInsets) { leftPadding = isRtl ? initialPadding.end : initialPadding.start; - leftPadding += systemBarInsets.left; + leftPadding += insets.getSystemWindowInsetLeft(); } if (paddingRightSystemWindowInsets) { @@ -1512,24 +1494,10 @@ public class BottomSheetBehavior extends CoordinatorLayout.Behav rightPadding += insets.getSystemWindowInsetRight(); } - MarginLayoutParams mlp = (MarginLayoutParams) view.getLayoutParams(); - if (marginLeftSystemWindowInsets) { - mlp.leftMargin = systemBarInsets.left; - } - - if (marginRightSystemWindowInsets) { - mlp.rightMargin = systemBarInsets.right; - } - - if (marginTopSystemWindowInsets) { - mlp.topMargin = systemBarInsets.top; - } - - view.setLayoutParams(mlp); view.setPadding(leftPadding, view.getPaddingTop(), rightPadding, bottomPadding); if (shouldHandleGestureInsets) { - gestureInsetBottom = mandatoryGestureInsets.bottom; + gestureInsetBottom = insets.getMandatorySystemGestureInsets().bottom; } // Don't update the peek height to be above the navigation bar or gestures if these diff --git a/lib/java/com/google/android/material/bottomsheet/res/values/attrs.xml b/lib/java/com/google/android/material/bottomsheet/res/values/attrs.xml index fc1ac051c..729f0e5ba 100644 --- a/lib/java/com/google/android/material/bottomsheet/res/values/attrs.xml +++ b/lib/java/com/google/android/material/bottomsheet/res/values/attrs.xml @@ -81,9 +81,6 @@ - - - diff --git a/lib/java/com/google/android/material/bottomsheet/res/values/styles.xml b/lib/java/com/google/android/material/bottomsheet/res/values/styles.xml index 7a4e5079e..43ee4ad71 100644 --- a/lib/java/com/google/android/material/bottomsheet/res/values/styles.xml +++ b/lib/java/com/google/android/material/bottomsheet/res/values/styles.xml @@ -67,12 +67,6 @@ From 6b57c52973c2ceb97c88da1df1b72859ed28775a Mon Sep 17 00:00:00 2001 From: conradchen Date: Tue, 16 Nov 2021 10:18:28 -0500 Subject: [PATCH 9/9] [M3][NavigationRail] Update M3 navigation rail text appearances PiperOrigin-RevId: 410245619 --- .../android/material/navigationrail/res/values/styles.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/java/com/google/android/material/navigationrail/res/values/styles.xml b/lib/java/com/google/android/material/navigationrail/res/values/styles.xml index 5f938d484..c7e699381 100644 --- a/lib/java/com/google/android/material/navigationrail/res/values/styles.xml +++ b/lib/java/com/google/android/material/navigationrail/res/values/styles.xml @@ -76,6 +76,8 @@ @dimen/m3_navigation_rail_item_padding_top @dimen/m3_navigation_rail_item_padding_bottom @dimen/m3_navigation_rail_item_min_height + ?attr/textAppearanceTitleSmall + ?attr/textAppearanceTitleSmall