Clearselectedchip and unselectchip should not call each other.
Fixes Bug:4768416 StackOverflowError when clicking on chips
Change-Id: I8151cee90390df834eef87f60af96da9b910daca
diff --git a/src/com/android/ex/chips/RecipientEditTextView.java b/src/com/android/ex/chips/RecipientEditTextView.java
index b4b27fc..b61ea8c 100644
--- a/src/com/android/ex/chips/RecipientEditTextView.java
+++ b/src/com/android/ex/chips/RecipientEditTextView.java
@@ -1123,15 +1123,14 @@
int start = getChipStart(chip);
int end = getChipEnd(chip);
Editable editable = getText();
+ mSelectedChip = null;
if (start == -1 || end == -1) {
Log.e(TAG, "The chip being unselected no longer exists but should.");
} else {
- getSpannable().removeSpan(this);
+ getSpannable().removeSpan(chip);
QwertyKeyListener.markAsReplaced(editable, start, end, "");
editable.replace(start, end, createChip(chip.getEntry(), false));
}
- mSelectedChip = null;
- clearSelectedChip();
setCursorVisible(true);
setSelection(editable.length());
if (mAlternatesPopup != null && mAlternatesPopup.isShowing()) {