mirror of https://github.com/M66B/FairEmail.git
Debug: non single script email addresses
This commit is contained in:
parent
754a9275c4
commit
86caa3c121
|
@ -2521,8 +2521,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
ssb.setSpan(new ForegroundColorSpan(textColorLink), start, ssb.length(), 0);
|
||||
}
|
||||
} else {
|
||||
boolean homoPersonal = TextHelper.isSingleScript(personal);
|
||||
if (BuildConfig.DEBUG && !homoPersonal)
|
||||
personal = TextHelper.getNonLatinCodepoints(personal);
|
||||
ssb.append(personal);
|
||||
if (!TextHelper.isSingleScript(personal)) {
|
||||
if (!homoPersonal) {
|
||||
int start = ssb.length() - personal.length();
|
||||
ssb.setSpan(new StyleSpan(Typeface.BOLD), start, ssb.length(), 0);
|
||||
ssb.setSpan(new ForegroundColorSpan(colorError), start, ssb.length(), 0);
|
||||
|
|
|
@ -150,7 +150,7 @@ public class TextHelper {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (us.equals(Character.UnicodeScript.COMMON))
|
||||
if (Character.UnicodeScript.COMMON.equals(us))
|
||||
continue;
|
||||
|
||||
if (script == null)
|
||||
|
@ -161,6 +161,23 @@ public class TextHelper {
|
|||
return true;
|
||||
}
|
||||
|
||||
static String getNonLatinCodepoints(String text) {
|
||||
int codepoint;
|
||||
Character.UnicodeScript us;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < text.length(); ) {
|
||||
codepoint = text.codePointAt(i);
|
||||
i += Character.charCount(codepoint);
|
||||
us = Character.UnicodeScript.of(codepoint);
|
||||
if (!Character.isSpaceChar(codepoint) &&
|
||||
!Character.UnicodeScript.COMMON.equals(us) &&
|
||||
!Character.UnicodeScript.LATIN.equals(us))
|
||||
sb.append('<').append(Integer.toHexString(codepoint)).append('>');
|
||||
sb.append(Character.toChars(codepoint));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
static String normalizeNotification(Context context, String text) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean notify_transliterate = prefs.getBoolean("notify_transliterate", false);
|
||||
|
|
Loading…
Reference in New Issue