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

Commit 1f2bb9d0 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Updating the quickswitch direction in SEASCAPE

Change-Id: I9b4ff52971a70e2eae0567c2430916b0deaebd32
parent da9cf0f6
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import android.view.ViewConfiguration;
import android.view.WindowManager;

import com.android.launcher3.R;
import com.android.launcher3.graphics.RotationMode;
import com.android.launcher3.util.Preconditions;
import com.android.launcher3.util.RaceConditionTracker;
import com.android.launcher3.util.TraceHelper;
@@ -164,8 +165,10 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
        // Proxy events to recents view
        if (mPassedDragSlop && mInteractionHandler != null
                && !mRecentsViewDispatcher.hasConsumer()) {
            mRecentsViewDispatcher.setConsumer(mInteractionHandler
                    .getRecentsViewDispatcher(isNavBarOnLeft() || isNavBarOnRight()));
            mRecentsViewDispatcher.setConsumer(mInteractionHandler.getRecentsViewDispatcher(
                    isNavBarOnLeft()
                            ? RotationMode.SEASCAPE
                            : (isNavBarOnRight() ? RotationMode.LANDSCAPE : RotationMode.NORMAL)));
        }
        int edgeFlags = ev.getEdgeFlags();
        ev.setEdgeFlags(edgeFlags | EDGE_NAV_BAR);
@@ -402,15 +405,13 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC
    }

    private float getDisplacement(MotionEvent ev) {
        final float displacement;
        if (isNavBarOnRight()) {
            displacement = ev.getX() - mDownPos.x;
            return ev.getX() - mDownPos.x;
        } else if (isNavBarOnLeft()) {
            displacement = mDownPos.x - ev.getX();
            return mDownPos.x - ev.getX();
        } else {
            displacement = ev.getY() - mDownPos.y;
            return ev.getY() - mDownPos.y;
        }
        return displacement;
    }

    @Override
+3 −2
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.graphics.RotationMode;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
@@ -533,8 +534,8 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
        return TaskView.getCurveScaleForInterpolation(interpolation);
    }

    public Consumer<MotionEvent> getRecentsViewDispatcher(boolean isTransposed) {
        return mRecentsView != null ? mRecentsView.getEventDispatcher(isTransposed) : null;
    public Consumer<MotionEvent> getRecentsViewDispatcher(RotationMode rotationMode) {
        return mRecentsView != null ? mRecentsView.getEventDispatcher(rotationMode) : null;
    }

    @UiThread
+4 −3
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.PropertyListBuilder;
import com.android.launcher3.anim.SpringObjectAnimator;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.graphics.RotationMode;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
@@ -1641,10 +1642,10 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
        return mClearAllButton;
    }

    public Consumer<MotionEvent> getEventDispatcher(boolean isTransposed) {
        if (isTransposed) {
    public Consumer<MotionEvent> getEventDispatcher(RotationMode rotationMode) {
        if (rotationMode.isTransposed) {
            Matrix transform = new Matrix();
            transform.setRotate(90);
            transform.setRotate(-rotationMode.surfaceRotation);

            if (getWidth() > 0 && getHeight() > 0) {
                float scale = ((float) getWidth()) / getHeight();