diff options
author | Mady Mellor <madym@google.com> | 2015-05-22 10:31:12 -0700 |
---|---|---|
committer | Roozbeh Pournader <roozbeh@google.com> | 2015-06-03 19:53:52 +0000 |
commit | 36d5a7b22500ec8c3d754e9caf1728dda168ad92 (patch) | |
tree | 4ffefb06d4308fbb62e1932b4108282467a365e9 /core/java | |
parent | 59845bef8e66c278c728744785852b8799d832fc (diff) | |
download | frameworks_base-36d5a7b22500ec8c3d754e9caf1728dda168ad92.zip frameworks_base-36d5a7b22500ec8c3d754e9caf1728dda168ad92.tar.gz frameworks_base-36d5a7b22500ec8c3d754e9caf1728dda168ad92.tar.bz2 |
Ensure to reset state of selecting by word/char for new selections
Previously this value was only updated when interacting with the
selection handles, so if you started a selection, entered by-char mode,
and then started another selection you would still be in by-char mode.
This resulted in incorrect behavior.
This CL alters the logic to update the handle state whenever the cursor
is placed which will included the initial long press to select a word.
Bug: 21301589
Change-Id: I15dbe6f2b76c7edd8ea4b3ba53e7107c47bc48fa
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/widget/Editor.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index 667dac4..9383721 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -4065,12 +4065,17 @@ public class Editor { offset = getNextCursorOffset(selectionEnd, false); mTouchWordDelta = 0.0f; } - mInWord = !getWordIteratorWithText().isBoundary(offset); positionAtCursorOffset(offset, false); } } @Override + protected void positionAtCursorOffset(int offset, boolean parentScrolled) { + super.positionAtCursorOffset(offset, parentScrolled); + mInWord = !getWordIteratorWithText().isBoundary(offset); + } + + @Override public boolean onTouchEvent(MotionEvent event) { boolean superResult = super.onTouchEvent(event); if (event.getActionMasked() == MotionEvent.ACTION_UP) { @@ -4187,12 +4192,17 @@ public class Editor { offset = getNextCursorOffset(selectionStart, true); mTouchWordDelta = 0.0f; } - mInWord = !getWordIteratorWithText().isBoundary(offset); positionAtCursorOffset(offset, false); } } @Override + protected void positionAtCursorOffset(int offset, boolean parentScrolled) { + super.positionAtCursorOffset(offset, parentScrolled); + mInWord = !getWordIteratorWithText().isBoundary(offset); + } + + @Override public boolean onTouchEvent(MotionEvent event) { boolean superResult = super.onTouchEvent(event); if (event.getActionMasked() == MotionEvent.ACTION_UP) { |