use of im.actor.sdk.controllers.compose.view.UserSpan in project actor-platform by actorapp.
the class GroupUsersFragment method updateEditText.
private void updateEditText() {
Integer[] selected = getSelected();
String src = "";
for (int i = 0; i < selected.length; i++) {
src += "!";
}
Spannable spannable = new SpannableString(src);
for (int i = 0; i < selected.length; i++) {
spannable.setSpan(new UserSpan(users().get(selected[i]), Screen.dp(200)), i, i + 1, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
}
searchField.removeTextChangedListener(textWatcher);
searchField.setText(spannable);
searchField.setSelection(spannable.length());
searchField.addTextChangedListener(textWatcher);
filter("");
getAdapter().notifyDataSetChanged();
}
use of im.actor.sdk.controllers.compose.view.UserSpan in project actor-platform by actorapp.
the class GroupUsersFragment method checkForDeletions.
private void checkForDeletions(Editable editable) {
Integer[] selected = getSelected();
boolean hasDeletions = false;
UserSpan[] spans = editable.getSpans(0, editable.length(), UserSpan.class);
for (Integer u : selected) {
boolean founded = false;
for (UserSpan span : spans) {
if (span.getUser().getId() == u) {
if (editable.getSpanStart(span) == editable.getSpanEnd(span)) {
break;
} else {
founded = true;
break;
}
}
}
if (!founded) {
hasDeletions = true;
unselect(u);
}
}
if (hasDeletions) {
getActivity().invalidateOptionsMenu();
getAdapter().notifyDataSetChanged();
}
}
Aggregations