fix testTooManyCapitalLetters wrt unicameral scripts

In v2.6.3, Osmand would keep complaining about too many capital letters
in a name when using any script that doesn't distinguish between upper-
and lowercase such as the CJK family, Arabic, Thai/Lao etc.
This is because the "Character.toUpperCase(c) != c" test could never be
true for those scripts so all characters were classified as uppercase.
The builtin Character.isUpperCase() handles this correctly and is much
clearer, too.
This commit is contained in:
Matthias Bethke 2017-06-26 00:14:02 +10:00
parent ec062fe266
commit 0e7c9b21a2

View file

@ -408,10 +408,10 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
for(int i = 0; i < name.length(); i++) {
char c = name.charAt(i);
if(Character.isLetter(c) || Character.getType(c) == Character.LETTER_NUMBER) {
if(Character.toUpperCase(c) != c && Character.toLowerCase(c) == c) {
lower ++;
} else {
if(Character.isUpperCase(c)) {
capital ++;
} else {
lower ++;
}
} else {
nonalpha ++;