diff options
Diffstat (limited to 'core/src/main')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/util/ThemeUtils.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/ThemeUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/ThemeUtils.java index eabaaa828..44b31f0be 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/ThemeUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/ThemeUtils.java @@ -4,6 +4,7 @@ import android.content.Context; import androidx.annotation.AttrRes; import androidx.annotation.ColorInt; import android.util.TypedValue; +import androidx.annotation.DrawableRes; public class ThemeUtils { private ThemeUtils() { @@ -15,4 +16,10 @@ public class ThemeUtils { context.getTheme().resolveAttribute(attr, typedValue, true); return typedValue.data; } + + public static @DrawableRes int getDrawableFromAttr(Context context, @AttrRes int attr) { + TypedValue typedValue = new TypedValue(); + context.getTheme().resolveAttribute(attr, typedValue, true); + return typedValue.resourceId; + } } |