@@ -14,10 +14,12 @@ import org.sufficientlysecure.keychain.model.SubKey.UnifiedKeyInfo;
|
||||
|
||||
|
||||
public class FlexibleKeyItemFactory {
|
||||
private final Resources resources;
|
||||
private Map<String, FlexibleKeyHeader> initialsHeaderMap = new HashMap<>();
|
||||
private FlexibleKeyHeader myKeysHeader;
|
||||
|
||||
public FlexibleKeyItemFactory(Resources resources) {
|
||||
this.resources = resources;
|
||||
String myKeysHeaderText = resources.getString(R.string.my_keys);
|
||||
myKeysHeader = new FlexibleKeyHeader(myKeysHeaderText);
|
||||
}
|
||||
@@ -62,10 +64,10 @@ public class FlexibleKeyItemFactory {
|
||||
headerText = unifiedKeyInfo.email();
|
||||
}
|
||||
if (headerText == null || headerText.isEmpty()) {
|
||||
return "";
|
||||
return resources.getString(R.string.keylist_header_anonymous);
|
||||
}
|
||||
if (!Character.isLetter(headerText.codePointAt(0))) {
|
||||
return "#";
|
||||
return resources.getString(R.string.keylist_header_special);
|
||||
}
|
||||
return headerText.substring(0, 1).toUpperCase();
|
||||
}
|
||||
|
||||
@@ -37,21 +37,20 @@ public class KeyInfoFormatter {
|
||||
}
|
||||
|
||||
public void formatUserId(TextView name, TextView email) {
|
||||
if (keyInfo.name() == null) {
|
||||
if (keyInfo.email() != null) {
|
||||
name.setText(highlighter.highlight(keyInfo.email()));
|
||||
email.setVisibility(View.GONE);
|
||||
} else {
|
||||
name.setText(R.string.user_id_no_name);
|
||||
}
|
||||
if (keyInfo.name() == null && keyInfo.email() == null) {
|
||||
String readableKeyId = KeyFormattingUtils.beautifyKeyId(keyInfo.master_key_id());
|
||||
name.setText(context.getString(R.string.keylist_item_key_id, readableKeyId));
|
||||
email.setVisibility(View.GONE);
|
||||
} else if (keyInfo.name() == null) {
|
||||
name.setText(highlighter.highlight(keyInfo.email()));
|
||||
email.setVisibility(View.GONE);
|
||||
} else if (keyInfo.email() == null) {
|
||||
name.setText(highlighter.highlight(keyInfo.name()));
|
||||
email.setVisibility(View.GONE);
|
||||
} else {
|
||||
name.setText(highlighter.highlight(keyInfo.name()));
|
||||
if (keyInfo.email() != null) {
|
||||
email.setText(highlighter.highlight(keyInfo.email()));
|
||||
email.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
email.setVisibility(View.GONE);
|
||||
}
|
||||
email.setText(highlighter.highlight(keyInfo.email()));
|
||||
email.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user