diff options
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui/util/Color.java')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/util/Color.java | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/util/Color.java b/src/main/java/de/pixart/messenger/ui/util/Color.java index 4a4ec45df..58ce6a465 100644 --- a/src/main/java/de/pixart/messenger/ui/util/Color.java +++ b/src/main/java/de/pixart/messenger/ui/util/Color.java @@ -31,19 +31,18 @@ package de.pixart.messenger.ui.util; import android.content.Context; -import android.content.res.Resources; +import android.content.res.TypedArray; import android.support.annotation.AttrRes; import android.support.annotation.ColorInt; -import android.util.TypedValue; public class Color { public static @ColorInt int get(Context context, @AttrRes int attr) { - TypedValue typedValue = new TypedValue(); - Resources.Theme theme = context.getTheme(); - theme.resolveAttribute(attr, typedValue, true); - return typedValue.data; + TypedArray typedArray = context.obtainStyledAttributes(new int[]{attr}); + int color = typedArray.getColor(0, 0); + typedArray.recycle(); + return color; } }
\ No newline at end of file |