@Override public void setTint(int tintColor) { if (mDrawable instanceof TintableDrawable) { //noinspection RedundantCast ((TintableDrawable) mDrawable).setTint(tintColor); } else { Log.w(TAG, "Drawable did not implement TintableDrawable, it won't be tinted below" + " Lollipop"); super.setTint(tintColor); } }
private static Drawable createLayerDrawableWithTintColor(int tileRes, int tintColor, Context context) { TileDrawable drawable = new TileDrawable(AppCompatResources.getDrawable(context, tileRes)); drawable.mutate(); //noinspection RedundantCast ((TintableDrawable) drawable).setTint(tintColor); return drawable; }