aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'OpenKeychain/src/main/java/org')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java12
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/Highlighter.java10
2 files changed, 20 insertions, 2 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
index 95e047b0f..21af2c83b 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java
@@ -28,6 +28,7 @@ import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
+import android.content.res.Resources.Theme;
import android.database.Cursor;
import android.graphics.Color;
import android.net.Uri;
@@ -46,6 +47,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
+import android.util.TypedValue;
import android.widget.AbsListView.MultiChoiceModeListener;
import android.widget.AdapterView;
import android.widget.ListView;
@@ -675,8 +677,11 @@ public class KeyListFragment extends LoaderFragment
private HashMap<Integer, Boolean> mSelection = new HashMap<>();
+ private Context mContext;
+
public KeyListAdapter(Context context, Cursor c, int flags) {
super(context, c, flags);
+ mContext = context;
}
@Override
@@ -705,9 +710,14 @@ public class KeyListFragment extends LoaderFragment
// let the adapter handle setting up the row views
View v = super.getView(position, convertView, parent);
+ TypedValue typedValue = new TypedValue();
+ Theme theme = mContext.getTheme();
+ theme.resolveAttribute(R.attr.colorEmphasis, typedValue, true);
+ int colorEmphasis = typedValue.data;
+
if (mSelection.get(position) != null) {
// selected position color
- v.setBackgroundColor(parent.getResources().getColor(R.color.emphasis));
+ v.setBackgroundColor(colorEmphasis);
} else {
// default color
v.setBackgroundColor(Color.TRANSPARENT);
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/Highlighter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/Highlighter.java
index 69338aa3e..22c5315a9 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/Highlighter.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/util/Highlighter.java
@@ -18,8 +18,10 @@
package org.sufficientlysecure.keychain.ui.util;
import android.content.Context;
+import android.content.res.Resources.Theme;
import android.text.Spannable;
import android.text.style.ForegroundColorSpan;
+import android.util.TypedValue;
import org.sufficientlysecure.keychain.R;
@@ -44,9 +46,15 @@ public class Highlighter {
Pattern pattern = Pattern.compile("(?i)(" + mQuery.trim().replaceAll("\\s+", "|") + ")");
Matcher matcher = pattern.matcher(text);
+
+ TypedValue typedValue = new TypedValue();
+ Theme theme = mContext.getTheme();
+ theme.resolveAttribute(R.attr.colorEmphasis, typedValue, true);
+ int colorEmphasis = typedValue.data;
+
while (matcher.find()) {
highlight.setSpan(
- new ForegroundColorSpan(mContext.getResources().getColor(R.color.emphasis)),
+ new ForegroundColorSpan(colorEmphasis),
matcher.start(),
matcher.end(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);