Fixed the notification.

This commit is contained in:
Karim Abou Zeid 2016-02-28 19:33:43 +01:00
commit 138ec909e2
3 changed files with 59 additions and 44 deletions

View file

@ -17,6 +17,7 @@ import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.TintContextWrapper;
import android.util.TypedValue;
import android.view.Display;
import android.view.View;
@ -94,6 +95,10 @@ public class Util {
}
public static Drawable getTintedDrawable(@NonNull Context context, @DrawableRes int drawableResId, int color) {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP) {
// vector support
context = TintContextWrapper.wrap(context);
}
Drawable drawable = ContextCompat.getDrawable(context, drawableResId);
if (drawable != null) {
// If we don't mutate the drawable, then all drawables with this id will have a color