Send chips: accessibility

pull/194/merge
M66B 3 years ago
parent ab270eb596
commit b0e4c4f697

@ -309,6 +309,10 @@ public class ActivityMain extends ActivityBase implements FragmentManager.OnBack
editor.putBoolean("landscape3", false); editor.putBoolean("landscape3", false);
} }
// Default send bubbles off when accessibility enabled
if (Helper.isAccessibilityEnabled(this))
editor.putBoolean("send_chips", false);
editor.apply(); editor.apply();
if (Helper.isNight(this)) if (Helper.isNight(this))

@ -594,6 +594,9 @@ public class ApplicationEx extends Application
boolean reply_all = prefs.getBoolean("reply_all", false); boolean reply_all = prefs.getBoolean("reply_all", false);
if (reply_all) if (reply_all)
editor.remove("reply_all").putString("answer_action", "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) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !BuildConfig.DEBUG)

@ -248,10 +248,10 @@ public class EditTextMultiAutoComplete extends AppCompatMultiAutoCompleteTextVie
if (!found && start < i + 1 && if (!found && start < i + 1 &&
!(focus && overlap(start, i, selStart, selEnd))) { !(focus && overlap(start, i, selStart, selEnd))) {
String email = edit.subSequence(start, i + 1).toString(); String address = edit.subSequence(start, i + 1).toString();
InternetAddress[] parsed; InternetAddress[] parsed;
try { try {
parsed = MessageHelper.parseAddresses(context, email); parsed = MessageHelper.parseAddresses(context, address);
if (parsed != null) if (parsed != null)
for (InternetAddress a : parsed) for (InternetAddress a : parsed)
a.validate(); a.validate();
@ -265,8 +265,8 @@ public class EditTextMultiAutoComplete extends AppCompatMultiAutoCompleteTextVie
else if (kar != ',') else if (kar != ',')
edit.insert(++i, ","); edit.insert(++i, ",");
String e = parsed[0].getAddress(); String email = parsed[0].getAddress();
String p = parsed[0].getPersonal(); String personal = parsed[0].getPersonal();
Bitmap bm = null; Bitmap bm = null;
Uri lookupUri = ContactInfo.getLookupUri(parsed); Uri lookupUri = ContactInfo.getLookupUri(parsed);
@ -278,18 +278,18 @@ public class EditTextMultiAutoComplete extends AppCompatMultiAutoCompleteTextVie
Log.e(ex); Log.e(ex);
} }
if (bm == null && generated && !TextUtils.isEmpty(email)) if (bm == null && generated && !TextUtils.isEmpty(address))
if (identicons) if (identicons)
bm = ImageHelper.generateIdenticon(e, dp24, 5, context); bm = ImageHelper.generateIdenticon(email, dp24, 5, context);
else else
bm = ImageHelper.generateLetterIcon(e, p, dp24, context); bm = ImageHelper.generateLetterIcon(email, personal, dp24, context);
if (bm != null && circular && !identicons) if (bm != null && circular && !identicons)
bm = ImageHelper.makeCircular(bm, dp3); bm = ImageHelper.makeCircular(bm, dp3);
Drawable avatar = (bm == null ? null : new BitmapDrawable(res, bm)); 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 // https://github.com/material-components/material-components-android/blob/master/docs/components/Chip.md
ChipDrawable cd = ChipDrawable.createFromResource(ctx, R.xml.chip); 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()); cd.setBounds(0, 0, cd.getIntrinsicWidth(), cd.getIntrinsicHeight());
ClipImageSpan is = new ClipImageSpan(cd); 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); edit.setSpan(is, start, i + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
if (kar == ',' && if (kar == ',' &&

Loading…
Cancel
Save