better handling of unknown status

This commit is contained in:
Vincent Breitmoser 2017-07-20 21:30:47 +02:00
parent 57b0e16ecc
commit 66465f7c1b
3 changed files with 9 additions and 5 deletions

View file

@ -68,9 +68,12 @@ public class KeyserverStatusLoader extends AsyncTaskLoader<KeyserverStatus> {
try {
if (cursor.moveToFirst()) {
if (cursor.isNull(INDEX_SEEN_ON_KEYSERVERS) || cursor.isNull(INDEX_LAST_UPDATED)) {
return new KeyserverStatus(masterKeyId);
}
boolean isPublished = cursor.getInt(INDEX_SEEN_ON_KEYSERVERS) != 0;
Date lastUpdated = cursor.isNull(INDEX_LAST_UPDATED) ?
null : new Date(cursor.getLong(INDEX_LAST_UPDATED) * 1000);
Date lastUpdated = new Date(cursor.getLong(INDEX_LAST_UPDATED) * 1000);
return new KeyserverStatus(masterKeyId, isPublished, lastUpdated);
}

View file

@ -88,7 +88,7 @@ public class KeyserverStatusView extends FrameLayout implements KeyserverStatusM
@Override
public void setDisplayStatusUnknown() {
setDisplayStatus(KeyserverDisplayStatus.UNKNOWN);
vSubtitle.setVisibility(View.GONE);
vSubtitle.setText(R.string.keyserver_last_updated_never);
}
@Override

View file

@ -1844,8 +1844,9 @@
<string name="keyserver_title_published">"Published"</string>
<string name="keyserver_title_not_published">"Not Published"</string>
<string name="keyserver_title_unknown">"Unknown"</string>
<string name="keyserver_last_updated">"Last updated: %s"</string>
<string name="keyserver_title_unknown">"Keyserver status: Unknown"</string>
<string name="keyserver_last_updated">"Last checked: %s"</string>
<string name="keyserver_last_updated_never">Last checked: Never</string>
<string name="key_insecure_bitstrength_2048_problem">"This key uses the <b>%1$s</b> algorithm with a strength of <b>%2$s bits</b>. A secure key should have a strength of 2048 bits."</string>
<string name="key_insecure_bitstrength_2048_solution">"This key can\'t be upgraded. For secure communication, the owner must generate a new key."</string>