mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-02-17 07:30:14 -05:00
Show revoked and expired for private keys
This commit is contained in:
parent
3451111edd
commit
55b764eb1d
@ -475,41 +475,40 @@ public class KeyListFragment extends LoaderFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // set edit button and revoked info, specific by key type
|
{ // set edit button and status, specific by key type
|
||||||
|
|
||||||
if (cursor.getInt(KeyListFragment.INDEX_HAS_ANY_SECRET) != 0) {
|
boolean isRevoked = cursor.getInt(INDEX_IS_REVOKED) > 0;
|
||||||
// this is a secret key
|
boolean isExpired = !cursor.isNull(INDEX_EXPIRY)
|
||||||
h.mStatus.setVisibility(View.GONE);
|
&& new Date(cursor.getLong(INDEX_EXPIRY)*1000).before(new Date());
|
||||||
} else {
|
boolean isVerified = cursor.getInt(INDEX_VERIFIED) > 0;
|
||||||
// this is a public key - show if it's revoked, expired, or verified
|
|
||||||
|
|
||||||
boolean isRevoked = cursor.getInt(INDEX_IS_REVOKED) > 0;
|
// Note: order is important!
|
||||||
boolean isExpired = !cursor.isNull(INDEX_EXPIRY)
|
if (isRevoked) {
|
||||||
&& new Date(cursor.getLong(INDEX_EXPIRY)*1000).before(new Date());
|
h.mStatus.setImageDrawable(
|
||||||
boolean isVerified = cursor.getInt(INDEX_VERIFIED) > 0;
|
getResources().getDrawable(R.drawable.status_signature_revoked_cutout));
|
||||||
|
h.mStatus.setColorFilter(getResources().getColor(R.color.android_red_light),
|
||||||
// Note: order is important!
|
PorterDuff.Mode.SRC_ATOP);
|
||||||
if (isRevoked) {
|
h.mStatus.setVisibility(View.VISIBLE);
|
||||||
h.mStatus.setImageDrawable(
|
} else if (isExpired) {
|
||||||
getResources().getDrawable(R.drawable.status_signature_revoked_cutout));
|
h.mStatus.setImageDrawable(
|
||||||
h.mStatus.setColorFilter(getResources().getColor(R.color.android_red_light),
|
getResources().getDrawable(R.drawable.status_signature_expired_cutout));
|
||||||
PorterDuff.Mode.SRC_ATOP);
|
h.mStatus.setColorFilter(getResources().getColor(R.color.android_orange_light),
|
||||||
h.mStatus.setVisibility(View.VISIBLE);
|
PorterDuff.Mode.SRC_ATOP);
|
||||||
} else if (isExpired) {
|
h.mStatus.setVisibility(View.VISIBLE);
|
||||||
h.mStatus.setImageDrawable(
|
} else if (isVerified) {
|
||||||
getResources().getDrawable(R.drawable.status_signature_expired_cutout));
|
if (cursor.getInt(KeyListFragment.INDEX_HAS_ANY_SECRET) != 0) {
|
||||||
h.mStatus.setColorFilter(getResources().getColor(R.color.android_orange_light),
|
// this is a secret key
|
||||||
PorterDuff.Mode.SRC_ATOP);
|
h.mStatus.setVisibility(View.GONE);
|
||||||
h.mStatus.setVisibility(View.VISIBLE);
|
} else {
|
||||||
} else if (isVerified) {
|
// this is a public key - show if it's verified
|
||||||
h.mStatus.setImageDrawable(
|
h.mStatus.setImageDrawable(
|
||||||
getResources().getDrawable(R.drawable.status_signature_verified_cutout));
|
getResources().getDrawable(R.drawable.status_signature_verified_cutout));
|
||||||
h.mStatus.setColorFilter(getResources().getColor(R.color.android_green_light),
|
h.mStatus.setColorFilter(getResources().getColor(R.color.android_green_light),
|
||||||
PorterDuff.Mode.SRC_ATOP);
|
PorterDuff.Mode.SRC_ATOP);
|
||||||
h.mStatus.setVisibility(View.VISIBLE);
|
h.mStatus.setVisibility(View.VISIBLE);
|
||||||
} else {
|
|
||||||
h.mStatus.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
h.mStatus.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user