Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f9510ca authored by Gilles Debunne's avatar Gilles Debunne Committed by Android (Google) Code Review
Browse files

Merge "Touch moves cursor in text refactored"

parents e8bb6fef 004b02d6
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -280,8 +280,6 @@ public class ArrowKeyMovementMethod extends BaseMovementMethod implements Moveme
                if (isSelecting(buffer)) {
                    buffer.removeSpan(LAST_TAP_DOWN);
                    Selection.extendSelection(buffer, offset);
                } else if (!widget.shouldIgnoreActionUpEvent()) {
                    Selection.setSelection(buffer, offset);
                }

                MetaKeyKeyListener.adjustMetaAfterKeypress(buffer);
+7 −14
Original line number Diff line number Diff line
@@ -8353,7 +8353,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
        }

        final boolean touchIsFinished = (action == MotionEvent.ACTION_UP) &&
                !shouldIgnoreActionUpEvent() && isFocused();
                !mIgnoreActionUpEvent && isFocused();

         if ((mMovement != null || onCheckIsTextEditor()) && isEnabled()
                && mText instanceof Spannable && mLayout != null) {
@@ -8377,6 +8377,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
            }

            if (touchIsFinished && (isTextEditable() || mTextIsSelectable)) {
                // Move cursor
                final int offset = getOffsetForPosition(event.getX(), event.getY());
                Selection.setSelection((Spannable) mText, offset);

                // Show the IME, except when selecting in read-only text.
                final InputMethodManager imm = InputMethodManager.peekInstance();
                viewClicked(imm);
@@ -8529,17 +8533,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
        mIgnoreActionUpEvent = true;
    }

    /**
     * This method is only valid during a touch event.
     *
     * @return true when the ACTION_UP event should be ignored, false otherwise.
     *
     * @hide
     */
    public boolean shouldIgnoreActionUpEvent() {
        return mIgnoreActionUpEvent;
    }

    @Override
    public boolean onTrackballEvent(MotionEvent event) {
        if (mMovement != null && mText instanceof Spannable &&
@@ -10145,8 +10138,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener

        boolean willExtract = extractedTextModeWillBeStarted();

        // Do not start the action mode when extracted text will show up full screen, thus
        // immediately hiding the newly created action bar, which would be visually distracting.
        // Do not start the action mode when extracted text will show up full screen, which would
        // immediately hide the newly created action bar and would be visually distracting.
        if (!willExtract) {
            ActionMode.Callback actionModeCallback = new SelectionActionModeCallback();
            mSelectionActionMode = startActionMode(actionModeCallback);