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 0e8444316..9c261cc49 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java @@ -59,7 +59,6 @@ import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; import org.sufficientlysecure.keychain.util.ExportHelper; import org.sufficientlysecure.keychain.util.KeyUpdateHelper; -import org.sufficientlysecure.keychain.util.Preferences; import org.sufficientlysecure.keychain.pgp.KeyRing; import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler; @@ -224,7 +223,6 @@ public class KeyListFragment extends LoaderFragment */ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mStickyList.setFastScrollAlwaysVisible(true); - mStickyList.addHeaderView(); mStickyList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); mStickyList.getWrappedList().setMultiChoiceModeListener(new MultiChoiceModeListener() { @@ -554,7 +552,7 @@ public class KeyListFragment extends LoaderFragment ItemViewHolder holder = new ItemViewHolder(); holder.mMainUserId = (TextView) view.findViewById(R.id.mainUserId); holder.mMainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest); - holder.mStatus = (ImageView) view.findViewById(R.id.status_image); + holder.mStatus = (ImageView) view.findViewById(R.id.status_icon); view.setTag(holder); return view; } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java index 9343b166a..621b6b7e1 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java @@ -42,9 +42,11 @@ import android.widget.TextView; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.compatibility.ListFragmentWorkaround; +import org.sufficientlysecure.keychain.pgp.KeyRing; import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; import org.sufficientlysecure.keychain.provider.KeychainDatabase.Tables; import org.sufficientlysecure.keychain.ui.adapter.SelectKeyCursorAdapter; +import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; import java.util.Vector; @@ -257,9 +259,10 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T KeyRings._ID, KeyRings.MASTER_KEY_ID, KeyRings.USER_ID, - KeyRings.EXPIRY, + KeyRings.IS_EXPIRED, KeyRings.IS_REVOKED, KeyRings.HAS_ENCRYPT, + KeyRings.VERIFIED, }; String inMasterKeyList = null; @@ -344,7 +347,7 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T private class SelectPublicKeyCursorAdapter extends SelectKeyCursorAdapter { - private int mIndexHasEncrypt; + private int mIndexHasEncrypt, mIndexIsVerified; public SelectPublicKeyCursorAdapter(Context context, Cursor c, int flags, ListView listView) { super(context, c, flags, listView); @@ -355,6 +358,7 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T super.initIndex(cursor); if (cursor != null) { mIndexHasEncrypt = cursor.getColumnIndexOrThrow(KeyRings.HAS_ENCRYPT); + mIndexIsVerified = cursor.getColumnIndexOrThrow(KeyRings.VERIFIED); } } @@ -369,12 +373,18 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T h.selected.setChecked(getListView().isItemChecked(cursor.getPosition())); boolean enabled = false; - if((Boolean) h.status.getTag()) { + if((Boolean) h.statusIcon.getTag()) { // Check if key is viable for our purposes if (cursor.getInt(mIndexHasEncrypt) == 0) { - h.status.setText(R.string.no_key); + h.statusIcon.setVisibility(View.VISIBLE); + KeyFormattingUtils.setStatusImage(mContext, h.statusIcon, KeyFormattingUtils.STATE_UNAVAILABLE); + enabled = false; + } else if (cursor.getInt(mIndexIsVerified) != 0) { + h.statusIcon.setVisibility(View.VISIBLE); + KeyFormattingUtils.setStatusImage(mContext, h.statusIcon, KeyFormattingUtils.STATE_VERIFIED); + enabled = true; } else { - h.status.setText(R.string.can_encrypt); + h.statusIcon.setVisibility(View.GONE); enabled = true; } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java index 6947fc1ff..c864c7138 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java @@ -24,6 +24,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CheckBox; +import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; @@ -33,8 +34,6 @@ import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils; import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; import org.sufficientlysecure.keychain.ui.util.Highlighter; -import java.util.Date; - /** * Yes this class is abstract! @@ -44,7 +43,7 @@ abstract public class SelectKeyCursorAdapter extends CursorAdapter { private String mQuery; private LayoutInflater mInflater; - protected int mIndexUserId, mIndexMasterKeyId, mIndexRevoked, mIndexExpiry; + protected int mIndexUserId, mIndexMasterKeyId, mIndexIsExpiry, mIndexIsRevoked; public SelectKeyCursorAdapter(Context context, Cursor c, int flags, ListView listView) { super(context, c, flags); @@ -73,8 +72,8 @@ abstract public class SelectKeyCursorAdapter extends CursorAdapter { if (cursor != null) { mIndexUserId = cursor.getColumnIndexOrThrow(KeyRings.USER_ID); mIndexMasterKeyId = cursor.getColumnIndexOrThrow(KeyRings.MASTER_KEY_ID); - mIndexExpiry = cursor.getColumnIndexOrThrow(KeyRings.EXPIRY); - mIndexRevoked = cursor.getColumnIndexOrThrow(KeyRings.IS_REVOKED); + mIndexIsExpiry = cursor.getColumnIndexOrThrow(KeyRings.IS_EXPIRED); + mIndexIsRevoked = cursor.getColumnIndexOrThrow(KeyRings.IS_REVOKED); } } @@ -90,7 +89,8 @@ abstract public class SelectKeyCursorAdapter extends CursorAdapter { public static class ViewHolderItem { public View view; - public TextView mainUserId, mainUserIdRest, keyId, status; + public TextView mainUserId, mainUserIdRest, keyId; + public ImageView statusIcon; public CheckBox selected; public void setEnabled(boolean enabled) { @@ -99,7 +99,7 @@ abstract public class SelectKeyCursorAdapter extends CursorAdapter { mainUserId.setEnabled(enabled); mainUserIdRest.setEnabled(enabled); keyId.setEnabled(enabled); - status.setEnabled(enabled); + statusIcon.setEnabled(enabled); // Sorta special: We set an item as clickable to disable it in the ListView. This works // because the list item will handle the clicks itself (which is a nop) @@ -130,19 +130,21 @@ abstract public class SelectKeyCursorAdapter extends CursorAdapter { long masterKeyId = cursor.getLong(mIndexMasterKeyId); h.keyId.setText(KeyFormattingUtils.beautifyKeyIdWithPrefix(mContext, masterKeyId)); - boolean enabled = true; - if (cursor.getInt(mIndexRevoked) != 0) { - h.status.setText(R.string.revoked); + boolean enabled; + if (cursor.getInt(mIndexIsRevoked) != 0) { + h.statusIcon.setVisibility(View.VISIBLE); + KeyFormattingUtils.setStatusImage(mContext, h.statusIcon, KeyFormattingUtils.STATE_REVOKED); enabled = false; - } else if (!cursor.isNull(mIndexExpiry) - && new Date(cursor.getLong(mIndexExpiry) * 1000).before(new Date())) { - h.status.setText(R.string.expired); + } else if (cursor.getInt(mIndexIsExpiry) != 0) { + h.statusIcon.setVisibility(View.VISIBLE); + KeyFormattingUtils.setStatusImage(mContext, h.statusIcon, KeyFormattingUtils.STATE_EXPIRED); enabled = false; } else { - h.status.setText(""); + h.statusIcon.setVisibility(View.GONE); + enabled = true; } - h.status.setTag(enabled); + h.statusIcon.setTag(enabled); } @Override @@ -153,7 +155,7 @@ abstract public class SelectKeyCursorAdapter extends CursorAdapter { holder.mainUserId = (TextView) view.findViewById(R.id.mainUserId); holder.mainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest); holder.keyId = (TextView) view.findViewById(R.id.subkey_item_key_id); - holder.status = (TextView) view.findViewById(R.id.status); + holder.statusIcon = (ImageView) view.findViewById(R.id.status_icon); holder.selected = (CheckBox) view.findViewById(R.id.selected); view.setTag(holder); return view; diff --git a/OpenKeychain/src/main/res/layout/key_list_item.xml b/OpenKeychain/src/main/res/layout/key_list_item.xml index a7a195ffa..bddc2ad97 100644 --- a/OpenKeychain/src/main/res/layout/key_list_item.xml +++ b/OpenKeychain/src/main/res/layout/key_list_item.xml @@ -39,7 +39,7 @@ + android:paddingRight="4dp"> + android:textAppearance="?android:attr/textAppearanceSmall" /> + android:paddingRight="16dp" /> \ No newline at end of file diff --git a/OpenKeychain/src/main/res/layout/select_key_item.xml b/OpenKeychain/src/main/res/layout/select_key_item.xml index 4fe80c7e1..b6cbfd973 100644 --- a/OpenKeychain/src/main/res/layout/select_key_item.xml +++ b/OpenKeychain/src/main/res/layout/select_key_item.xml @@ -42,22 +42,16 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0xBBBBBBBBBBBBBBB" - android:textAppearance="?android:attr/textAppearanceSmall" - android:typeface="monospace" /> + android:textAppearance="?android:attr/textAppearanceSmall" /> - - + android:layout_gravity="center" + android:src="@drawable/status_signature_revoked_cutout" + android:paddingLeft="16dp" + android:paddingRight="16dp" /> \ No newline at end of file diff --git a/OpenKeychain/src/main/res/layout/select_secret_key_activity.xml b/OpenKeychain/src/main/res/layout/select_secret_key_activity.xml deleted file mode 100644 index c4cdd7576..000000000 --- a/OpenKeychain/src/main/res/layout/select_secret_key_activity.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/OpenKeychain/src/main/res/layout/select_secret_key_layout_fragment.xml b/OpenKeychain/src/main/res/layout/select_secret_key_layout_fragment.xml deleted file mode 100644 index e5fd3f9f2..000000000 --- a/OpenKeychain/src/main/res/layout/select_secret_key_layout_fragment.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - -