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

@@ -423,8 +423,9 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
// We only show the spring animation when at the top or bottom, so we wait until the
// first or last row is visible to ensure that all animations run in sync.
if ((first == 0 && dy < 0) || (last == mAdapter.getItemCount() - 1 && dy > 0)) {
mSpringAnimationHandler.animateToFinalPosition(0);
boolean scrollUp = dy < 0;
if ((first == 0 && scrollUp) || (last == mAdapter.getItemCount() - 1 && dy > 0)) {
mSpringAnimationHandler.animateToFinalPosition(0, scrollUp ? 1 : -1);
}
}