Loading core/java/android/text/method/ArrowKeyMovementMethod.java +23 −16 Original line number Diff line number Diff line Loading @@ -240,13 +240,20 @@ public class ArrowKeyMovementMethod extends BaseMovementMethod implements Moveme boolean handled = Touch.onTouchEvent(widget, buffer, event); if (widget.isFocused() && !widget.didTouchFocusSelect()) { if (widget.didTouchFocusSelect() && !isMouse) { return handled; } if (action == MotionEvent.ACTION_DOWN) { // Capture the mouse pointer down location to ensure selection starts // right under the mouse (and is not influenced by cursor location). // The code below needs to run for mouse events. // For touch events, the code should run only when selection is active. if (isMouse || isTouchSelecting(isMouse, buffer)) { if (!widget.isFocused()) { if (!widget.requestFocus()) { return handled; } } int offset = widget.getOffsetForPosition(event.getX(), event.getY()); buffer.setSpan(LAST_TAP_DOWN, offset, offset, Spannable.SPAN_POINT_POINT); // Disallow intercepting of the touch events, so that Loading @@ -255,8 +262,8 @@ public class ArrowKeyMovementMethod extends BaseMovementMethod implements Moveme // mode once the view detected it needed to scroll. widget.getParent().requestDisallowInterceptTouchEvent(true); } } else if (action == MotionEvent.ACTION_MOVE) { } else if (widget.isFocused()) { if (action == MotionEvent.ACTION_MOVE) { // Cursor can be active at any location in the text while mouse pointer can start // selection from a totally different location. Use LAST_TAP_DOWN span to ensure // text selection will start from mouse pointer location. Loading Loading
core/java/android/text/method/ArrowKeyMovementMethod.java +23 −16 Original line number Diff line number Diff line Loading @@ -240,13 +240,20 @@ public class ArrowKeyMovementMethod extends BaseMovementMethod implements Moveme boolean handled = Touch.onTouchEvent(widget, buffer, event); if (widget.isFocused() && !widget.didTouchFocusSelect()) { if (widget.didTouchFocusSelect() && !isMouse) { return handled; } if (action == MotionEvent.ACTION_DOWN) { // Capture the mouse pointer down location to ensure selection starts // right under the mouse (and is not influenced by cursor location). // The code below needs to run for mouse events. // For touch events, the code should run only when selection is active. if (isMouse || isTouchSelecting(isMouse, buffer)) { if (!widget.isFocused()) { if (!widget.requestFocus()) { return handled; } } int offset = widget.getOffsetForPosition(event.getX(), event.getY()); buffer.setSpan(LAST_TAP_DOWN, offset, offset, Spannable.SPAN_POINT_POINT); // Disallow intercepting of the touch events, so that Loading @@ -255,8 +262,8 @@ public class ArrowKeyMovementMethod extends BaseMovementMethod implements Moveme // mode once the view detected it needed to scroll. widget.getParent().requestDisallowInterceptTouchEvent(true); } } else if (action == MotionEvent.ACTION_MOVE) { } else if (widget.isFocused()) { if (action == MotionEvent.ACTION_MOVE) { // Cursor can be active at any location in the text while mouse pointer can start // selection from a totally different location. Use LAST_TAP_DOWN span to ensure // text selection will start from mouse pointer location. Loading