diff options
author | Thialfihar <thi@thialfihar.org> | 2014-03-20 00:29:40 +0100 |
---|---|---|
committer | Thialfihar <thi@thialfihar.org> | 2014-03-20 00:37:03 +0100 |
commit | 62fb1fb57931626e73e9928cc44f6eb60f3c101e (patch) | |
tree | b0542eaa9c37eae4851c70df9d50643d33f9aaca | |
parent | 107affcb3488861a046bf917d5a1bef786a87134 (diff) | |
download | open-keychain-62fb1fb57931626e73e9928cc44f6eb60f3c101e.tar.gz open-keychain-62fb1fb57931626e73e9928cc44f6eb60f3c101e.tar.bz2 open-keychain-62fb1fb57931626e73e9928cc44f6eb60f3c101e.zip |
Fix key list views in main key view
Since the views are being reused, a revoked key might set the text
color of a view and when the view is being reused for a non-revoked
key it is still red. So grab the default text colour and set it
explicitly when the key is not revoked.
-rw-r--r-- | OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyKeysAdapter.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyKeysAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyKeysAdapter.java index 0064e9f13..068d6e6e9 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyKeysAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyKeysAdapter.java @@ -18,6 +18,7 @@ package org.sufficientlysecure.keychain.ui.adapter; import android.content.Context; +import android.content.res.ColorStateList; import android.database.Cursor; import android.graphics.Color; import android.support.v4.widget.CursorAdapter; @@ -42,6 +43,8 @@ public class ViewKeyKeysAdapter extends CursorAdapter { private int mIndexCanSign; private int mIndexRevokedKey; + private ColorStateList mDefaultTextColor; + public ViewKeyKeysAdapter(Context context, Cursor c, int flags) { super(context, c, flags); @@ -122,13 +125,20 @@ public class ViewKeyKeysAdapter extends CursorAdapter { keyId.setTextColor(Color.RED); keyDetails.setTextColor(Color.RED); } else { + keyId.setTextColor(mDefaultTextColor); + keyDetails.setTextColor(mDefaultTextColor); revokedKeyIcon.setVisibility(View.GONE); } } @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { - return mInflater.inflate(R.layout.view_key_keys_item, null); + View view = mInflater.inflate(R.layout.view_key_keys_item, null); + if (mDefaultTextColor == null) { + TextView keyId = (TextView) view.findViewById(R.id.keyId); + mDefaultTextColor = keyId.getTextColors(); + } + return view; } } |