Added insecure warning to import card
This commit is contained in:
@@ -252,7 +252,8 @@ public class ImportKeysAdapter extends RecyclerView.Adapter<ImportKeysAdapter.Vi
|
||||
if (canKeyRings.size() == 1) {
|
||||
CanonicalizedKeyRing keyRing = canKeyRings.get(0);
|
||||
Log.e(Constants.TAG, "Key ID: " + keyRing.getMasterKeyId() +
|
||||
"| isRev: " + keyRing.isRevoked() + "| isExp: " + keyRing.isExpired());
|
||||
"| isRev: " + keyRing.isRevoked() + "| isExp: " + keyRing.isExpired()
|
||||
+ "| isSec: " + keyRing.isSecure());
|
||||
|
||||
ImportKeysListEntry entry = mData.get(position);
|
||||
entry.setUpdated(result.isOkUpdated());
|
||||
@@ -275,6 +276,7 @@ public class ImportKeysAdapter extends RecyclerView.Adapter<ImportKeysAdapter.Vi
|
||||
private void mergeEntryWithKey(ImportKeysListEntry entry, CanonicalizedKeyRing keyRing) {
|
||||
entry.setRevoked(keyRing.isRevoked());
|
||||
entry.setExpired(keyRing.isExpired());
|
||||
entry.setSecure(keyRing.isSecure());
|
||||
|
||||
Date expectedDate = entry.getDate();
|
||||
Date creationDate = keyRing.getCreationDate();
|
||||
|
||||
@@ -31,9 +31,9 @@ import java.util.Date;
|
||||
|
||||
public class ImportKeysBindings {
|
||||
|
||||
@BindingAdapter({"keyUserId", "keySecret", "keyRevokedOrExpired", "query"})
|
||||
@BindingAdapter({"keyUserId", "keySecret", "keyRevokedOrExpiredOrInsecure", "query"})
|
||||
public static void setUserId(TextView textView, CharSequence userId, boolean secret,
|
||||
boolean revokedOrExpired, String query) {
|
||||
boolean revokedOrExpiredOrInsecure, String query) {
|
||||
|
||||
Context context = textView.getContext();
|
||||
Resources resources = context.getResources();
|
||||
@@ -49,16 +49,16 @@ public class ImportKeysBindings {
|
||||
userId = highlighter.highlight(userId);
|
||||
}
|
||||
textView.setText(userId);
|
||||
textView.setTextColor(ImportKeysBindingsUtils.getColor(context, revokedOrExpired));
|
||||
textView.setTextColor(ImportKeysBindingsUtils.getColor(context, revokedOrExpiredOrInsecure));
|
||||
|
||||
if (secret) {
|
||||
textView.setTextColor(Color.RED);
|
||||
}
|
||||
}
|
||||
|
||||
@BindingAdapter({"keyUserEmail", "keyRevokedOrExpired", "query"})
|
||||
@BindingAdapter({"keyUserEmail", "keyRevokedOrExpiredOrInsecure", "query"})
|
||||
public static void setUserEmail(TextView textView, CharSequence userEmail,
|
||||
boolean revokedOrExpired, String query) {
|
||||
boolean revokedOrExpiredOrInsecure, String query) {
|
||||
|
||||
Context context = textView.getContext();
|
||||
|
||||
@@ -68,11 +68,11 @@ public class ImportKeysBindings {
|
||||
|
||||
Highlighter highlighter = ImportKeysBindingsUtils.getHighlighter(context, query);
|
||||
textView.setText(highlighter.highlight(userEmail));
|
||||
textView.setTextColor(ImportKeysBindingsUtils.getColor(context, revokedOrExpired));
|
||||
textView.setTextColor(ImportKeysBindingsUtils.getColor(context, revokedOrExpiredOrInsecure));
|
||||
}
|
||||
|
||||
@BindingAdapter({"keyCreation", "keyRevokedOrExpired"})
|
||||
public static void setCreation(TextView textView, Date creationDate, boolean revokedOrExpired) {
|
||||
@BindingAdapter({"keyCreation", "keyRevokedOrExpiredOrInsecure"})
|
||||
public static void setCreation(TextView textView, Date creationDate, boolean revokedOrExpiredOrInsecure) {
|
||||
Context context = textView.getContext();
|
||||
|
||||
String text = "";
|
||||
@@ -81,7 +81,7 @@ public class ImportKeysBindings {
|
||||
}
|
||||
|
||||
textView.setText(text);
|
||||
textView.setTextColor(ImportKeysBindingsUtils.getColor(context, revokedOrExpired));
|
||||
textView.setTextColor(ImportKeysBindingsUtils.getColor(context, revokedOrExpiredOrInsecure));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ import java.util.Map;
|
||||
|
||||
public class ImportKeysExtraBindings {
|
||||
|
||||
@BindingAdapter({"keyRevoked", "keyExpired"})
|
||||
public static void setStatus(ImageView imageView, boolean revoked, boolean expired) {
|
||||
@BindingAdapter({"keyRevoked", "keyExpired", "keySecure"})
|
||||
public static void setStatus(ImageView imageView, boolean revoked, boolean expired, boolean secure) {
|
||||
Context context = imageView.getContext();
|
||||
|
||||
if (revoked) {
|
||||
@@ -46,6 +46,9 @@ public class ImportKeysExtraBindings {
|
||||
} else if (expired) {
|
||||
KeyFormattingUtils.setStatusImage(context, imageView, null,
|
||||
KeyFormattingUtils.State.EXPIRED, R.color.key_flag_gray);
|
||||
} else if (!secure) {
|
||||
KeyFormattingUtils.setStatusImage(context, imageView, null,
|
||||
KeyFormattingUtils.State.INSECURE, R.color.key_flag_gray);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user