Skip to content

Commit

Permalink
[MaterialToolbar] Add clearNavigationIconTint() method
Browse files Browse the repository at this point in the history
Resolves #2678

PiperOrigin-RevId: 453220817
  • Loading branch information
dsn5ft authored and pekingme committed Jun 6, 2022
1 parent ef2c2fa commit c5b37e6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/java/com/google/android/material/appbar/MaterialToolbar.java
Expand Up @@ -286,6 +286,22 @@ public void setNavigationIconTint(@ColorInt int navigationIconTint) {
}
}

/**
* Clears the tint list of the toolbar's navigation icon. E.g., if the navigation icon is an XML
* based vector drawable, calling this method will clear the {@code android:tint}.
*
* @see #setNavigationIconTint(int)
*/
public void clearNavigationIconTint() {
this.navigationIconTint = null;
Drawable navigationIcon = getNavigationIcon();
if (navigationIcon != null) {
Drawable wrappedNavigationIcon = DrawableCompat.wrap(navigationIcon.mutate());
DrawableCompat.setTintList(wrappedNavigationIcon, null);
setNavigationIcon(navigationIcon);
}
}

/**
* Gets the tint color of the toolbar's navigation icon, or null if no tint color has been set.
*
Expand Down

0 comments on commit c5b37e6

Please sign in to comment.