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

Commit f0c54864 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android (Google) Code Review
Browse files

Merge "Cancel fling animation when starting to drag" into nyc-dev

parents b055c1b5 0c790411
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;