summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2010-11-12 14:50:33 -0800
committerAdam Cohen <adamcohen@google.com>2010-11-15 11:18:33 -0800
commitcbbaf9862aa160c5e397cb49b554de20981a35fe (patch)
treef7052993fffee7b16d94018c433de3800ff465be /src
parent1a3eee779557e11b7eadbeda3677a8f433e3a687 (diff)
downloadandroid_packages_apps_Trebuchet-cbbaf9862aa160c5e397cb49b554de20981a35fe.tar.gz
android_packages_apps_Trebuchet-cbbaf9862aa160c5e397cb49b554de20981a35fe.tar.bz2
android_packages_apps_Trebuchet-cbbaf9862aa160c5e397cb49b554de20981a35fe.zip
Tweaking transitions between AllApps / Customize and Home
Change-Id: Iaf1c235fd6122d871a6e038ab83b8deb5435b018
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/Workspace.java55
1 files changed, 40 insertions, 15 deletions
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index eac9ebd28..61b7c4b5b 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -848,17 +848,21 @@ public class Workspace extends SmoothPagedView
if (animated) {
final int duration = res.getInteger(R.integer.config_workspaceShrinkTime);
ObjectAnimator anim = ObjectAnimator.ofPropertyValuesHolder(cl,
+ PropertyValuesHolder.ofFloat("backgroundAlpha", finalAlpha),
+ PropertyValuesHolder.ofFloat("alpha", finalAlpha),
+ PropertyValuesHolder.ofFloat("rotationY", rotation));
+ anim.setDuration(duration);
+
+ ObjectAnimator animWithInterpolator = ObjectAnimator.ofPropertyValuesHolder(cl,
PropertyValuesHolder.ofFloat("x", newX),
PropertyValuesHolder.ofFloat("y", newY),
PropertyValuesHolder.ofFloat("scaleX",
SHRINK_FACTOR * rotationScaleX * extraShrinkFactor),
PropertyValuesHolder.ofFloat("scaleY",
- SHRINK_FACTOR * rotationScaleY * extraShrinkFactor),
- PropertyValuesHolder.ofFloat("backgroundAlpha", finalAlpha),
- PropertyValuesHolder.ofFloat("alpha", finalAlpha),
- PropertyValuesHolder.ofFloat("rotationY", rotation));
- anim.setDuration(duration);
- mAnimator.playTogether(anim);
+ SHRINK_FACTOR * rotationScaleY * extraShrinkFactor));
+ animWithInterpolator.setDuration(duration);
+ animWithInterpolator.setInterpolator(mZInterpolator);
+ mAnimator.playTogether(anim, animWithInterpolator);
} else {
cl.setX((int)newX);
cl.setY((int)newY);
@@ -877,12 +881,27 @@ public class Workspace extends SmoothPagedView
setChildrenDrawnWithCacheEnabled(true);
}
+ private class ZInterpolator implements TimeInterpolator {
+ private final float focalLength = 0.2f;
+ public float getInterpolation(float input) {
+ return (1.0f - focalLength / (focalLength + input)) /
+ (1.0f - focalLength / (focalLength + 1.0f));
+ }
+ }
+
+ private class InverseZInterpolator implements TimeInterpolator {
+ public float getInterpolation(float input) {
+ return 1 - mZInterpolator.getInterpolation(1 - input);
+ }
+ }
+
+ private final ZInterpolator mZInterpolator = new ZInterpolator();
+ private final InverseZInterpolator mInverseZInterpolator = new InverseZInterpolator();
private void updateWhichPagesAcceptDrops(ShrinkPosition state) {
updateWhichPagesAcceptDropsHelper(state, false, 1, 1);
}
-
private void updateWhichPagesAcceptDropsDuringDrag(ShrinkPosition state, int spanX, int spanY) {
updateWhichPagesAcceptDropsHelper(state, true, spanX, spanY);
}
@@ -1007,14 +1026,20 @@ public class Workspace extends SmoothPagedView
}
if (animated) {
- mAnimator.playTogether(
- ObjectAnimator.ofFloat(cl, "translationX", 0.0f).setDuration(duration),
- ObjectAnimator.ofFloat(cl, "translationY", 0.0f).setDuration(duration),
- ObjectAnimator.ofFloat(cl, "scaleX", 1.0f).setDuration(duration),
- ObjectAnimator.ofFloat(cl, "scaleY", 1.0f).setDuration(duration),
- ObjectAnimator.ofFloat(cl, "backgroundAlpha", 0.0f).setDuration(duration),
- ObjectAnimator.ofFloat(cl, "alpha", finalAlphaValue).setDuration(duration),
- ObjectAnimator.ofFloat(cl, "rotationY", rotation).setDuration(duration));
+ ObjectAnimator anim = ObjectAnimator.ofPropertyValuesHolder(cl,
+ PropertyValuesHolder.ofFloat("backgroundAlpha", 0.0f),
+ PropertyValuesHolder.ofFloat("alpha", finalAlphaValue),
+ PropertyValuesHolder.ofFloat("rotationY", rotation));
+ anim.setDuration(duration);
+
+ ObjectAnimator animWithInterpolator = ObjectAnimator.ofPropertyValuesHolder(cl,
+ PropertyValuesHolder.ofFloat("translationX", 0.0f),
+ PropertyValuesHolder.ofFloat("translationY", 0.0f),
+ PropertyValuesHolder.ofFloat("scaleX", 1.0f),
+ PropertyValuesHolder.ofFloat("scaleY", 1.0f));
+ animWithInterpolator.setDuration(duration);
+ animWithInterpolator.setInterpolator(mInverseZInterpolator);
+ mAnimator.playTogether(anim, animWithInterpolator);
} else {
cl.setTranslationX(0.0f);
cl.setTranslationY(0.0f);