diff options
author | Scott Jackson <daneren2005@gmail.com> | 2015-07-18 18:12:00 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2015-07-18 18:12:00 -0700 |
commit | 32ab835977f1544dd299508f66861881528004be (patch) | |
tree | 98f797863ab9c8f615c947308e5788f867465225 /app/src | |
parent | 74c78c326cad7a9869897a56636079bf9176b81f (diff) | |
download | dsub-32ab835977f1544dd299508f66861881528004be.tar.gz dsub-32ab835977f1544dd299508f66861881528004be.tar.bz2 dsub-32ab835977f1544dd299508f66861881528004be.zip |
Add DrawableTint.getColorRes
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/util/DrawableTint.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/util/DrawableTint.java b/app/src/main/java/github/daneren2005/dsub/util/DrawableTint.java index f6b5d315..2da72579 100644 --- a/app/src/main/java/github/daneren2005/dsub/util/DrawableTint.java +++ b/app/src/main/java/github/daneren2005/dsub/util/DrawableTint.java @@ -42,6 +42,13 @@ public class DrawableTint { return tintedDrawables.get(drawableRes); } + int color = getColorRes(context, colorAttr); + Drawable background = context.getResources().getDrawable(drawableRes); + background.setColorFilter(color, PorterDuff.Mode.SRC_IN); + tintedDrawables.put(drawableRes, background); + return background; + } + public static int getColorRes(Context context, @AttrRes int colorAttr) { int color; if(attrMap.containsKey(colorAttr)) { color = attrMap.get(colorAttr); @@ -53,10 +60,7 @@ public class DrawableTint { attrMap.put(colorAttr, color); } - Drawable background = context.getResources().getDrawable(drawableRes); - background.setColorFilter(color, PorterDuff.Mode.SRC_IN); - tintedDrawables.put(drawableRes, background); - return background; + return color; } public static int getDrawableRes(Context context, @AttrRes int drawableAttr) { if(attrMap.containsKey(drawableAttr)) { |