Check for letter instead of printable

This commit is contained in:
M66B 2019-11-25 18:15:57 +01:00
parent ae184eaa91
commit af97e9e0f4
1 changed files with 4 additions and 3 deletions

View File

@ -113,15 +113,16 @@ class ImageHelper {
name = email; name = email;
String letter = null; String letter = null;
for (int i = 0; i < name.length(); i++) { int len = name.length();
for (int i = 0; i < len; i++) {
char kar = name.charAt(i); char kar = name.charAt(i);
if (Helper.isPrintableChar(kar)) { if (Character.isLetter(kar)) {
letter = name.substring(i, i + 1).toUpperCase(); letter = name.substring(i, i + 1).toUpperCase();
break; break;
} }
} }
if (letter == null) if (letter == null)
return null; letter = (len > 0 ? name.substring(0, 1) : "?");
float h = Math.abs(email.hashCode()) % 360f; float h = Math.abs(email.hashCode()) % 360f;
return generateLetterIcon(letter, h, size, context); return generateLetterIcon(letter, h, size, context);