mirror of https://github.com/M66B/FairEmail.git
Check for letter instead of printable
This commit is contained in:
parent
ae184eaa91
commit
af97e9e0f4
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue