Skip to content

Commit 5a0541f

Browse files
veganafrodrchen
authored andcommitted
[TabLayout] tab layout should not ignore focused state ripple color
Resolves: #2434 in sdk >= 21 RippleUtils.convertToRippleDrawable ignores the ColorStateList's focused color. therefore, updating TabLayout to use RippleUtils.sanitizeRippleDrawableColor should fix the bug PiperOrigin-RevId: 438875412
1 parent f31414a commit 5a0541f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/java/com/google/android/material/ripple/RippleUtils.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ private RippleUtils() {}
110110
@NonNull
111111
public static ColorStateList convertToRippleDrawableColor(@Nullable ColorStateList rippleColor) {
112112
if (USE_FRAMEWORK_RIPPLE) {
113-
int size = 2;
113+
int size = 3;
114114

115115
final int[][] states = new int[size][];
116116
final int[] colors = new int[size];
@@ -126,6 +126,10 @@ public static ColorStateList convertToRippleDrawableColor(@Nullable ColorStateLi
126126
colors[i] = getColorForState(rippleColor, SELECTED_PRESSED_STATE_SET);
127127
i++;
128128

129+
states[i] = FOCUSED_STATE_SET;
130+
colors[i] = getColorForState(rippleColor, FOCUSED_STATE_SET);
131+
i++;
132+
129133
// Non-selected base state.
130134
states[i] = StateSet.NOTHING;
131135
colors[i] = getColorForState(rippleColor, PRESSED_STATE_SET);

0 commit comments

Comments
 (0)