diff options
Diffstat (limited to 'OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java')
-rw-r--r-- | OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java index 086d2c178..b8f60633e 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java @@ -20,6 +20,7 @@ package org.sufficientlysecure.keychain.ui.adapter; import java.util.HashMap; import java.util.Set; + import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.pgp.PgpKeyHelper; @@ -32,7 +33,6 @@ import android.annotation.SuppressLint; import android.content.Context; import android.database.Cursor; import android.graphics.Color; -import android.support.v4.widget.CursorAdapter; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -41,7 +41,7 @@ import android.widget.TextView; /** * Implements StickyListHeadersAdapter from library */ -public class KeyListPublicAdapter extends CursorAdapter implements StickyListHeadersAdapter { +public class KeyListPublicAdapter extends HighlightQueryCursorAdapter implements StickyListHeadersAdapter { private LayoutInflater mInflater; private int mSectionColumnIndex; private int mIndexUserId; @@ -52,7 +52,6 @@ public class KeyListPublicAdapter extends CursorAdapter implements StickyListHea public KeyListPublicAdapter(Context context, Cursor c, int flags, int sectionColumnIndex) { super(context, c, flags); - mInflater = LayoutInflater.from(context); mSectionColumnIndex = sectionColumnIndex; initIndex(c); @@ -93,12 +92,12 @@ public class KeyListPublicAdapter extends CursorAdapter implements StickyListHea String userId = cursor.getString(mIndexUserId); String[] userIdSplit = PgpKeyHelper.splitUserId(userId); if (userIdSplit[0] != null) { - mainUserId.setText(userIdSplit[0]); + mainUserId.setText(highlightSearchQuery(userIdSplit[0])); } else { mainUserId.setText(R.string.user_id_no_name); } if (userIdSplit[1] != null) { - mainUserIdRest.setText(userIdSplit[1]); + mainUserIdRest.setText(highlightSearchQuery(userIdSplit[1])); mainUserIdRest.setVisibility(View.VISIBLE); } else { mainUserIdRest.setVisibility(View.GONE); @@ -193,15 +192,6 @@ public class KeyListPublicAdapter extends CursorAdapter implements StickyListHea notifyDataSetChanged(); } - public boolean isPositionChecked(int position) { - Boolean result = mSelection.get(position); - return result == null ? false : result; - } - - public Set<Integer> getCurrentCheckedPosition() { - return mSelection.keySet(); - } - public void removeSelection(int position) { mSelection.remove(position); notifyDataSetChanged(); @@ -220,11 +210,12 @@ public class KeyListPublicAdapter extends CursorAdapter implements StickyListHea /** * Change color for multi-selection */ - // default color - v.setBackgroundColor(Color.TRANSPARENT); if (mSelection.get(position) != null && mSelection.get(position).booleanValue()) { - // this is a selected position, change color! + // color for selected items v.setBackgroundColor(parent.getResources().getColor(R.color.emphasis)); + } else { + // default color + v.setBackgroundColor(Color.TRANSPARENT); } return v; } |