diff options
author | Chet Haase <chet@google.com> | 2010-10-12 16:29:28 -0700 |
---|---|---|
committer | Chet Haase <chet@google.com> | 2010-10-14 13:13:34 -0700 |
commit | 2794eb3b02e2404d453d3ad22a8a85a138130a07 (patch) | |
tree | 91fa1c08761921ce2976696234011c8d7f609161 /core/java/android/widget/AdapterViewAnimator.java | |
parent | bf5b247fa120b3f8ee0331d00be25b1cf74dd3f3 (diff) | |
download | frameworks_base-2794eb3b02e2404d453d3ad22a8a85a138130a07.zip frameworks_base-2794eb3b02e2404d453d3ad22a8a85a138130a07.tar.gz frameworks_base-2794eb3b02e2404d453d3ad22a8a85a138130a07.tar.bz2 |
Remove generics from Animator APIs
Change the manner of constructing Animator-related objects from constructors
via generics to factory methods with type-specific method names. Should
improve the proliferation of warnings due to generics issues and make the
code more readable (less irrelevant angle brackets Floating around).
Change-Id: Ib59a7dd72a95d438022e409ddeac48853082b943
Diffstat (limited to 'core/java/android/widget/AdapterViewAnimator.java')
-rw-r--r-- | core/java/android/widget/AdapterViewAnimator.java | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/core/java/android/widget/AdapterViewAnimator.java b/core/java/android/widget/AdapterViewAnimator.java index b7b1a23..b5934b0 100644 --- a/core/java/android/widget/AdapterViewAnimator.java +++ b/core/java/android/widget/AdapterViewAnimator.java @@ -138,8 +138,8 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter> /** * In and out animations. */ - ObjectAnimator<?> mInAnimation; - ObjectAnimator<?> mOutAnimation; + ObjectAnimator mInAnimation; + ObjectAnimator mOutAnimation; private ArrayList<View> mViewsToBringToFront; @@ -246,12 +246,16 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter> } } - ObjectAnimator<?> getDefaultInAnimation() { - return new ObjectAnimator<Float>(DEFAULT_ANIMATION_DURATION, null, "alpha", 0.0f, 1.0f); + ObjectAnimator getDefaultInAnimation() { + ObjectAnimator anim = ObjectAnimator.ofFloat(null, "alpha", 0.0f, 1.0f); + anim.setDuration(DEFAULT_ANIMATION_DURATION); + return anim; } - ObjectAnimator<?> getDefaultOutAnimation() { - return new ObjectAnimator<Float>(DEFAULT_ANIMATION_DURATION, null, "alpha", 1.0f, 0.0f); + ObjectAnimator getDefaultOutAnimation() { + ObjectAnimator anim = ObjectAnimator.ofFloat(null, "alpha", 1.0f, 0.0f); + anim.setDuration(DEFAULT_ANIMATION_DURATION); + return anim; } /** @@ -692,10 +696,10 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter> * * @return An Animation or null if none is set. * - * @see #setInAnimation(android.view.animation.Animation) + * @see #setInAnimation(android.animation.ObjectAnimator) * @see #setInAnimation(android.content.Context, int) */ - public ObjectAnimator<?> getInAnimation() { + public ObjectAnimator getInAnimation() { return mInAnimation; } @@ -707,7 +711,7 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter> * @see #getInAnimation() * @see #setInAnimation(android.content.Context, int) */ - public void setInAnimation(ObjectAnimator<?> inAnimation) { + public void setInAnimation(ObjectAnimator inAnimation) { mInAnimation = inAnimation; } @@ -716,10 +720,10 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter> * * @return An Animation or null if none is set. * - * @see #setOutAnimation(android.view.animation.Animation) + * @see #setOutAnimation(android.animation.ObjectAnimator) * @see #setOutAnimation(android.content.Context, int) */ - public ObjectAnimator<?> getOutAnimation() { + public ObjectAnimator getOutAnimation() { return mOutAnimation; } @@ -731,7 +735,7 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter> * @see #getOutAnimation() * @see #setOutAnimation(android.content.Context, int) */ - public void setOutAnimation(ObjectAnimator<?> outAnimation) { + public void setOutAnimation(ObjectAnimator outAnimation) { mOutAnimation = outAnimation; } @@ -742,10 +746,10 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter> * @param resourceID The resource id of the animation. * * @see #getInAnimation() - * @see #setInAnimation(android.view.animation.Animation) + * @see #setInAnimation(android.animation.ObjectAnimator) */ public void setInAnimation(Context context, int resourceID) { - setInAnimation((ObjectAnimator<?>) AnimatorInflater.loadAnimator(context, resourceID)); + setInAnimation((ObjectAnimator) AnimatorInflater.loadAnimator(context, resourceID)); } /** @@ -755,10 +759,10 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter> * @param resourceID The resource id of the animation. * * @see #getOutAnimation() - * @see #setOutAnimation(android.view.animation.Animation) + * @see #setOutAnimation(android.animation.ObjectAnimator) */ public void setOutAnimation(Context context, int resourceID) { - setOutAnimation((ObjectAnimator<?>) AnimatorInflater.loadAnimator(context, resourceID)); + setOutAnimation((ObjectAnimator) AnimatorInflater.loadAnimator(context, resourceID)); } /** |