From 13983be7998ea28cc4b8882e1b45eff5ca4986a6 Mon Sep 17 00:00:00 2001 From: Thialfihar Date: Fri, 26 Jun 2015 11:08:26 +0200 Subject: Make header text and tertiary text color themeable --- .../org/sufficientlysecure/keychain/ui/util/FormattingUtils.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/FormattingUtils.java') diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/FormattingUtils.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/FormattingUtils.java index eb5c3df45..902a7ec56 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/FormattingUtils.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/FormattingUtils.java @@ -18,9 +18,11 @@ package org.sufficientlysecure.keychain.ui.util; import android.content.Context; +import android.content.res.Resources.Theme; import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.style.StrikethroughSpan; +import android.util.TypedValue; public class FormattingUtils { @@ -32,4 +34,10 @@ public class FormattingUtils { return (int) ((px / context.getResources().getDisplayMetrics().density) + 0.5f); } + public static int getColorFromAttr(Context context, int attr) { + TypedValue typedValue = new TypedValue(); + Theme theme = context.getTheme(); + theme.resolveAttribute(attr, typedValue, true); + return typedValue.data; + } } -- cgit v1.2.3