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

Commit 0c790411 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Cancel fling animation when starting to drag

Makes sure we don't end up in a weird state because
at the end of the fling animation, mDockSide gets
reset.

Bug: 27269044
Change-Id: I779b8ee9be9a35553c7f822421d1f02ca802111c
parent 9d3a4e1c
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@ import android.view.ViewTreeObserver.InternalInsetsInfo;
import android.view.ViewTreeObserver.OnComputeInternalInsetsListener;
import android.view.WindowInsets;
import android.view.WindowManager;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.view.animation.PathInterpolator;
import android.widget.FrameLayout;
@@ -131,6 +130,7 @@ public class DividerView extends FrameLayout implements OnTouchListener,
    private boolean mAnimateAfterRecentsDrawn;
    private boolean mGrowAfterRecentsDrawn;
    private boolean mGrowRecents;
    private Animator mCurrentAnimator;

    public DividerView(Context context) {
        super(context);
@@ -210,6 +210,7 @@ public class DividerView extends FrameLayout implements OnTouchListener,
    }

    public boolean startDragging(boolean animate, boolean touching) {
        cancelFlingAnimation();
        if (touching) {
            mHandle.setTouching(true, animate);
        }
@@ -369,11 +370,19 @@ public class DividerView extends FrameLayout implements OnTouchListener,
                commitSnapFlags(snapTarget);
                mWindowManagerProxy.setResizing(false);
                mDockSide = WindowManager.DOCKED_INVALID;
                mCurrentAnimator = null;
            }
        });
        mCurrentAnimator = anim;
        return anim;
    }

    private void cancelFlingAnimation() {
        if (mCurrentAnimator != null) {
            mCurrentAnimator.cancel();
        }
    }

    private void commitSnapFlags(SnapTarget target) {
        if (target.flag == SnapTarget.FLAG_NONE) {
            return;