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

Commit 452fa752 authored by Clara Bayarri's avatar Clara Bayarri
Browse files

Editor: Make the Insertion handle start/finish the selection action mode on tap.

The Insertion handle used to show/hide the paste popup, not that we are
unifying it with the selection action mode it should start/finish the mode.

There are no other use cases of the popup with the insertion handle, so that
code is cleaned up.

Change-Id: I40703bc8316f217edaf97aff72436935de60500c
parent 07459a36
Loading
Loading
Loading
Loading
+6 −15
Original line number Diff line number Diff line
@@ -3697,7 +3697,7 @@ public class Editor {
        private static final int DELAY_BEFORE_HANDLE_FADES_OUT = 4000;
        private static final int RECENT_CUT_COPY_DURATION = 15 * 1000; // seconds

        // Used to detect taps on the insertion handle, which will affect the ActionPopupWindow
        // Used to detect taps on the insertion handle, which will affect the selection action mode
        private float mDownPositionX, mDownPositionY;
        private Runnable mHider;

@@ -3712,17 +3712,12 @@ public class Editor {
            final long durationSinceCutOrCopy =
                    SystemClock.uptimeMillis() - TextView.LAST_CUT_OR_COPY_TIME;
            if (durationSinceCutOrCopy < RECENT_CUT_COPY_DURATION) {
                showActionPopupWindow(0);
                startSelectionActionModeWithoutSelection();
            }

            hideAfterDelay();
        }

        public void showWithActionPopup() {
            show();
            showActionPopupWindow(0);
        }

        private void hideAfterDelay() {
            if (mHider == null) {
                mHider = new Runnable() {
@@ -3784,11 +3779,11 @@ public class Editor {
                        final int touchSlop = viewConfiguration.getScaledTouchSlop();

                        if (distanceSquared < touchSlop * touchSlop) {
                            if (mActionPopupWindow != null && mActionPopupWindow.isShowing()) {
                                // Tapping on the handle dismisses the displayed action popup
                                mActionPopupWindow.hide();
                            // Tapping on the handle toggles the selection action mode.
                            if (mSelectionActionMode != null) {
                                mSelectionActionMode.finish();
                            } else {
                                showWithActionPopup();
                                startSelectionActionModeWithoutSelection();
                            }
                        }
                    }
@@ -4073,10 +4068,6 @@ public class Editor {
            getHandle().show();
        }

        public void showWithActionPopup() {
            getHandle().showWithActionPopup();
        }

        public void hide() {
            if (mHandle != null) {
                mHandle.hide();