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

Commit a9bcd825 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Enabling springs for start dismiss animation" into ub-launcher3-master

parents e6df7da2 cfaa4889
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -171,7 +171,8 @@ public class NavBarToHomeTouchController implements TouchController,
            }
        }
        anim.setDuration(accuracy);
        mCurrentAnimation = AnimatorPlaybackController.wrap(anim, accuracy, this::clearState);
        mCurrentAnimation = AnimatorPlaybackController.wrap(anim, accuracy)
                .setOnCancelRunnable(this::clearState);
    }

    private void clearState() {
+3 −4
Original line number Diff line number Diff line
@@ -393,7 +393,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
        xOverviewAnim.setFloatValues(startXProgress, endXProgress);
        xOverviewAnim.setDuration(xDuration)
                .setInterpolator(scrollInterpolatorForVelocity(velocity.x));
        mXOverviewAnim.dispatchOnStartWithVelocity(endXProgress, velocity.x);
        mXOverviewAnim.dispatchOnStart();

        boolean flingUpToNormal = verticalFling && velocity.y < 0 && targetState == NORMAL;

@@ -414,7 +414,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
        ValueAnimator yOverviewAnim = mYOverviewAnim.getAnimationPlayer();
        yOverviewAnim.setFloatValues(startYProgress, endYProgress);
        yOverviewAnim.setDuration(yDuration);
        mYOverviewAnim.dispatchOnStartWithVelocity(endYProgress, velocity.y);
        mYOverviewAnim.dispatchOnStart();

        ValueAnimator nonOverviewAnim = mNonOverviewAnim.getAnimationPlayer();
        if (flingUpToNormal && !mIsHomeScreenVisible) {
@@ -436,8 +436,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
            float startProgress = mNonOverviewAnim.getProgressFraction();
            float endProgress = canceled ? 0 : 1;
            nonOverviewAnim.setFloatValues(startProgress, endProgress);
            mNonOverviewAnim.dispatchOnStartWithVelocity(endProgress,
                    horizontalFling ? velocity.x : velocity.y);
            mNonOverviewAnim.dispatchOnStart();
        }

        nonOverviewAnim.setDuration(Math.max(xDuration, yDuration));
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ import android.view.MotionEvent;
import android.view.animation.Interpolator;

import com.android.launcher3.Launcher;
import com.android.launcher3.util.PendingAnimation;
import com.android.launcher3.anim.PendingAnimation;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;

+6 −20
Original line number Diff line number Diff line
@@ -16,17 +16,13 @@
package com.android.launcher3.uioverrides.touchcontrollers;

import static com.android.launcher3.AbstractFloatingView.TYPE_ACCESSIBLE;
import static com.android.launcher3.anim.Interpolators.scrollInterpolatorForVelocity;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.launcher3.config.FeatureFlags.UNSTABLE_SPRINGS;
import static com.android.launcher3.touch.SingleAxisSwipeDetector.DIRECTION_BOTH;
import static com.android.launcher3.touch.SingleAxisSwipeDetector.DIRECTION_NEGATIVE;
import static com.android.launcher3.touch.SingleAxisSwipeDetector.DIRECTION_POSITIVE;
import static com.android.launcher3.util.DefaultDisplay.getSingleFrameMs;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.view.MotionEvent;

import com.android.launcher3.AbstractFloatingView;
@@ -35,12 +31,12 @@ import com.android.launcher3.LauncherAnimUtils;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.touch.BaseSwipeDetector;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.touch.SingleAxisSwipeDetector;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.util.FlingBlockCheck;
import com.android.launcher3.util.PendingAnimation;
import com.android.launcher3.util.TouchController;
import com.android.launcher3.views.BaseDragLayer;
import com.android.quickstep.SysUINavigationMode;
@@ -218,8 +214,8 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity>
        if (mCurrentAnimation != null) {
            mCurrentAnimation.setOnCancelRunnable(null);
        }
        mCurrentAnimation = AnimatorPlaybackController.wrap(
                mPendingAnimation.anim, maxDuration, this::clearState);
        mCurrentAnimation = AnimatorPlaybackController.wrap(mPendingAnimation, maxDuration)
                .setOnCancelRunnable(this::clearState);
        onUserControlledAnimationCreated(mCurrentAnimation);
        mCurrentAnimation.getTarget().addListener(this);
        mCurrentAnimation.dispatchOnStart();
@@ -288,26 +284,16 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity>
            animationDuration *= LauncherAnimUtils.blockedFlingDurationFactor(velocity);
        }

        float nextFrameProgress = Utilities.boundToRange(progress
                + velocity * getSingleFrameMs(mActivity) / Math.abs(mEndDisplacement), 0f, 1f);

        mCurrentAnimation.setEndAction(() -> onCurrentAnimationEnd(goingToEnd, logAction));

        ValueAnimator anim = mCurrentAnimation.getAnimationPlayer();
        anim.setFloatValues(nextFrameProgress, goingToEnd ? 1f : 0f);
        anim.setDuration(animationDuration);
        anim.setInterpolator(scrollInterpolatorForVelocity(velocity));
        if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
            anim.addUpdateListener(valueAnimator -> {
            mCurrentAnimation.getAnimationPlayer().addUpdateListener(valueAnimator -> {
                if (mRecentsView.getCurrentPage() != 0 || mCurrentAnimationIsGoingUp) {
                    mRecentsView.redrawLiveTile(true);
                }
            });
        }
        if (UNSTABLE_SPRINGS.get()) {
            mCurrentAnimation.dispatchOnStartWithVelocity(goingToEnd ? 1f : 0f, velocity);
        }
        anim.start();
        mCurrentAnimation.startWithVelocity(mActivity, goingToEnd,
                velocity, mEndDisplacement, animationDuration);
    }

    private void onCurrentAnimationEnd(boolean wasSuccess, int logAction) {
+1 −1
Original line number Diff line number Diff line
@@ -1000,7 +1000,7 @@ public class LauncherSwipeHandler<T extends BaseDraggingActivity>
        mLauncherTransitionController.getAnimationPlayer().setDuration(Math.max(0, duration));

        if (UNSTABLE_SPRINGS.get()) {
            mLauncherTransitionController.dispatchOnStartWithVelocity(end, velocityPxPerMs.y);
            mLauncherTransitionController.dispatchOnStart();
        }
        mLauncherTransitionController.getAnimationPlayer().start();
        mHasLauncherTransitionControllerStarted = true;
Loading