Enable All Apps spring.
Bug: 147302669 Change-Id: I944ce7d181c554d840329a3affe0dee76eed9143
This commit is contained in:
1 parent
4e7a48f2f5
commit
2e8828bd30
5 files changed
+21
-17
No files matched your search
@@ -29,12 +29,13 @@ import android.os.Looper;
|
||||
import android.util.FloatProperty;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import androidx.dynamicanimation.animation.DynamicAnimation.OnAnimationEndListener;
|
||||
import androidx.dynamicanimation.animation.SpringAnimation;
|
||||
import androidx.dynamicanimation.animation.SpringForce;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
* This animator allows for an object's property to be be controlled by an {@link ObjectAnimator} or
|
||||
* a {@link SpringAnimation}. It extends ValueAnimator so it can be used in an AnimatorSet.
|
||||
@@ -137,11 +138,13 @@ public class SpringObjectAnimator<T> extends ValueAnimator {
|
||||
|
||||
mProperty.switchToSpring();
|
||||
|
||||
mSpring.setStartVelocity(velocity);
|
||||
|
||||
float startValue = end == 0 ? mValues[1] : mValues[0];
|
||||
float endValue = end == 0 ? mValues[0] : mValues[1];
|
||||
mSpring.setStartValue(startValue);
|
||||
|
||||
// Ensures that the velocity matches the direction of the values.
|
||||
velocity = Math.signum(endValue - startValue) * Math.abs(velocity);
|
||||
mSpring.setStartVelocity(velocity);
|
||||
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
mSpring.animateToFinalPosition(endValue);
|
||||
}, getStartDelay());
|
||||
|
||||
Reference in new issue
Block a user