diff options
author | mindyp <mindyp@google.com> | 2012-11-08 16:30:27 -0800 |
---|---|---|
committer | mindyp <mindyp@google.com> | 2012-11-08 17:06:24 -0800 |
commit | e719fc8a822b3db583f82a6de1b8690267e14d96 (patch) | |
tree | e48b23e568348a66db7adf3772b8c3301ae9a8dd | |
parent | bc8820f28fae94349e41ad09e166b0537ddd1377 (diff) | |
download | android_frameworks_ex-e719fc8a822b3db583f82a6de1b8690267e14d96.tar.gz android_frameworks_ex-e719fc8a822b3db583f82a6de1b8690267e14d96.tar.bz2 android_frameworks_ex-e719fc8a822b3db583f82a6de1b8690267e14d96.zip |
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
-rw-r--r-- | chips/src/com/android/ex/chips/RecipientEditTextView.java | 8 |
1 files 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)); } } |