summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/allapps
diff options
context:
space:
mode:
authorJon Miranda <jonmiranda@google.com>2017-06-27 07:35:10 -0700
committerJon Miranda <jonmiranda@google.com>2017-06-29 08:49:10 -0700
commit35cb8aefea8b66875fc8a5d98a44a289420c4d3c (patch)
treede409de854c22ef3d6ce96a4dd0e81755dcb3de6 /src/com/android/launcher3/allapps
parenta80b18420609e1d9dab27be4d38e0c7263d4c8b0 (diff)
downloadandroid_packages_apps_Trebuchet-35cb8aefea8b66875fc8a5d98a44a289420c4d3c.tar.gz
android_packages_apps_Trebuchet-35cb8aefea8b66875fc8a5d98a44a289420c4d3c.tar.bz2
android_packages_apps_Trebuchet-35cb8aefea8b66875fc8a5d98a44a289420c4d3c.zip
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
Diffstat (limited to 'src/com/android/launcher3/allapps')
-rw-r--r--src/com/android/launcher3/allapps/AllAppsContainerView.java5
-rw-r--r--src/com/android/launcher3/allapps/AllAppsRecyclerView.java4
-rw-r--r--src/com/android/launcher3/allapps/AllAppsTransitionController.java3
3 files changed, 8 insertions, 4 deletions
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index 189b9358f..499eb4588 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -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);
}
}
diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
index a2bd43d84..34421bdac 100644
--- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
@@ -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,
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 4d112c632..0859e0658 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -228,7 +228,8 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
}
mLauncher.showAppsView(true /* animated */, false /* updatePredictedApps */);
if (hasSpringAnimationHandler()) {
- mSpringAnimationHandler.animateToFinalPosition(0);
+ // The icons are moving upwards, so we go to 0 from 1. (y-axis 1 is below 0.)
+ mSpringAnimationHandler.animateToFinalPosition(0 /* pos */, 1 /* startValue */);
}
} else {
calculateDuration(velocity, Math.abs(mShiftRange - mAppsView.getTranslationY()));