Show revocation status in SelectPublicKeyFragment #375

Added revocation status in Key List View (graphical symbol and red coloring)
This commit is contained in:
Daniel Hammann 2014-03-18 16:07:17 +01:00
parent b39d37f59c
commit 2d3f47eb99
7 changed files with 14931 additions and 6 deletions

View File

@ -192,8 +192,8 @@ public class ViewKeyMainFragment extends Fragment implements
KeychainContract.Keys.IS_MASTER_KEY, KeychainContract.Keys.ALGORITHM,
KeychainContract.Keys.KEY_SIZE, KeychainContract.Keys.CAN_CERTIFY,
KeychainContract.Keys.CAN_SIGN, KeychainContract.Keys.CAN_ENCRYPT,
KeychainContract.Keys.CREATION, KeychainContract.Keys.EXPIRY,
KeychainContract.Keys.FINGERPRINT};
KeychainContract.Keys.IS_REVOKED, KeychainContract.Keys.CREATION,
KeychainContract.Keys.EXPIRY, KeychainContract.Keys.FINGERPRINT};
static final String KEYS_SORT_ORDER = KeychainContract.Keys.RANK + " ASC";
static final int KEYS_INDEX_ID = 0;
static final int KEYS_INDEX_KEY_ID = 1;
@ -203,9 +203,10 @@ public class ViewKeyMainFragment extends Fragment implements
static final int KEYS_INDEX_CAN_CERTIFY = 5;
static final int KEYS_INDEX_CAN_SIGN = 6;
static final int KEYS_INDEX_CAN_ENCRYPT = 7;
static final int KEYS_INDEX_CREATION = 8;
static final int KEYS_INDEX_EXPIRY = 9;
static final int KEYS_INDEX_FINGERPRINT = 10;
static final int KEYS_INDEX_IS_REVOKED = 8;
static final int KEYS_INDEX_CREATION = 9;
static final int KEYS_INDEX_EXPIRY = 10;
static final int KEYS_INDEX_FINGERPRINT = 11;
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
switch (id) {

View File

@ -19,6 +19,7 @@ package org.sufficientlysecure.keychain.ui.adapter;
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;
@ -39,6 +40,7 @@ public class ViewKeyKeysAdapter extends CursorAdapter {
private int mIndexCanCertify;
private int mIndexCanEncrypt;
private int mIndexCanSign;
private int mIndexRevokedKey;
public ViewKeyKeysAdapter(Context context, Cursor c, int flags) {
super(context, c, flags);
@ -70,6 +72,7 @@ public class ViewKeyKeysAdapter extends CursorAdapter {
mIndexCanCertify = cursor.getColumnIndexOrThrow(Keys.CAN_CERTIFY);
mIndexCanEncrypt = cursor.getColumnIndexOrThrow(Keys.CAN_ENCRYPT);
mIndexCanSign = cursor.getColumnIndexOrThrow(Keys.CAN_SIGN);
mIndexRevokedKey = cursor.getColumnIndexOrThrow(Keys.IS_REVOKED);
}
}
@ -81,13 +84,13 @@ public class ViewKeyKeysAdapter extends CursorAdapter {
ImageView certifyIcon = (ImageView) view.findViewById(R.id.ic_certifyKey);
ImageView encryptIcon = (ImageView) view.findViewById(R.id.ic_encryptKey);
ImageView signIcon = (ImageView) view.findViewById(R.id.ic_signKey);
ImageView revokedKeyIcon = (ImageView) view.findViewById(R.id.ic_revokedKey);
String keyIdStr = PgpKeyHelper.convertKeyIdToHex(cursor.getLong(mIndexKeyId));
String algorithmStr = PgpKeyHelper.getAlgorithmInfo(cursor.getInt(mIndexAlgorithm),
cursor.getInt(mIndexKeySize));
keyId.setText(keyIdStr);
keyDetails.setText("(" + algorithmStr + ")");
if (cursor.getInt(mIndexIsMasterKey) != 1) {
@ -113,6 +116,14 @@ public class ViewKeyKeysAdapter extends CursorAdapter {
} else {
signIcon.setVisibility(View.VISIBLE);
}
if (cursor.getInt(mIndexRevokedKey) > 0) {
revokedKeyIcon.setVisibility(View.VISIBLE);
keyId.setTextColor(Color.RED);
keyDetails.setTextColor(Color.RED);
} else {
revokedKeyIcon.setVisibility(View.GONE);
}
}
@Override

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -40,6 +40,10 @@
android:paddingBottom="2dip"
android:paddingTop="2dip" >
<ImageView android:id="@+id/ic_revokedKey"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/revoked_key_small"/>
<ImageView
android:id="@+id/ic_certifyKey"
android:layout_width="wrap_content"

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 443 KiB