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

Commit f5c7cbad authored by Gilles Debunne's avatar Gilles Debunne Committed by Android Git Automerger
Browse files

am 4df103cf: Merge "A long press on the selection handle no longer selects the...

am 4df103cf: Merge "A long press on the selection handle no longer selects the word." into honeycomb

* commit '4df103cf':
  A long press on the selection handle no longer selects the word.
parents 14952971 4df103cf
Loading
Loading
Loading
Loading
+35 −73
Original line number Diff line number Diff line
@@ -8596,7 +8596,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
        private long mTouchTimer;
        private boolean mIsInsertionHandle = false;
        private PastePopupMenu mPastePopupWindow;
        private Runnable mLongPressCallback;

        // Touch-up filter: number of previous positions remembered
        private static final int HISTORY_SIZE = 5;
@@ -8850,18 +8849,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                    mLastParentX = coords[0];
                    mLastParentY = coords[1];
                    mIsDragging = true;
                if (mIsInsertionHandle) {
                    mTouchTimer = SystemClock.uptimeMillis();
                    if (mLongPressCallback == null) {
                        mLongPressCallback = new Runnable() {
                            public void run() {
                                mController.hide();
                                startSelectionActionMode();
                            }
                        };
                    }
                    postDelayed(mLongPressCallback, ViewConfiguration.getLongPressTimeout());
                }
                    break;
                }

@@ -8872,21 +8859,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                    final float newPosY = rawY - mTouchToWindowOffsetY + mHotspotY + mTouchOffsetY;

                    mController.updatePosition(this, Math.round(newPosX), Math.round(newPosY));

                if (mIsInsertionHandle) {
                    final float dx = rawX - mDownPositionX;
                    final float dy = rawY - mDownPositionY;
                    final float distanceSquared = dx * dx + dy * dy;
                    if (distanceSquared >= mSquaredTouchSlopDistance) {
                        removeLongPressCallback();
                    }
                }
                    break;
                }

                case MotionEvent.ACTION_UP:
                    if (mIsInsertionHandle) {
                    removeLongPressCallback();
                        long delay = SystemClock.uptimeMillis() - mTouchTimer;
                        if (delay < ViewConfiguration.getTapTimeout()) {
                            if (mPastePopupWindow != null && mPastePopupWindow.isShowing()) {
@@ -8902,10 +8879,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                    break;

                case MotionEvent.ACTION_CANCEL:
                if (mIsInsertionHandle) {
                    removeLongPressCallback();
                }
                    mIsDragging = false;
                    break;
            }
            return true;
        }
@@ -8943,16 +8918,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                mPastePopupWindow.show();
            }
        }

        private void removeLongPressCallback() {
            if (mLongPressCallback != null) {
                removeCallbacks(mLongPressCallback);
            }
        }

        void onDetached() {
            removeLongPressCallback();
        }
    }

    private class InsertionPointCursorController implements CursorController {
@@ -9079,9 +9044,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
        public void onDetached() {
            removeHiderCallback();
            removePastePopupCallback();
            if (mHandle != null) {
                mHandle.onDetached();
            }
        }
    }