diff options
| author | Romain Guy <romainguy@google.com> | 2010-10-14 10:13:53 -0700 |
|---|---|---|
| committer | Romain Guy <romainguy@google.com> | 2010-10-14 10:13:53 -0700 |
| commit | 83d6e8213230fb0805aa019d266842253baeb114 (patch) | |
| tree | 2d3b230eee1a9645c8f2c93e5e32e3ea906d9b20 /core/java/android/widget/StackView.java | |
| parent | 70ea25fa8ac1f2005ec4e69023e05af4a8d9bd4a (diff) | |
Revert "Remove generics from Animator APIs"
This reverts commit 41f041d9986f8a5d45b6cb0b86e881c81a412168.
Diffstat (limited to 'core/java/android/widget/StackView.java')
| -rw-r--r-- | core/java/android/widget/StackView.java | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/core/java/android/widget/StackView.java b/core/java/android/widget/StackView.java index 7e0150637850..f0954e2dbea5 100644 --- a/core/java/android/widget/StackView.java +++ b/core/java/android/widget/StackView.java @@ -175,8 +175,8 @@ public class StackView extends AdapterViewAnimator { } view.setVisibility(VISIBLE); - ObjectAnimator fadeIn = ObjectAnimator.ofFloat(view, "alpha", view.getAlpha(), 1.0f); - fadeIn.setDuration(DEFAULT_ANIMATION_DURATION); + ObjectAnimator<Float> fadeIn = new ObjectAnimator<Float>(DEFAULT_ANIMATION_DURATION, + view, "alpha", view.getAlpha(), 1.0f); fadeIn.start(); } else if (fromIndex == mNumActiveViews - 1 && toIndex == mNumActiveViews - 2) { // Slide item in @@ -186,11 +186,12 @@ public class StackView extends AdapterViewAnimator { int duration = Math.round(mStackSlider.getDurationForNeutralPosition(mYVelocity)); StackSlider animationSlider = new StackSlider(mStackSlider); - PropertyValuesHolder slideInY = PropertyValuesHolder.ofFloat("YProgress", 0.0f); - PropertyValuesHolder slideInX = PropertyValuesHolder.ofFloat("XProgress", 0.0f); - ObjectAnimator pa = ObjectAnimator.ofPropertyValuesHolder(animationSlider, + PropertyValuesHolder<Float> slideInY = + new PropertyValuesHolder<Float>("YProgress", 0.0f); + PropertyValuesHolder<Float> slideInX = + new PropertyValuesHolder<Float>("XProgress", 0.0f); + ObjectAnimator pa = new ObjectAnimator(duration, animationSlider, slideInX, slideInY); - pa.setDuration(duration); pa.setInterpolator(new LinearInterpolator()); pa.start(); } else if (fromIndex == mNumActiveViews - 2 && toIndex == mNumActiveViews - 1) { @@ -200,11 +201,12 @@ public class StackView extends AdapterViewAnimator { int duration = Math.round(mStackSlider.getDurationForOffscreenPosition(mYVelocity)); StackSlider animationSlider = new StackSlider(mStackSlider); - PropertyValuesHolder slideOutY = PropertyValuesHolder.ofFloat("YProgress", 1.0f); - PropertyValuesHolder slideOutX = PropertyValuesHolder.ofFloat("XProgress", 0.0f); - ObjectAnimator pa = ObjectAnimator.ofPropertyValuesHolder(animationSlider, - slideOutX, slideOutY); - pa.setDuration(duration); + PropertyValuesHolder<Float> slideOutY = + new PropertyValuesHolder<Float>("YProgress", 1.0f); + PropertyValuesHolder<Float> slideOutX = + new PropertyValuesHolder<Float>("XProgress", 0.0f); + ObjectAnimator pa = new ObjectAnimator(duration, animationSlider, + slideOutX, slideOutY); pa.setInterpolator(new LinearInterpolator()); pa.start(); } else if (fromIndex == -1 && toIndex == mNumActiveViews - 1) { @@ -215,8 +217,8 @@ public class StackView extends AdapterViewAnimator { lp.setVerticalOffset(-mSlideAmount); } else if (toIndex == -1) { // Fade item out - ObjectAnimator fadeOut = ObjectAnimator.ofFloat(view, "alpha", view.getAlpha(), 0.0f); - fadeOut.setDuration(DEFAULT_ANIMATION_DURATION); + ObjectAnimator<Float> fadeOut = new ObjectAnimator<Float> + (DEFAULT_ANIMATION_DURATION, view, "alpha", view.getAlpha(), 0.0f); fadeOut.start(); } @@ -234,8 +236,8 @@ public class StackView extends AdapterViewAnimator { float r = (index * 1.0f) / (mNumActiveViews - 2); float scale = 1 - PERSPECTIVE_SCALE_FACTOR * (1 - r); - PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", scale); - PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", scale); + PropertyValuesHolder<Float> scaleX = new PropertyValuesHolder<Float>("scaleX", scale); + PropertyValuesHolder<Float> scaleY = new PropertyValuesHolder<Float>("scaleY", scale); r = (float) Math.pow(r, 2); @@ -245,9 +247,9 @@ public class StackView extends AdapterViewAnimator { (mMeasuredHeight * (1 - PERSPECTIVE_SHIFT_FACTOR) / 2.0f); float transY = perspectiveTranslation + scaleShiftCorrection; - PropertyValuesHolder translationY = PropertyValuesHolder.ofFloat("translationY", transY); - ObjectAnimator pa = ObjectAnimator.ofPropertyValuesHolder(view, scaleX, scaleY, translationY); - pa.setDuration(100); + PropertyValuesHolder<Float> translationY = + new PropertyValuesHolder<Float>("translationY", transY); + ObjectAnimator pa = new ObjectAnimator(100, view, scaleX, scaleY, translationY); pa.start(); } @@ -536,11 +538,12 @@ public class StackView extends AdapterViewAnimator { } StackSlider animationSlider = new StackSlider(mStackSlider); - PropertyValuesHolder snapBackY = PropertyValuesHolder.ofFloat("YProgress", finalYProgress); - PropertyValuesHolder snapBackX = PropertyValuesHolder.ofFloat("XProgress", 0.0f); - ObjectAnimator pa = ObjectAnimator.ofPropertyValuesHolder(animationSlider, + PropertyValuesHolder<Float> snapBackY = + new PropertyValuesHolder<Float>("YProgress", finalYProgress); + PropertyValuesHolder<Float> snapBackX = + new PropertyValuesHolder<Float>("XProgress", 0.0f); + ObjectAnimator pa = new ObjectAnimator(duration, animationSlider, snapBackX, snapBackY); - pa.setDuration(duration); pa.setInterpolator(new LinearInterpolator()); pa.start(); } else if (mSwipeGestureType == GESTURE_SLIDE_DOWN) { @@ -554,12 +557,12 @@ public class StackView extends AdapterViewAnimator { } StackSlider animationSlider = new StackSlider(mStackSlider); - PropertyValuesHolder snapBackY = - PropertyValuesHolder.ofFloat("YProgress",finalYProgress); - PropertyValuesHolder snapBackX = PropertyValuesHolder.ofFloat("XProgress", 0.0f); - ObjectAnimator pa = ObjectAnimator.ofPropertyValuesHolder(animationSlider, + PropertyValuesHolder<Float> snapBackY = + new PropertyValuesHolder<Float>("YProgress", finalYProgress); + PropertyValuesHolder<Float> snapBackX = + new PropertyValuesHolder<Float>("XProgress", 0.0f); + ObjectAnimator pa = new ObjectAnimator(duration, animationSlider, snapBackX, snapBackY); - pa.setDuration(duration); pa.start(); } |
