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

Commit 470f2a61 authored by Nikita Dubrovsky's avatar Nikita Dubrovsky Committed by Automerger Merge Worker
Browse files

Merge "Fix double-tap detection in TextView's...

Merge "Fix double-tap detection in TextView's SelectionModifierCursorController" into rvc-dev am: 2d4921d1

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11959987

Change-Id: I91a52520004d9e41d582a4ee66c2f34d8785e383
parents 73c87f8b 2d4921d1
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -6354,6 +6354,8 @@ public class Editor {
        // The offsets of that last touch down event. Remembered to start selection there.
        private int mMinTouchOffset, mMaxTouchOffset;

        private boolean mGestureStayedInTapRegion;

        // Where the user first starts the drag motion.
        private int mStartOffset = -1;

@@ -6460,8 +6462,10 @@ public class Editor {
                                eventX, eventY);

                        // Double tap detection
                        if (mTouchState.isMultiTapInSameArea() && (isMouse
                                || mTouchState.isOnHandle() || isPositionOnText(eventX, eventY))) {
                        if (mGestureStayedInTapRegion
                                && mTouchState.isMultiTapInSameArea()
                                && (isMouse || isPositionOnText(eventX, eventY)
                                || mTouchState.isOnHandle())) {
                            if (TextView.DEBUG_CURSOR) {
                                logCursor("SelectionModifierCursorController: onTouchEvent",
                                        "ACTION_DOWN: select and start drag");
@@ -6473,6 +6477,7 @@ public class Editor {
                            }
                            mDiscardNextActionUp = true;
                        }
                        mGestureStayedInTapRegion = true;
                        mHaventMovedEnoughToStartDrag = true;
                    }
                    break;
@@ -6488,6 +6493,14 @@ public class Editor {
                    break;

                case MotionEvent.ACTION_MOVE:
                    if (mGestureStayedInTapRegion) {
                        final ViewConfiguration viewConfig = ViewConfiguration.get(
                                mTextView.getContext());
                        mGestureStayedInTapRegion = EditorTouchState.isDistanceWithin(
                                mTouchState.getLastDownX(), mTouchState.getLastDownY(),
                                eventX, eventY, viewConfig.getScaledDoubleTapTouchSlop());
                    }

                    if (mHaventMovedEnoughToStartDrag) {
                        mHaventMovedEnoughToStartDrag = !mTouchState.isMovedEnoughForDrag();
                    }