Skip to content

Commit 1d2a59b

Browse files
hunterstichpaulfthomas
authored andcommitted
[NavigationRail][NavigationBar] Fixed active item focused state color not being visible.
The color state list used for the ripple to indicate focal/hover state was being set as the background of an item and being obscured by the active indicator. It is now the foreground and visible on top of the active indicator. PiperOrigin-RevId: 515343383
1 parent 22c4e0d commit 1d2a59b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/java/com/google/android/material/navigation/NavigationBarItemView.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ public void setItemRippleColor(@Nullable ColorStateList itemRippleColor) {
698698
* is created and set.
699699
*/
700700
private void refreshItemBackground() {
701-
Drawable iconContainerBackgroundDrawable = null;
701+
Drawable iconContainerRippleDrawable = null;
702702
Drawable itemBackgroundDrawable = itemBackground;
703703
boolean defaultHighlightEnabled = true;
704704

@@ -713,9 +713,9 @@ && getActiveIndicatorDrawable() != null
713713
// Remove the default focus highlight that highlights the entire view and rely on the
714714
// active indicator ripple to communicate state.
715715
defaultHighlightEnabled = false;
716-
// Set the icon container's background to a ripple masked by the active indicator's
716+
// Set the icon container's foreground to a ripple masked by the active indicator's
717717
// drawable.
718-
iconContainerBackgroundDrawable =
718+
iconContainerRippleDrawable =
719719
new RippleDrawable(
720720
RippleUtils.sanitizeRippleDrawableColor(itemRippleColor), null, maskDrawable);
721721
} else if (itemBackgroundDrawable == null) {
@@ -727,7 +727,7 @@ && getActiveIndicatorDrawable() != null
727727
// Check that this item includes an icon container. If a NavigationBarView's subclass supplies
728728
// a custom item layout, this can be null.
729729
if (iconContainer != null) {
730-
ViewCompat.setBackground(iconContainer, iconContainerBackgroundDrawable);
730+
iconContainer.setForeground(iconContainerRippleDrawable);
731731
}
732732
ViewCompat.setBackground(this, itemBackgroundDrawable);
733733
if (VERSION.SDK_INT >= VERSION_CODES.O) {

0 commit comments

Comments
 (0)