RecipientEditTextView.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:Calendar_lunar 作者:
/**
 * Remove selection from this chip. Unselecting a RecipientChip will render
 * the chip without a delete icon and with an unfocused background. This is
 * called when the RecipientChip no longer has focus.
 */
private void unselectChip(RecipientChip chip) {
    int start = getChipStart(chip);
    int end = getChipEnd(chip);
    Editable editable = getText();
    mSelectedChip = null;
    if (start == -1 || end == -1) {
        Log.w(TAG, "The chip doesn't exist or may be a chip a user was editing");
        setSelection(editable.length());
        commitDefault();
    } else {
        getSpannable().removeSpan(chip);
        QwertyKeyListener.markAsReplaced(editable, start, end, "");
        editable.removeSpan(chip);
        try {
            if (!mNoChips) {
                editable.setSpan(constructChipSpan(chip.getEntry(), start, false), start, end,
                        Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            }
        } catch (NullPointerException e) {
            Log.e(TAG, e.getMessage(), e);
        }
    }
    setCursorVisible(true);
    setSelection(editable.length());
    if (mAlternatesPopup != null && mAlternatesPopup.isShowing()) {
        mAlternatesPopup.dismiss();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号