Revert "Add spring to shelf for home <-> overview <-> all apps state transitions."

This reverts commit e018711aac.

Reason for revert: investigating crash

Change-Id: I157b61a9f1bd46e2fcd3f2f883d3b5c23ca314af
This commit is contained in:
Jonathan Miranda
2019-01-05 00:04:20 +00:00
parent e018711aac
commit 2bdac8f7e5
8 changed files with 25 additions and 422 deletions

View File

@@ -16,7 +16,6 @@
package com.android.launcher3.anim;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.config.FeatureFlags.QUICKSTEP_SPRINGS;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
@@ -24,16 +23,10 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.util.Log;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import androidx.dynamicanimation.animation.DynamicAnimation;
import androidx.dynamicanimation.animation.SpringAnimation;
/**
* Helper class to control the playback of an {@link AnimatorSet}, with custom interpolators
@@ -44,9 +37,6 @@ import androidx.dynamicanimation.animation.SpringAnimation;
*/
public abstract class AnimatorPlaybackController implements ValueAnimator.AnimatorUpdateListener {
private static final String TAG = "AnimatorPlaybackCtrler";
private static boolean DEBUG = false;
public static AnimatorPlaybackController wrap(AnimatorSet anim, long duration) {
return wrap(anim, duration, null);
}
@@ -70,7 +60,6 @@ public abstract class AnimatorPlaybackController implements ValueAnimator.Animat
private final long mDuration;
protected final AnimatorSet mAnim;
private Set<SpringAnimation> mSprings;
protected float mCurrentFraction;
private Runnable mEndAction;
@@ -78,9 +67,6 @@ public abstract class AnimatorPlaybackController implements ValueAnimator.Animat
protected boolean mTargetCancelled = false;
protected Runnable mOnCancelRunnable;
private OnAnimationEndDispatcher mEndListener;
private DynamicAnimation.OnAnimationEndListener mSpringEndListener;
protected AnimatorPlaybackController(AnimatorSet anim, long duration,
Runnable onCancelRunnable) {
mAnim = anim;
@@ -89,8 +75,7 @@ public abstract class AnimatorPlaybackController implements ValueAnimator.Animat
mAnimationPlayer = ValueAnimator.ofFloat(0, 1);
mAnimationPlayer.setInterpolator(LINEAR);
mEndListener = new OnAnimationEndDispatcher();
mAnimationPlayer.addListener(mEndListener);
mAnimationPlayer.addListener(new OnAnimationEndDispatcher());
mAnimationPlayer.addUpdateListener(this);
mAnim.addListener(new AnimatorListenerAdapter() {
@@ -114,15 +99,6 @@ public abstract class AnimatorPlaybackController implements ValueAnimator.Animat
mTargetCancelled = false;
}
});
mSprings = new HashSet<>();
mSpringEndListener = (animation, canceled, value, velocity1) -> {
if (canceled) {
mEndListener.onAnimationCancel(mAnimationPlayer);
} else {
mEndListener.onAnimationEnd(mAnimationPlayer);
}
};
}
public AnimatorSet getTarget() {
@@ -204,29 +180,6 @@ public abstract class AnimatorPlaybackController implements ValueAnimator.Animat
}
}
/**
* Starts playback and sets the spring.
*/
public void dispatchOnStartWithVelocity(float end, float velocity) {
if (!QUICKSTEP_SPRINGS.get()) {
dispatchOnStart();
return;
}
if (DEBUG) Log.d(TAG, "dispatchOnStartWithVelocity#end=" + end + ", velocity=" + velocity);
for (Animator a : mAnim.getChildAnimations()) {
if (a instanceof SpringObjectAnimator) {
if (DEBUG) Log.d(TAG, "Found springAnimator=" + a);
SpringObjectAnimator springAnimator = (SpringObjectAnimator) a;
mSprings.add(springAnimator.getSpring());
springAnimator.startSpring(end, velocity, mSpringEndListener);
}
}
dispatchOnStart();
}
public void dispatchOnStart() {
dispatchOnStartRecursively(mAnim);
}
@@ -329,18 +282,6 @@ public abstract class AnimatorPlaybackController implements ValueAnimator.Animat
}
}
private boolean isAnySpringRunning() {
for (SpringAnimation spring : mSprings) {
if (spring.isRunning()) {
return true;
}
}
return false;
}
/**
* Only dispatches the on end actions once the animator and all springs have completed running.
*/
private class OnAnimationEndDispatcher extends AnimationSuccessListener {
@Override
@@ -350,12 +291,9 @@ public abstract class AnimatorPlaybackController implements ValueAnimator.Animat
@Override
public void onAnimationSuccess(Animator animator) {
// We wait for the spring (if any) to finish running before completing the end callback.
if (mSprings.isEmpty() || !isAnySpringRunning()) {
dispatchOnEndRecursively(mAnim);
if (mEndAction != null) {
mEndAction.run();
}
dispatchOnEndRecursively(mAnim);
if (mEndAction != null) {
mEndAction.run();
}
}