summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/anim/SpringAnimationHandler.java
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-09-20 07:45:27 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-09-20 07:45:27 +0000
commit1b60530b9272671b6bddda223aea9dfd95f5d469 (patch)
treeb755c5b64eb096681181d4ddb36c313988309141 /src/com/android/launcher3/anim/SpringAnimationHandler.java
parentf78db7fa5c485433b362b68a497a80cd728faf19 (diff)
parentfb46415e803a7f20a7d48bf42106f3f40cd769dd (diff)
downloadandroid_packages_apps_Trebuchet-1b60530b9272671b6bddda223aea9dfd95f5d469.tar.gz
android_packages_apps_Trebuchet-1b60530b9272671b6bddda223aea9dfd95f5d469.tar.bz2
android_packages_apps_Trebuchet-1b60530b9272671b6bddda223aea9dfd95f5d469.zip
release-request-42a2a3ad-8c90-4c84-a0ad-5d067beb8e30-for-git_oc-mr1-release-4349323 snap-temp-L16100000104414353
Change-Id: I98e6266bf9b4b187c6ad6f24d06b1f02e8beef97
Diffstat (limited to 'src/com/android/launcher3/anim/SpringAnimationHandler.java')
-rw-r--r--src/com/android/launcher3/anim/SpringAnimationHandler.java27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/com/android/launcher3/anim/SpringAnimationHandler.java b/src/com/android/launcher3/anim/SpringAnimationHandler.java
index 3e58adc3f..eec3a48ee 100644
--- a/src/com/android/launcher3/anim/SpringAnimationHandler.java
+++ b/src/com/android/launcher3/anim/SpringAnimationHandler.java
@@ -70,6 +70,20 @@ public class SpringAnimationHandler<T> {
}
/**
+ * 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.
*
* @param view The view the spring is attached to.
@@ -82,15 +96,17 @@ public class SpringAnimationHandler<T> {
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<T> {
* 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);
}
/**