aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-07-18 18:12:00 -0700
committerScott Jackson <daneren2005@gmail.com>2015-07-18 18:12:00 -0700
commit32ab835977f1544dd299508f66861881528004be (patch)
tree98f797863ab9c8f615c947308e5788f867465225 /app/src
parent74c78c326cad7a9869897a56636079bf9176b81f (diff)
downloaddsub-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.java12
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)) {