Polish for all apps physics.

By adjusting the start value based on the direction of the scroll,
the springs will appear more smooth.

This only changes the appearance of the spring when scrolling down,
since the start value has always been 1 and thus looked fine when
scrolling up.

Bug: 38349031
Change-Id: I563e6e7cfdbc74c4a95adb22f90d5efe17dfa453
This commit is contained in:
Jon Miranda
2017-06-27 07:35:10 -07:00
parent a80b184206
commit 35cb8aefea
4 changed files with 42 additions and 27 deletions

View File

@@ -511,7 +511,9 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
if (FeatureFlags.LAUNCHER3_PHYSICS) {
// We calculate our own velocity to give the springs the desired effect.
velocity = y / getDampedOverScroll(getHeight()) * MAX_RELEASE_VELOCITY;
mSpringAnimationHandler.animateToPositionWithVelocity(0, -velocity);
// We want to negate the velocity because we are moving to 0 from -1 due to the
// downward motion. (y-axis -1 is above 0).
mSpringAnimationHandler.animateToPositionWithVelocity(0, -1, -velocity);
}
ObjectAnimator.ofFloat(AllAppsRecyclerView.this,