/**
* 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(final DrawableRecipientChip chip)
{
final int start=getChipStart(chip);
final int end=getChipEnd(chip);
final 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(),false,false),start,end,Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
catch(final NullPointerException e)
{
Log.e(TAG,e.getMessage(),e);
}
}
setCursorVisible(true);
setSelection(editable.length());
if(mAlternatesPopup!=null&&mAlternatesPopup.isShowing())
mAlternatesPopup.dismiss();
}
RecipientEditTextView.java 文件源码
java
阅读 34
收藏 0
点赞 0
评论 0
项目:ChipsLibrary
作者:
评论列表
文章目录