mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-11 11:35:07 -05:00
Merge pull request #434 from honnel/revocation-status
Show revocation status in ViewKeyKeysAdapter #375
This commit is contained in:
commit
9badff0b5b
@ -211,8 +211,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;
|
||||
@ -222,9 +222,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) {
|
||||
|
@ -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 |
BIN
OpenPGP-Keychain/src/main/res/drawable/revoked_key_small.png
Normal file
BIN
OpenPGP-Keychain/src/main/res/drawable/revoked_key_small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
@ -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"
|
||||
|
BIN
Resources/graphics/revokedKey.png
Normal file
BIN
Resources/graphics/revokedKey.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 67 KiB |
14909
Resources/graphics/revokedKey.svg
Normal file
14909
Resources/graphics/revokedKey.svg
Normal file
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 443 KiB |
Loading…
Reference in New Issue
Block a user