Skip to content

Commit

Permalink
[Chip] Fix icon tint states are not updated after setting new icon
Browse files Browse the repository at this point in the history
A drawable's tint will affect the result of drawable.isStateful().
After updating a new icon drawable, we should set tint first before
we check and update its state.

Resolves #2118

PiperOrigin-RevId: 381262641
  • Loading branch information
drchen authored and hunterstich committed Jun 28, 2021
1 parent acf08f7 commit c08a07d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/java/com/google/android/material/chip/ChipDrawable.java
Expand Up @@ -1329,12 +1329,12 @@ private void applyChildDrawable(@Nullable Drawable drawable) {
DrawableCompat.setTintList(drawable, closeIconTint);
return;
}
if (drawable.isStateful()) {
drawable.setState(getState());
}
if (drawable == chipIcon && hasChipIconTint) {
DrawableCompat.setTintList(chipIcon, chipIconTint);
}
if (drawable.isStateful()) {
drawable.setState(getState());
}
}

/**
Expand Down

0 comments on commit c08a07d

Please sign in to comment.