ImportKeys: Set real date even if we don't have an expected date

This commit is contained in:
Andrea Torlaschi
2016-08-28 22:33:18 +02:00
parent 9714bcc85b
commit c3b1f2dec5
2 changed files with 5 additions and 5 deletions

View File

@@ -246,7 +246,9 @@ public class ImportKeysAdapter extends RecyclerView.Adapter<ImportKeysAdapter.Vi
Date expectedDate = entry.getDate();
Date creationDate = keyRing.getCreationDate();
if ((expectedDate != null) && !expectedDate.equals(creationDate)) {
if (expectedDate == null) {
entry.setDate(creationDate);
} else if (!expectedDate.equals(creationDate)) {
throw new AssertionError("Creation date doesn't match the expected one");
}
entry.setKeyId(keyRing.getMasterKeyId());

View File

@@ -56,13 +56,11 @@ public class ImportKeysBindings {
public static void setCreation(TextView textView, Date creationDate, boolean revokedOrExpired) {
Context context = textView.getContext();
String text;
String text = "";
if (creationDate != null) {
text = DateFormat.getDateFormat(context).format(creationDate);
} else {
Resources resources = context.getResources();
text = resources.getString(R.string.unknown);
}
textView.setText(text);
textView.setTextColor(ImportKeysBindingsUtils.getColor(context, revokedOrExpired));
}