diff --git a/app/src/main/java/eu/faircode/email/ActivityMain.java b/app/src/main/java/eu/faircode/email/ActivityMain.java index 36fa557fae..878080be32 100644 --- a/app/src/main/java/eu/faircode/email/ActivityMain.java +++ b/app/src/main/java/eu/faircode/email/ActivityMain.java @@ -309,6 +309,10 @@ public class ActivityMain extends ActivityBase implements FragmentManager.OnBack editor.putBoolean("landscape3", false); } + // Default send bubbles off when accessibility enabled + if (Helper.isAccessibilityEnabled(this)) + editor.putBoolean("send_chips", false); + editor.apply(); if (Helper.isNight(this)) diff --git a/app/src/main/java/eu/faircode/email/ApplicationEx.java b/app/src/main/java/eu/faircode/email/ApplicationEx.java index 2e1eaa2bdb..0bd62c5018 100644 --- a/app/src/main/java/eu/faircode/email/ApplicationEx.java +++ b/app/src/main/java/eu/faircode/email/ApplicationEx.java @@ -594,6 +594,9 @@ public class ApplicationEx extends Application boolean reply_all = prefs.getBoolean("reply_all", false); if (reply_all) editor.remove("reply_all").putString("answer_action", "reply_all"); + } else if (version < 1847) { + if (Helper.isAccessibilityEnabled(context)) + editor.putBoolean("send_chips", false); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !BuildConfig.DEBUG) diff --git a/app/src/main/java/eu/faircode/email/EditTextMultiAutoComplete.java b/app/src/main/java/eu/faircode/email/EditTextMultiAutoComplete.java index 03243d3061..759e4145c3 100644 --- a/app/src/main/java/eu/faircode/email/EditTextMultiAutoComplete.java +++ b/app/src/main/java/eu/faircode/email/EditTextMultiAutoComplete.java @@ -248,10 +248,10 @@ public class EditTextMultiAutoComplete extends AppCompatMultiAutoCompleteTextVie if (!found && start < i + 1 && !(focus && overlap(start, i, selStart, selEnd))) { - String email = edit.subSequence(start, i + 1).toString(); + String address = edit.subSequence(start, i + 1).toString(); InternetAddress[] parsed; try { - parsed = MessageHelper.parseAddresses(context, email); + parsed = MessageHelper.parseAddresses(context, address); if (parsed != null) for (InternetAddress a : parsed) a.validate(); @@ -265,8 +265,8 @@ public class EditTextMultiAutoComplete extends AppCompatMultiAutoCompleteTextVie else if (kar != ',') edit.insert(++i, ","); - String e = parsed[0].getAddress(); - String p = parsed[0].getPersonal(); + String email = parsed[0].getAddress(); + String personal = parsed[0].getPersonal(); Bitmap bm = null; Uri lookupUri = ContactInfo.getLookupUri(parsed); @@ -278,18 +278,18 @@ public class EditTextMultiAutoComplete extends AppCompatMultiAutoCompleteTextVie Log.e(ex); } - if (bm == null && generated && !TextUtils.isEmpty(email)) + if (bm == null && generated && !TextUtils.isEmpty(address)) if (identicons) - bm = ImageHelper.generateIdenticon(e, dp24, 5, context); + bm = ImageHelper.generateIdenticon(email, dp24, 5, context); else - bm = ImageHelper.generateLetterIcon(e, p, dp24, context); + bm = ImageHelper.generateLetterIcon(email, personal, dp24, context); if (bm != null && circular && !identicons) bm = ImageHelper.makeCircular(bm, dp3); Drawable avatar = (bm == null ? null : new BitmapDrawable(res, bm)); - String text = (TextUtils.isEmpty(p) ? e : p); + String text = (TextUtils.isEmpty(personal) ? email : personal); // https://github.com/material-components/material-components-android/blob/master/docs/components/Chip.md ChipDrawable cd = ChipDrawable.createFromResource(ctx, R.xml.chip); @@ -307,6 +307,8 @@ public class EditTextMultiAutoComplete extends AppCompatMultiAutoCompleteTextVie cd.setBounds(0, 0, cd.getIntrinsicWidth(), cd.getIntrinsicHeight()); ClipImageSpan is = new ClipImageSpan(cd); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) + is.setContentDescription(email); edit.setSpan(is, start, i + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); if (kar == ',' &&