diff options
| author | Chet Haase <chet@google.com> | 2010-10-14 06:59:27 -0700 |
|---|---|---|
| committer | Chet Haase <chet@google.com> | 2010-10-14 13:13:07 -0700 |
| commit | e358b47be5a1c1a775a376925ea063b51ec3a3f9 (patch) | |
| tree | 57193b5498e0451f653364e3ab86b9292893efeb /samples/ApiDemos/src/com/example/android/apis/animation/LayoutAnimations.java | |
| parent | ec8a83055a484d8cc12033808d31864068557136 (diff) | |
Updating code to use new non-generified animator APIs
Change-Id: I3023db9d1f9cb8bf98b788fce4ae2b58b182987d
Diffstat (limited to 'samples/ApiDemos/src/com/example/android/apis/animation/LayoutAnimations.java')
| -rw-r--r-- | samples/ApiDemos/src/com/example/android/apis/animation/LayoutAnimations.java | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/samples/ApiDemos/src/com/example/android/apis/animation/LayoutAnimations.java b/samples/ApiDemos/src/com/example/android/apis/animation/LayoutAnimations.java index 203f2c708..e98a6875d 100644 --- a/samples/ApiDemos/src/com/example/android/apis/animation/LayoutAnimations.java +++ b/samples/ApiDemos/src/com/example/android/apis/animation/LayoutAnimations.java @@ -146,21 +146,21 @@ public class LayoutAnimations extends Activity { private void createCustomAnimations(LayoutTransition transition) { // Changing while Adding - PropertyValuesHolder<Integer> pvhLeft = - new PropertyValuesHolder<Integer>("left", 0, 1); - PropertyValuesHolder<Integer> pvhTop = - new PropertyValuesHolder<Integer>("top", 0, 1); - PropertyValuesHolder<Integer> pvhRight = - new PropertyValuesHolder<Integer>("right", 0, 1); - PropertyValuesHolder<Integer> pvhBottom = - new PropertyValuesHolder<Integer>("bottom", 0, 1); - PropertyValuesHolder<Float> pvhScaleX = - new PropertyValuesHolder<Float>("scaleX", 1f, 0f, 1f); - PropertyValuesHolder<Float> pvhScaleY = - new PropertyValuesHolder<Float>("scaleY", 1f, 0f, 1f); - customChangingAppearingAnim = - new ObjectAnimator(transition.getDuration(LayoutTransition.CHANGE_APPEARING), - this, pvhLeft, pvhTop, pvhRight, pvhBottom, pvhScaleX, pvhScaleY); + PropertyValuesHolder pvhLeft = + PropertyValuesHolder.ofInt("left", 0, 1); + PropertyValuesHolder pvhTop = + PropertyValuesHolder.ofInt("top", 0, 1); + PropertyValuesHolder pvhRight = + PropertyValuesHolder.ofInt("right", 0, 1); + PropertyValuesHolder pvhBottom = + PropertyValuesHolder.ofInt("bottom", 0, 1); + PropertyValuesHolder pvhScaleX = + PropertyValuesHolder.ofFloat("scaleX", 1f, 0f, 1f); + PropertyValuesHolder pvhScaleY = + PropertyValuesHolder.ofFloat("scaleY", 1f, 0f, 1f); + customChangingAppearingAnim = ObjectAnimator.ofPropertyValuesHolder( + this, pvhLeft, pvhTop, pvhRight, pvhBottom, pvhScaleX, pvhScaleY). + setDuration(transition.getDuration(LayoutTransition.CHANGE_APPEARING)); customChangingAppearingAnim.addListener(new AnimatorListenerAdapter() { public void onAnimationEnd(Animator anim) { View view = (View) ((ObjectAnimator) anim).getTarget(); @@ -173,11 +173,11 @@ public class LayoutAnimations extends Activity { Keyframe kf0 = new Keyframe(0f, 0f); Keyframe kf1 = new Keyframe(.9999f, 360f); Keyframe kf2 = new Keyframe(1f, 0f); - PropertyValuesHolder<Keyframe> pvhRotation = - new PropertyValuesHolder<Keyframe>("rotation", kf0, kf1, kf2); - customChangingDisappearingAnim = - new ObjectAnimator(transition.getDuration(LayoutTransition.CHANGE_DISAPPEARING), - this, pvhLeft, pvhTop, pvhRight, pvhBottom, pvhRotation); + PropertyValuesHolder pvhRotation = + PropertyValuesHolder.ofKeyframe("rotation", kf0, kf1, kf2); + customChangingDisappearingAnim = ObjectAnimator.ofPropertyValuesHolder( + this, pvhLeft, pvhTop, pvhRight, pvhBottom, pvhRotation). + setDuration(transition.getDuration(LayoutTransition.CHANGE_DISAPPEARING)); customChangingDisappearingAnim.addListener(new AnimatorListenerAdapter() { public void onAnimationEnd(Animator anim) { View view = (View) ((ObjectAnimator) anim).getTarget(); @@ -186,9 +186,8 @@ public class LayoutAnimations extends Activity { }); // Adding - customAppearingAnim = - new ObjectAnimator<Float>(transition.getDuration(LayoutTransition.APPEARING), - null, "rotationY", 90f, 0f); + customAppearingAnim = ObjectAnimator.ofFloat(null, "rotationY", 90f, 0f). + setDuration(transition.getDuration(LayoutTransition.APPEARING)); customAppearingAnim.addListener(new AnimatorListenerAdapter() { public void onAnimationEnd(Animator anim) { View view = (View) ((ObjectAnimator) anim).getTarget(); @@ -197,9 +196,8 @@ public class LayoutAnimations extends Activity { }); // Removing - customDisappearingAnim = - new ObjectAnimator<Float>(transition.getDuration(LayoutTransition.DISAPPEARING), - null, "rotationX", 0f, 90f); + customDisappearingAnim = ObjectAnimator.ofFloat(null, "rotationX", 0f, 90f). + setDuration(transition.getDuration(LayoutTransition.DISAPPEARING)); customDisappearingAnim.addListener(new AnimatorListenerAdapter() { public void onAnimationEnd(Animator anim) { View view = (View) ((ObjectAnimator) anim).getTarget(); |
