From e719fc8a822b3db583f82a6de1b8690267e14d96 Mon Sep 17 00:00:00 2001 From: mindyp Date: Thu, 8 Nov 2012 16:30:27 -0800 Subject: dont replace the text in the text field when editing a fake or generated entry We are editing the entire text in there, and that includes the display name and any other information...so just remove the span This means we dont trigger a text change that triggers a scroll Fixes b/7499873 Odd scroll when touch non-contact chips with quote text enabled Change-Id: I0c537e7fec663abe3cec96a5b59bc52caa009a30 --- chips/src/com/android/ex/chips/RecipientEditTextView.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chips/src/com/android/ex/chips/RecipientEditTextView.java b/chips/src/com/android/ex/chips/RecipientEditTextView.java index 011b1e9..b460a4d 100644 --- a/chips/src/com/android/ex/chips/RecipientEditTextView.java +++ b/chips/src/com/android/ex/chips/RecipientEditTextView.java @@ -427,7 +427,7 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements int whatEnd = mTokenizer.findTokenEnd(text, start); // This token was already tokenized, so skip past the ending token. if (whatEnd < text.length() && text.charAt(whatEnd) == ',') { - whatEnd++; + whatEnd = movePastTerminators(whatEnd); } // In the middle of chip; treat this as an edit // and commit the whole token. @@ -1117,6 +1117,7 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements int whatEnd = mTokenizer.findTokenEnd(getText(), start); // In the middle of chip; treat this as an edit // and commit the whole token. + whatEnd = movePastTerminators(whatEnd); if (whatEnd != getSelectionEnd()) { handleEdit(start, whatEnd); return true; @@ -1880,8 +1881,7 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements if (shouldShowEditableText(currentChip)) { CharSequence text = currentChip.getValue(); Editable editable = getText(); - removeChip(currentChip); - editable.append(text); + getSpannable().removeSpan(currentChip); setCursorVisible(true); setSelection(editable.length()); return new RecipientChip(null, RecipientEntry.constructFakeEntry((String) text), -1); @@ -2208,7 +2208,7 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements private void scrollBottomIntoView() { if (mScrollView != null) { - mScrollView.scrollBy(0, (int)(getLineCount() * mChipHeight)); + mScrollView.scrollBy(0, (int) (getLineCount() * mChipHeight)); } } -- cgit v1.2.3