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

Commit d060b3a0 authored by Jean Chen's avatar Jean Chen Committed by Android (Google) Code Review
Browse files

Merge "Fix the issue of fullscreen and window Magnification using different...

Merge "Fix the issue of fullscreen and window Magnification using different multi-tap delay times" into main
parents 04a013d4 6045107e
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -43,12 +43,18 @@ public class MultiTap extends GestureMatcher {

    public MultiTap(Context context, int taps, int gesture,
            GestureMatcher.StateChangeListener listener) {
        this(context, taps, gesture,
                ViewConfiguration.getDoubleTapTimeout(), listener);
    }

    public MultiTap(Context context, int taps, int gesture, int multiTapTimeout,
            GestureMatcher.StateChangeListener listener) {
        super(gesture, new Handler(context.getMainLooper()), listener);
        mTargetTaps = taps;
        mDoubleTapTimeout = multiTapTimeout;
        mDoubleTapSlop = ViewConfiguration.get(context).getScaledDoubleTapSlop();
        mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
        mTapTimeout = ViewConfiguration.getTapTimeout();
        mDoubleTapTimeout = ViewConfiguration.getDoubleTapTimeout();
        clear();
    }

+5 −0
Original line number Diff line number Diff line
@@ -30,6 +30,11 @@ public class MultiTapAndHold extends MultiTap {
        super(context, taps, gesture, listener);
    }

    public MultiTapAndHold(Context context, int taps, int gesture, int multiTapTimeout,
            GestureMatcher.StateChangeListener listener) {
        super(context, taps, gesture, multiTapTimeout, listener);
    }

    @Override
    protected void onDown(MotionEvent event, MotionEvent rawEvent, int policyFlags) {
        super.onDown(event, rawEvent, policyFlags);
+2 −3
Original line number Diff line number Diff line
@@ -1168,9 +1168,8 @@ public class FullScreenMagnificationGestureHandler extends MagnificationGestureH

        DetectingState(Context context) {
            mLongTapMinDelay = ViewConfiguration.getLongPressTimeout();
            mMultiTapMaxDelay = ViewConfiguration.getDoubleTapTimeout()
                    + context.getResources().getInteger(
                    R.integer.config_screen_magnification_multi_tap_adjustment);
            mMultiTapMaxDelay =
                    MagnificationGestureMatcher.getMagnificationMultiTapTimeout(context);
            mSwipeMinDistance = ViewConfiguration.get(context).getScaledTouchSlop();
            mMultiTapMaxDistance = ViewConfiguration.get(context).getScaledDoubleTapSlop();
        }
+8 −2
Original line number Diff line number Diff line
@@ -470,12 +470,14 @@ public class WindowMagnificationGestureHandler extends MagnificationGestureHandl
                        mDetectSingleFingerTripleTap
                                ? MagnificationGestureMatcher.GESTURE_TRIPLE_TAP
                                : MagnificationGestureMatcher.GESTURE_SINGLE_TAP,
                        MagnificationGestureMatcher.getMagnificationMultiTapTimeout(mContext),
                        null));
                mGestureMatchers.add(new MultiTapAndHold(context,
                        mDetectSingleFingerTripleTap ? 3 : 1,
                        mDetectSingleFingerTripleTap
                                ? MagnificationGestureMatcher.GESTURE_TRIPLE_TAP_AND_HOLD
                                : MagnificationGestureMatcher.GESTURE_SINGLE_TAP_AND_HOLD,
                        MagnificationGestureMatcher.getMagnificationMultiTapTimeout(mContext),
                        null));
                mGestureMatchers.add(new TwoFingersDownOrSwipe(context));

@@ -495,12 +497,16 @@ public class WindowMagnificationGestureHandler extends MagnificationGestureHandl
                        mDetectSingleFingerTripleTap ? 3 : 1,
                        mDetectSingleFingerTripleTap
                                ? MagnificationGestureMatcher.GESTURE_TRIPLE_TAP
                                : MagnificationGestureMatcher.GESTURE_SINGLE_TAP, null);
                                : MagnificationGestureMatcher.GESTURE_SINGLE_TAP,
                        MagnificationGestureMatcher.getMagnificationMultiTapTimeout(mContext),
                        null);
                final MultiTapAndHold multiTapAndHold = new MultiTapAndHold(context,
                        mDetectSingleFingerTripleTap ? 3 : 1,
                        mDetectSingleFingerTripleTap
                                ? MagnificationGestureMatcher.GESTURE_TRIPLE_TAP_AND_HOLD
                                : MagnificationGestureMatcher.GESTURE_SINGLE_TAP_AND_HOLD, null);
                                : MagnificationGestureMatcher.GESTURE_SINGLE_TAP_AND_HOLD,
                        MagnificationGestureMatcher.getMagnificationMultiTapTimeout(mContext),
                        null);
                mGesturesObserver = new MagnificationGesturesObserver(this,
                        new SimpleSwipe(context),
                        multiTap,
+4 −2
Original line number Diff line number Diff line
@@ -341,7 +341,8 @@ public class WindowMagnificationGestureHandlerTest {
                    twoFingerTap();
                    twoFingerTap();
                    // Wait for two-finger tap gesture completed.
                    SystemClock.sleep(ViewConfiguration.getDoubleTapMinTime() + 500);
                    SystemClock.sleep(MagnificationGestureMatcher
                            .getMagnificationMultiTapTimeout(mContext) + 100);
                    InstrumentationRegistry.getInstrumentation().waitForIdleSync();
                }
                break;
@@ -403,7 +404,8 @@ public class WindowMagnificationGestureHandlerTest {
                twoFingerTap();
                twoFingerTap();
                // Wait for two-finger tap gesture completed.
                SystemClock.sleep(ViewConfiguration.getDoubleTapMinTime() + 500);
                SystemClock.sleep(MagnificationGestureMatcher
                        .getMagnificationMultiTapTimeout(mContext) + 100);
                InstrumentationRegistry.getInstrumentation().waitForIdleSync();
            }
            break;