private void handleEdit(int start, int end) {
if (start == -1 || end == -1) {
// This chip no longer exists in the field.
dismissDropDown();
return;
}
// This is in the middle of a chip, so select out the whole chip
// and commit it.
Editable editable = getText();
setSelection(end);
String text = getText().toString().substring(start, end);
if (!TextUtils.isEmpty(text)) {
RecipientEntry entry = RecipientEntry.constructFakeEntry(text, isValid(text));
QwertyKeyListener.markAsReplaced(editable, start, end, "");
CharSequence chipText = createChip(entry, false);
int selEnd = getSelectionEnd();
if (chipText != null && start > -1 && selEnd > -1) {
editable.replace(start, selEnd, chipText);
}
}
dismissDropDown();
}
TextChipsEditView.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:talk-android
作者:
评论列表
文章目录