|
|
|
@ -79,22 +79,13 @@ public class EditTextMultiAutoComplete extends AppCompatMultiAutoCompleteTextVie
|
|
|
|
|
ContextThemeWrapper ctx = new ContextThemeWrapper(context,
|
|
|
|
|
dark ? R.style.Base_Theme_Material3_Dark : R.style.Base_Theme_Material3_Light);
|
|
|
|
|
ContentResolver resolver = context.getContentResolver();
|
|
|
|
|
int dp3 = Helper.dp2pixels(context, 3);
|
|
|
|
|
DisplayMetrics dm = getResources().getDisplayMetrics();
|
|
|
|
|
|
|
|
|
|
addTextChangedListener(new TextWatcher() {
|
|
|
|
|
@Override
|
|
|
|
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
|
|
// Do nothing
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Runnable update = new Runnable() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
|
|
// Do nothing
|
|
|
|
|
}
|
|
|
|
|
public void run() {
|
|
|
|
|
try {
|
|
|
|
|
Editable edit = getText();
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void afterTextChanged(Editable edit) {
|
|
|
|
|
boolean added = false;
|
|
|
|
|
List<ClipImageSpan> spans = new ArrayList<>();
|
|
|
|
|
spans.addAll(Arrays.asList(edit.getSpans(0, edit.length(), ClipImageSpan.class)));
|
|
|
|
@ -117,7 +108,7 @@ public class EditTextMultiAutoComplete extends AppCompatMultiAutoCompleteTextVie
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!found) {
|
|
|
|
|
if (!found && start < i + 1) {
|
|
|
|
|
String email = edit.subSequence(start, i + 1).toString();
|
|
|
|
|
InternetAddress[] parsed;
|
|
|
|
|
try {
|
|
|
|
@ -147,7 +138,7 @@ public class EditTextMultiAutoComplete extends AppCompatMultiAutoCompleteTextVie
|
|
|
|
|
cd.setChipIcon(avatar);
|
|
|
|
|
// cd.setLayoutDirection(View.LAYOUT_DIRECTION_LOCALE);
|
|
|
|
|
cd.setText(text);
|
|
|
|
|
cd.setMaxWidth(2 * dm.widthPixels / 3);
|
|
|
|
|
cd.setMaxWidth(getWidth());
|
|
|
|
|
cd.setBounds(0, 0, cd.getIntrinsicWidth(), cd.getIntrinsicHeight());
|
|
|
|
|
|
|
|
|
|
ClipImageSpan is = new ClipImageSpan(cd);
|
|
|
|
@ -168,6 +159,29 @@ public class EditTextMultiAutoComplete extends AppCompatMultiAutoCompleteTextVie
|
|
|
|
|
|
|
|
|
|
if (spans.size() > 0 || added)
|
|
|
|
|
invalidate();
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
Log.e(ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
addTextChangedListener(new TextWatcher() {
|
|
|
|
|
@Override
|
|
|
|
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
|
|
// Do nothing
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
|
|
// Do nothing
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void afterTextChanged(Editable edit) {
|
|
|
|
|
if (getWidth() == 0)
|
|
|
|
|
post(update);
|
|
|
|
|
else
|
|
|
|
|
update.run();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|