From c90a89d9979829436a6baaf73d21b15d95e86eca Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Wed, 23 Aug 2017 13:19:24 -0700 Subject: Add spring to QSB when opening all apps. Bug: 64355491 Change-Id: I760856a32779b314c8b01ef2c051985e18b68ecb --- .../launcher3/allapps/AllAppsGridAdapter.java | 17 +++++++++++--- .../allapps/AllAppsTransitionController.java | 5 ++++ .../android/launcher3/allapps/SearchUiManager.java | 7 ++++++ .../allapps/search/AppsSearchContainerLayout.java | 13 +++++++++++ .../launcher3/anim/SpringAnimationHandler.java | 27 +++++++++++++++++++--- 5 files changed, 63 insertions(+), 6 deletions(-) diff --git a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java index ba4fbe061..1f60fcc73 100644 --- a/src/com/android/launcher3/allapps/AllAppsGridAdapter.java +++ b/src/com/android/launcher3/allapps/AllAppsGridAdapter.java @@ -448,9 +448,20 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter { mAnimationFactory = factory; } + /** + * Adds a spring to the list of springs handled by this class. + * @param spring The new spring to be added. + * @param setDefaultValues If True, sets the spring to the default + * {@link AnimationFactory} values. + */ + public void add(SpringAnimation spring, boolean setDefaultValues) { + if (setDefaultValues) { + mAnimationFactory.setDefaultValues(spring); + } + spring.setStartVelocity(mCurrentVelocity); + mAnimations.add(spring); + } + /** * Adds a new or recycled animation to the list of springs handled by this class. * @@ -82,15 +96,17 @@ public class SpringAnimationHandler { view.setTag(R.id.spring_animation_tag, spring); } mAnimationFactory.update(spring, object); - spring.setStartVelocity(mCurrentVelocity); - mAnimations.add(spring); + add(spring, false /* setDefaultValues */); } /** * Stops and removes the spring attached to {@param view}. */ public void remove(View view) { - SpringAnimation animation = (SpringAnimation) view.getTag(R.id.spring_animation_tag); + remove((SpringAnimation) view.getTag(R.id.spring_animation_tag)); + } + + public void remove(SpringAnimation animation) { if (animation.canSkipToEnd()) { animation.skipToEnd(); } @@ -226,6 +242,11 @@ public class SpringAnimationHandler { * Updates the value of {@param spring} based on {@param object}. */ void update(SpringAnimation spring, T object); + + /** + * Sets the factory default values for the given {@param spring}. + */ + void setDefaultValues(SpringAnimation spring); } /** -- cgit v1.2.3