Fixed #49 some drawables were not tinted with the right color
This commit is contained in:
parent
3f815610e4
commit
17a49b1ed4
1 changed files with 3 additions and 0 deletions
|
|
@ -78,6 +78,9 @@ public class Util {
|
||||||
public static Drawable getTintedDrawable(@NonNull Context context, @DrawableRes int drawableResId, int color) {
|
public static Drawable getTintedDrawable(@NonNull Context context, @DrawableRes int drawableResId, int color) {
|
||||||
Drawable drawable = ContextCompat.getDrawable(context, drawableResId);
|
Drawable drawable = ContextCompat.getDrawable(context, drawableResId);
|
||||||
if (drawable != null) {
|
if (drawable != null) {
|
||||||
|
// If we don't mutate the drawable, then all drawables with this id will have a color
|
||||||
|
// filter applied to it.
|
||||||
|
drawable.mutate();
|
||||||
drawable.setColorFilter(color, PorterDuff.Mode.SRC_IN);
|
drawable.setColorFilter(color, PorterDuff.Mode.SRC_IN);
|
||||||
}
|
}
|
||||||
return drawable;
|
return drawable;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue