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

Commit 0a35e7b8 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Resetting notification roundness when the snapback animation overshoots." into main

parents 9562b1d4 5856a9db
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -133,6 +133,8 @@ public class SwipeHelper implements Gefingerpoken, Dumpable {

    private final ArrayMap<View, Animator> mDismissPendingMap = new ArrayMap<>();

    private float mSnapBackDirection = 0;

    public SwipeHelper(
            Callback callback, Resources resources, ViewConfiguration viewConfiguration,
            FalsingManager falsingManager, FeatureFlags featureFlags) {
@@ -523,17 +525,24 @@ public class SwipeHelper implements Gefingerpoken, Dumpable {
     */
    protected void snapChild(final View animView, final float targetLeft, float velocity) {
        final boolean canBeDismissed = mCallback.canChildBeDismissed(animView);
        mSnapBackDirection = getTranslation(animView) - targetLeft;

        cancelTranslateAnimation(animView);

        PhysicsAnimator<? extends View> anim =
                createSnapBackAnimation(animView, targetLeft, velocity);
        anim.addUpdateListener((target, values) -> {
            onTranslationUpdate(target, getTranslation(target), canBeDismissed);
            float translation = getTranslation(target);
            onTranslationUpdate(target, translation, canBeDismissed);
            if ((mSnapBackDirection > 0 && translation < targetLeft)
                    || (mSnapBackDirection < 0 && translation > targetLeft)) {
                mCallback.onChildSnapBackOvershoots();
                mSnapBackDirection = 0;
            }
        });
        anim.addEndListener((t, p, wasFling, cancelled, finalValue, finalVelocity, allEnded) -> {
            mSnappingChild = false;

            mSnapBackDirection = 0;
            if (!cancelled) {
                updateSwipeProgressFromOffset(animView, canBeDismissed);
                resetViewIfSwiping(animView);
@@ -946,6 +955,11 @@ public class SwipeHelper implements Gefingerpoken, Dumpable {
         */
        void onLongPressSent(View v);

        /**
         * The snap back animation on a view overshoots for the first time.
         */
        void onChildSnapBackOvershoots();

        /**
         * Called when the child is snapped to a position.
         *
+8 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.view.OneShotPreDrawListener;
import com.android.systemui.Dumpable;
import com.android.systemui.ExpandHelper;
import com.android.systemui.Flags;
import com.android.systemui.Gefingerpoken;
import com.android.systemui.classifier.Classifier;
import com.android.systemui.classifier.FalsingCollector;
@@ -620,6 +621,13 @@ public class NotificationStackScrollLayoutController implements Dumpable {
                    mView.onSwipeBegin(v);
                }

                @Override
                public void onChildSnapBackOvershoots() {
                    if (Flags.magneticNotificationSwipes()) {
                        mNotificationRoundnessManager.setViewsAffectedBySwipe(null, null, null);
                    }
                }

                @Override
                public void onChildSnappedBack(View animView, float targetLeft) {
                    mView.onSwipeEnd();