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

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

Merge "Force finish any pending animations if the insets or orientation...

Merge "Force finish any pending animations if the insets or orientation change" into ub-launcher3-edmonton
parents 9d1e0f11 ed2d2bcb
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -50,7 +50,6 @@ import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.util.ArraySet;
import android.util.Log;
import android.util.Pair;
import android.view.Surface;
@@ -249,7 +248,7 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag
                    mLauncher.getStateManager()
                            .createAnimationToNewWorkspace(NORMAL, RECENTS_LAUNCH_DURATION);
            controller.dispatchOnStart();
            childStateAnimation = controller.getOriginalTarget();
            childStateAnimation = controller.getTarget();
            launcherAnim = controller.getAnimationPlayer().setDuration(RECENTS_LAUNCH_DURATION);
            windowAnimEndListener = new AnimatorListenerAdapter() {
                @Override
+1 −1
Original line number Diff line number Diff line
@@ -360,7 +360,7 @@ public class Launcher extends BaseDraggingActivity
            dispatchDeviceProfileChanged();

            getRootView().dispatchInsets();
            getStateManager().reapplyState();
            getStateManager().reapplyState(true /* cancelCurrentAnimation */);

            // Recreate touch controllers
            mDragLayer.setup(mDragController);
+4 −4
Original line number Diff line number Diff line
package com.android.launcher3;

import static com.android.launcher3.util.SystemUiController.FLAG_DARK_NAV;
import static com.android.launcher3.util.SystemUiController.UI_STATE_ROOT_VIEW;

import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.content.Context;
@@ -13,9 +16,6 @@ import android.view.ViewDebug;

import com.android.launcher3.util.Themes;

import static com.android.launcher3.util.SystemUiController.FLAG_DARK_NAV;
import static com.android.launcher3.util.SystemUiController.UI_STATE_ROOT_VIEW;

public class LauncherRootView extends InsettableFrameLayout {

    private final Launcher mLauncher;
@@ -82,7 +82,7 @@ public class LauncherRootView extends InsettableFrameLayout {
            }
        }
        if (resetState) {
            mLauncher.getStateManager().reapplyState();
            mLauncher.getStateManager().reapplyState(true /* cancelCurrentAnimation */);
        }

        return true; // I'll take it from here
+7 −0
Original line number Diff line number Diff line
@@ -157,6 +157,13 @@ public class LauncherStateManager {
    }

    public void reapplyState() {
        reapplyState(false);
    }

    public void reapplyState(boolean cancelCurrentAnimation) {
        if (cancelCurrentAnimation) {
            cancelAnimation();
        }
        if (mConfig.mCurrentAnimation == null) {
            for (StateHandler handler : getStateHandlers()) {
                handler.setState(mState);
+15 −17
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ package com.android.launcher3.anim;

import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
@@ -52,45 +53,37 @@ public abstract class AnimatorPlaybackController implements ValueAnimator.Animat
    private final long mDuration;

    protected final AnimatorSet mAnim;
    private AnimatorSet mOriginalTarget;

    protected float mCurrentFraction;
    private Runnable mEndAction;

    protected boolean mTargetCancelled = false;

    protected AnimatorPlaybackController(AnimatorSet anim, long duration) {
        mAnim = anim;
        mOriginalTarget = mAnim;
        mDuration = duration;

        mAnimationPlayer = ValueAnimator.ofFloat(0, 1);
        mAnimationPlayer.setInterpolator(Interpolators.LINEAR);
        mAnimationPlayer.addListener(new OnAnimationEndDispatcher());
        mAnimationPlayer.addUpdateListener(this);
    }

    public AnimatorSet getTarget() {
        return mAnim;
        mAnim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationCancel(Animator animation) {
                mTargetCancelled = true;
            }

    public void setOriginalTarget(AnimatorSet anim) {
        mOriginalTarget = anim;
        });
    }

    public AnimatorSet getOriginalTarget() {
        return mOriginalTarget;
    public AnimatorSet getTarget() {
        return mAnim;
    }

    public long getDuration() {
        return mDuration;
    }

    public AnimatorPlaybackController cloneFor(AnimatorSet anim) {
        AnimatorPlaybackController controller = AnimatorPlaybackController.wrap(anim, mDuration);
        controller.setOriginalTarget(mOriginalTarget);
        controller.setPlayFraction(mCurrentFraction);
        return controller;
    }

    /**
     * Starts playing the animation forward from current position.
     */
@@ -206,6 +199,11 @@ public abstract class AnimatorPlaybackController implements ValueAnimator.Animat
        @Override
        public void setPlayFraction(float fraction) {
            mCurrentFraction = fraction;
            // Let the animator report the progress but don't apply the progress to child
            // animations if it has been cancelled.
            if (mTargetCancelled) {
                return;
            }
            long playPos = clampDuration(fraction);
            for (ValueAnimator anim : mChildAnimations) {
                anim.setCurrentPlayTime(Math.min(playPos, anim.getDuration()));
Loading