group non-letters in "#" group, display keys with only an address in-order

This commit is contained in:
Vincent Breitmoser
2018-07-03 22:28:23 +02:00
parent cb3289f874
commit 794b1dc8e0
2 changed files with 11 additions and 2 deletions

View File

@@ -58,6 +58,15 @@ public class FlexibleKeyItemFactory {
@NonNull
private String getHeaderText(UnifiedKeyInfo unifiedKeyInfo) {
String headerText = unifiedKeyInfo.name();
return headerText == null || headerText.isEmpty() ? "" : headerText.substring(0, 1).toUpperCase();
if (headerText == null || headerText.isEmpty()) {
headerText = unifiedKeyInfo.email();
}
if (headerText == null || headerText.isEmpty()) {
return "";
}
if (!Character.isLetter(headerText.codePointAt(0))) {
return "#";
}
return headerText.substring(0, 1).toUpperCase();
}
}