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

Commit 272e9abe authored by Jeremy Sim's avatar Jeremy Sim
Browse files

Fix janky movement when resizing split windows

This CL adds parallax movement to split windows when flingDividerPosition() is called at the end of a user movement.

We use a parallax effect when the user is dragging the divider around, but when the user releases touch on the divider, we animate it to the nearest snap point. Previously, this animation did not apply the same parallax effect, so the task contents appeared to jump around.

When the user is not controlling the movement, e.g. with split-to-side, we shouldn't use the parallax effect.

Fixes: 344708229
Test: Manually verified. User resize and auto-resize (split to side) both look good.
Flag: EXEMPT bugfix
Change-Id: Id6bf0acf6cfd50c8eee9fa95c926e49b7ef931fe
parent 2f24c237
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -492,6 +492,11 @@ public class DividerView extends FrameLayout implements View.OnTouchListener {
        return mHideHandle;
    }

    /** Returns true if the divider is currently being physically controlled by the user. */
    boolean isMoving() {
        return mMoving;
    }

    private class DoubleTapListener extends GestureDetector.SimpleOnGestureListener {
        @Override
        public boolean onDoubleTap(MotionEvent e) {
+10 −1
Original line number Diff line number Diff line
@@ -651,9 +651,18 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
                .ofInt(from, to)
                .setDuration(duration);
        mDividerFlingAnimator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);

        // If the divider is being physically controlled by the user, we use a cool parallax effect
        // on the task windows. So if this "snap" animation is an extension of a user-controlled
        // movement, we pass in true here to continue the parallax effect smoothly.
        boolean isBeingMovedByUser = mSplitWindowManager.getDividerView() != null
                && mSplitWindowManager.getDividerView().isMoving();

        mDividerFlingAnimator.addUpdateListener(
                animation -> updateDividerBounds(
                        (int) animation.getAnimatedValue(), false /* shouldUseParallaxEffect */)
                        (int) animation.getAnimatedValue(),
                        isBeingMovedByUser /* shouldUseParallaxEffect */
                )
        );
        mDividerFlingAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
+1 −2
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ import android.view.LayoutInflater;
import android.view.SurfaceControl;
import android.view.SurfaceControlViewHost;
import android.view.SurfaceSession;
import android.view.View;
import android.view.WindowManager;
import android.view.WindowlessWindowManager;

@@ -192,7 +191,7 @@ public final class SplitWindowManager extends WindowlessWindowManager {
        mDividerView.setInteractive(interactive, hideHandle, from);
    }

    View getDividerView() {
    DividerView getDividerView() {
        return mDividerView;
    }

+1 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ public class DividerViewTest extends ShellTestCase {
                mContext,
                configuration, mCallbacks);
        splitWindowManager.init(mSplitLayout, new InsetsState(), false /* isRestoring */);
        mDividerView = spy((DividerView) splitWindowManager.getDividerView());
        mDividerView = spy(splitWindowManager.getDividerView());
    }

    @Test