Loading core/java/android/animation/AnimatableListenerAdapter.java 0 → 100644 +56 −0 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.animation; import android.animation.Animatable.AnimatableListener; /** * This adapter class provides empty implementations of the methods from {@link AnimatableListener}. * Any custom listener that cares only about a subset of the methods of this listener can * simply subclass this adapter class instead of implementing the interface directly. */ public abstract class AnimatableListenerAdapter implements AnimatableListener { /** * @{inheritdoc} */ @Override public void onAnimationCancel(Animatable animation) { } /** * @{inheritdoc} */ @Override public void onAnimationEnd(Animatable animation) { } /** * @{inheritdoc} */ @Override public void onAnimationRepeat(Animatable animation) { } /** * @{inheritdoc} */ @Override public void onAnimationStart(Animatable animation) { } } core/java/android/animation/Animator.java +75 −21 Original line number Diff line number Diff line Loading @@ -240,25 +240,6 @@ public class Animator extends Animatable { mValueType = keyframes[0].getType(); } /** * This function is called immediately before processing the first animation * frame of an animation. If there is a nonzero <code>startDelay</code>, the * function is called after that delay ends. * It takes care of the final initialization steps for the * animation. * * <p>Overrides of this method should call the superclass method to ensure * that internal mechanisms for the animation are set up correctly.</p> */ void initAnimation() { if (mEvaluator == null) { mEvaluator = (mValueType == int.class) ? sIntEvaluator : (mValueType == double.class) ? sDoubleEvaluator : sFloatEvaluator; } mPlayingBackwards = false; mCurrentIteration = 0; } /** * A constructor that takes <code>float</code> values. * Loading Loading @@ -304,6 +285,61 @@ public class Animator extends Animatable { (valueFrom != null) ? valueFrom.getClass() : valueTo.getClass()); } /** * Internal constructor that takes a single <code>float</code> value. * This constructor is called by PropertyAnimator. * * @param duration The length of the animation, in milliseconds. * @param valueFrom The initial value of the property when the animation begins. * @param valueTo The value to which the property will animate. */ Animator(long duration, float valueTo) { this(duration, null, valueTo, float.class); } /** * Internal constructor that takes a single <code>int</code> value. * This constructor is called by PropertyAnimator. * * @param duration The length of the animation, in milliseconds. * @param valueFrom The initial value of the property when the animation begins. * @param valueTo The value to which the property will animate. */ Animator(long duration, int valueTo) { this(duration, null, valueTo, int.class); } /** * Internal constructor that takes a single <code>double</code> value. * This constructor is called by PropertyAnimator. * * @param duration The length of the animation, in milliseconds. * @param valueFrom The initial value of the property when the animation begins. * @param valueTo The value to which the property will animate. */ Animator(long duration, double valueTo) { this(duration, null, valueTo, double.class); } /** * This function is called immediately before processing the first animation * frame of an animation. If there is a nonzero <code>startDelay</code>, the * function is called after that delay ends. * It takes care of the final initialization steps for the * animation. * * <p>Overrides of this method should call the superclass method to ensure * that internal mechanisms for the animation are set up correctly.</p> */ void initAnimation() { if (mEvaluator == null) { mEvaluator = (mValueType == int.class) ? sIntEvaluator : (mValueType == double.class) ? sDoubleEvaluator : sFloatEvaluator; } mPlayingBackwards = false; mCurrentIteration = 0; } /** * This custom, static handler handles the timing pulse that is shared by * all active animations. This approach ensures that the setting of animation Loading Loading @@ -454,6 +490,9 @@ public class Animator extends Animatable { * @return Object The starting value for the animation. */ public Object getValueFrom() { if (mKeyframeSet != null) { return mKeyframeSet.mKeyframes.get(0).getValue(); } return mValueFrom; } Loading @@ -461,8 +500,13 @@ public class Animator extends Animatable { * Sets the value that this animation will start from. */ public void setValueFrom(Object valueFrom) { if (mKeyframeSet != null) { Keyframe kf = mKeyframeSet.mKeyframes.get(0); kf.setValue(valueFrom); } else { mValueFrom = valueFrom; } } /** * Gets the value that this animation will animate to. Loading @@ -470,6 +514,10 @@ public class Animator extends Animatable { * @return Object The ending value for the animation. */ public Object getValueTo() { if (mKeyframeSet != null) { int numKeyframes = mKeyframeSet.mKeyframes.size(); return mKeyframeSet.mKeyframes.get(numKeyframes - 1).getValue(); } return mValueTo; } Loading @@ -479,8 +527,14 @@ public class Animator extends Animatable { * @return Object The ending value for the animation. */ public void setValueTo(Object valueTo) { if (mKeyframeSet != null) { int numKeyframes = mKeyframeSet.mKeyframes.size(); Keyframe kf = mKeyframeSet.mKeyframes.get(numKeyframes - 1); kf.setValue(valueTo); } else { mValueTo = valueTo; } } /** * The amount of time, in milliseconds, between each frame of the animation. This is a Loading core/java/android/animation/Keyframe.java +19 −0 Original line number Diff line number Diff line Loading @@ -141,6 +141,15 @@ public class Keyframe { return mValue; } /** * Sets the value for this Keyframe. * * @param The value for this Keyframe. */ public void setValue(Object value) { mValue = value; } /** * Gets the time for this keyframe, as a fraction of the overall animation duration. * Loading @@ -151,6 +160,16 @@ public class Keyframe { return mFraction; } /** * Sets the time for this keyframe, as a fraction of the overall animation duration. * * @param The time associated with this keyframe, as a fraction of the overall animation * duration. This should be a value between 0 and 1. */ public void setFraction(float fraction) { mFraction = fraction; } /** * Gets the optional interpolator for this Keyframe. A value of <code>null</code> indicates * that there is no interpolation, which is the same as linear interpolation. Loading core/java/android/animation/KeyframeSet.java +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ class KeyframeSet { private int mNumKeyframes; private ArrayList<Keyframe> mKeyframes; ArrayList<Keyframe> mKeyframes; public KeyframeSet(Keyframe... keyframes) { mKeyframes = new ArrayList<Keyframe>(); Loading core/java/android/animation/PropertyAnimator.java +107 −6 Original line number Diff line number Diff line Loading @@ -160,20 +160,23 @@ public final class PropertyAnimator extends Animator { * @param prefix "set" or "get", depending on whether we need a setter or getter. * @return Method the method associated with mPropertyName. */ private Method getPropertyFunction(String prefix) { private Method getPropertyFunction(String prefix, Class valueType) { // TODO: faster implementation... Method returnVal = null; String firstLetter = mPropertyName.substring(0, 1); String theRest = mPropertyName.substring(1); firstLetter = firstLetter.toUpperCase(); String setterName = prefix + firstLetter + theRest; Class args[] = new Class[1]; args[0] = mValueType; Class args[] = null; if (valueType != null) { args = new Class[1]; args[0] = valueType; } try { returnVal = mTarget.getClass().getMethod(setterName, args); } catch (NoSuchMethodException e) { Log.e("PropertyAnimator", "Couldn't find setter for property " + mPropertyName + ": " + e); "Couldn't find setter/getter for property " + mPropertyName + ": " + e); } return returnVal; } Loading Loading @@ -202,6 +205,31 @@ public final class PropertyAnimator extends Animator { mPropertyName = propertyName; } /** * A constructor that takes a single <code>float</code> value, which is the value that the * target object will animate to. When this constructor * is called, the system expects to find a setter for <code>propertyName</code> on * the target object that takes a value of the same type as the <code>Object</code>s. The * system also expects to find a similar getter function with which to derive the starting * value for the animation. * * @param duration The length of the animation, in milliseconds. * @param target The object whose property is to be animated. This object should * have a public function on it called <code>setName()</code>, where <code>name</code> is * the name of the property passed in as the <code>propertyName</code> parameter. * @param propertyName The name of the property on the <code>target</code> object * that will be animated. Given this name, the constructor will search for a * setter on the target object with the name <code>setPropertyName</code>. For example, * if the constructor is called with <code>propertyName = "foo"</code>, then the * target object should have a setter function with the name <code>setFoo()</code>. * @param valueTo The value to which the property will animate. */ public PropertyAnimator(int duration, Object target, String propertyName, float valueTo) { super(duration, valueTo); mTarget = target; mPropertyName = propertyName; } /** * A constructor that takes <code>int</code> values. When this constructor * is called, the system expects to find a setter for <code>propertyName</code> on Loading @@ -226,6 +254,31 @@ public final class PropertyAnimator extends Animator { mPropertyName = propertyName; } /** * A constructor that takes a single <code>int</code> value, which is the value that the * target object will animate to. When this constructor * is called, the system expects to find a setter for <code>propertyName</code> on * the target object that takes a value of the same type as the <code>Object</code>s. The * system also expects to find a similar getter function with which to derive the starting * value for the animation. * * @param duration The length of the animation, in milliseconds. * @param target The object whose property is to be animated. This object should * have a public function on it called <code>setName()</code>, where <code>name</code> is * the name of the property passed in as the <code>propertyName</code> parameter. * @param propertyName The name of the property on the <code>target</code> object * that will be animated. Given this name, the constructor will search for a * setter on the target object with the name <code>setPropertyName</code>. For example, * if the constructor is called with <code>propertyName = "foo"</code>, then the * target object should have a setter function with the name <code>setFoo()</code>. * @param valueTo The value to which the property will animate. */ public PropertyAnimator(int duration, Object target, String propertyName, int valueTo) { super(duration, valueTo); mTarget = target; mPropertyName = propertyName; } /** * A constructor that takes <code>double</code> values. When this constructor * is called, the system expects to find a setter for <code>propertyName</code> on Loading @@ -250,6 +303,31 @@ public final class PropertyAnimator extends Animator { mPropertyName = propertyName; } /** * A constructor that takes a single <code>double</code> value, which is the value that the * target object will animate to. When this constructor * is called, the system expects to find a setter for <code>propertyName</code> on * the target object that takes a value of the same type as the <code>Object</code>s. The * system also expects to find a similar getter function with which to derive the starting * value for the animation. * * @param duration The length of the animation, in milliseconds. * @param target The object whose property is to be animated. This object should * have a public function on it called <code>setName()</code>, where <code>name</code> is * the name of the property passed in as the <code>propertyName</code> parameter. * @param propertyName The name of the property on the <code>target</code> object * that will be animated. Given this name, the constructor will search for a * setter on the target object with the name <code>setPropertyName</code>. For example, * if the constructor is called with <code>propertyName = "foo"</code>, then the * target object should have a setter function with the name <code>setFoo()</code>. * @param valueTo The value to which the property will animate. */ public PropertyAnimator(int duration, Object target, String propertyName, double valueTo) { super(duration, valueTo); mTarget = target; mPropertyName = propertyName; } /** * A constructor that takes <code>Object</code> values. When this constructor * is called, the system expects to find a setter for <code>propertyName</code> on Loading @@ -274,6 +352,29 @@ public final class PropertyAnimator extends Animator { mPropertyName = propertyName; } /** * A constructor that takes a single <code>Object</code> value, which is the value that the * target object will animate to. When this constructor * is called, the system expects to find a setter for <code>propertyName</code> on * the target object that takes a value of the same type as the <code>Object</code>s. The * system also expects to find a similar getter function with which to derive the starting * value for the animation. * * @param duration The length of the animation, in milliseconds. * @param target The object whose property is to be animated. This object should * have a public function on it called <code>setName()</code>, where <code>name</code> is * the name of the property passed in as the <code>propertyName</code> parameter. * @param propertyName The name of the property on the <code>target</code> object * that will be animated. Given this name, the constructor will search for a * setter on the target object with the name <code>setPropertyName</code>. For example, * if the constructor is called with <code>propertyName = "foo"</code>, then the * target object should have a setter function with the name <code>setFoo()</code>. * @param valueTo The value to which the property will animate. */ public PropertyAnimator(int duration, Object target, String propertyName, Object valueTo) { this(duration, target, propertyName, null, valueTo); } /** * A constructor that takes <code>Keyframe</code>s. When this constructor * is called, the system expects to find a setter for <code>propertyName</code> on Loading Loading @@ -329,7 +430,7 @@ public final class PropertyAnimator extends Animator { return; } } mSetter = getPropertyFunction("set"); mSetter = getPropertyFunction("set", mValueType); if (propertyMap == null) { propertyMap = new HashMap<String, Method>(); sSetterPropertyMap.put(mTarget, propertyMap); Loading @@ -352,7 +453,7 @@ public final class PropertyAnimator extends Animator { return; } } mGetter = getPropertyFunction("get"); mGetter = getPropertyFunction("get", null); if (propertyMap == null) { propertyMap = new HashMap<String, Method>(); sGetterPropertyMap.put(mTarget, propertyMap); Loading Loading
core/java/android/animation/AnimatableListenerAdapter.java 0 → 100644 +56 −0 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.animation; import android.animation.Animatable.AnimatableListener; /** * This adapter class provides empty implementations of the methods from {@link AnimatableListener}. * Any custom listener that cares only about a subset of the methods of this listener can * simply subclass this adapter class instead of implementing the interface directly. */ public abstract class AnimatableListenerAdapter implements AnimatableListener { /** * @{inheritdoc} */ @Override public void onAnimationCancel(Animatable animation) { } /** * @{inheritdoc} */ @Override public void onAnimationEnd(Animatable animation) { } /** * @{inheritdoc} */ @Override public void onAnimationRepeat(Animatable animation) { } /** * @{inheritdoc} */ @Override public void onAnimationStart(Animatable animation) { } }
core/java/android/animation/Animator.java +75 −21 Original line number Diff line number Diff line Loading @@ -240,25 +240,6 @@ public class Animator extends Animatable { mValueType = keyframes[0].getType(); } /** * This function is called immediately before processing the first animation * frame of an animation. If there is a nonzero <code>startDelay</code>, the * function is called after that delay ends. * It takes care of the final initialization steps for the * animation. * * <p>Overrides of this method should call the superclass method to ensure * that internal mechanisms for the animation are set up correctly.</p> */ void initAnimation() { if (mEvaluator == null) { mEvaluator = (mValueType == int.class) ? sIntEvaluator : (mValueType == double.class) ? sDoubleEvaluator : sFloatEvaluator; } mPlayingBackwards = false; mCurrentIteration = 0; } /** * A constructor that takes <code>float</code> values. * Loading Loading @@ -304,6 +285,61 @@ public class Animator extends Animatable { (valueFrom != null) ? valueFrom.getClass() : valueTo.getClass()); } /** * Internal constructor that takes a single <code>float</code> value. * This constructor is called by PropertyAnimator. * * @param duration The length of the animation, in milliseconds. * @param valueFrom The initial value of the property when the animation begins. * @param valueTo The value to which the property will animate. */ Animator(long duration, float valueTo) { this(duration, null, valueTo, float.class); } /** * Internal constructor that takes a single <code>int</code> value. * This constructor is called by PropertyAnimator. * * @param duration The length of the animation, in milliseconds. * @param valueFrom The initial value of the property when the animation begins. * @param valueTo The value to which the property will animate. */ Animator(long duration, int valueTo) { this(duration, null, valueTo, int.class); } /** * Internal constructor that takes a single <code>double</code> value. * This constructor is called by PropertyAnimator. * * @param duration The length of the animation, in milliseconds. * @param valueFrom The initial value of the property when the animation begins. * @param valueTo The value to which the property will animate. */ Animator(long duration, double valueTo) { this(duration, null, valueTo, double.class); } /** * This function is called immediately before processing the first animation * frame of an animation. If there is a nonzero <code>startDelay</code>, the * function is called after that delay ends. * It takes care of the final initialization steps for the * animation. * * <p>Overrides of this method should call the superclass method to ensure * that internal mechanisms for the animation are set up correctly.</p> */ void initAnimation() { if (mEvaluator == null) { mEvaluator = (mValueType == int.class) ? sIntEvaluator : (mValueType == double.class) ? sDoubleEvaluator : sFloatEvaluator; } mPlayingBackwards = false; mCurrentIteration = 0; } /** * This custom, static handler handles the timing pulse that is shared by * all active animations. This approach ensures that the setting of animation Loading Loading @@ -454,6 +490,9 @@ public class Animator extends Animatable { * @return Object The starting value for the animation. */ public Object getValueFrom() { if (mKeyframeSet != null) { return mKeyframeSet.mKeyframes.get(0).getValue(); } return mValueFrom; } Loading @@ -461,8 +500,13 @@ public class Animator extends Animatable { * Sets the value that this animation will start from. */ public void setValueFrom(Object valueFrom) { if (mKeyframeSet != null) { Keyframe kf = mKeyframeSet.mKeyframes.get(0); kf.setValue(valueFrom); } else { mValueFrom = valueFrom; } } /** * Gets the value that this animation will animate to. Loading @@ -470,6 +514,10 @@ public class Animator extends Animatable { * @return Object The ending value for the animation. */ public Object getValueTo() { if (mKeyframeSet != null) { int numKeyframes = mKeyframeSet.mKeyframes.size(); return mKeyframeSet.mKeyframes.get(numKeyframes - 1).getValue(); } return mValueTo; } Loading @@ -479,8 +527,14 @@ public class Animator extends Animatable { * @return Object The ending value for the animation. */ public void setValueTo(Object valueTo) { if (mKeyframeSet != null) { int numKeyframes = mKeyframeSet.mKeyframes.size(); Keyframe kf = mKeyframeSet.mKeyframes.get(numKeyframes - 1); kf.setValue(valueTo); } else { mValueTo = valueTo; } } /** * The amount of time, in milliseconds, between each frame of the animation. This is a Loading
core/java/android/animation/Keyframe.java +19 −0 Original line number Diff line number Diff line Loading @@ -141,6 +141,15 @@ public class Keyframe { return mValue; } /** * Sets the value for this Keyframe. * * @param The value for this Keyframe. */ public void setValue(Object value) { mValue = value; } /** * Gets the time for this keyframe, as a fraction of the overall animation duration. * Loading @@ -151,6 +160,16 @@ public class Keyframe { return mFraction; } /** * Sets the time for this keyframe, as a fraction of the overall animation duration. * * @param The time associated with this keyframe, as a fraction of the overall animation * duration. This should be a value between 0 and 1. */ public void setFraction(float fraction) { mFraction = fraction; } /** * Gets the optional interpolator for this Keyframe. A value of <code>null</code> indicates * that there is no interpolation, which is the same as linear interpolation. Loading
core/java/android/animation/KeyframeSet.java +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ class KeyframeSet { private int mNumKeyframes; private ArrayList<Keyframe> mKeyframes; ArrayList<Keyframe> mKeyframes; public KeyframeSet(Keyframe... keyframes) { mKeyframes = new ArrayList<Keyframe>(); Loading
core/java/android/animation/PropertyAnimator.java +107 −6 Original line number Diff line number Diff line Loading @@ -160,20 +160,23 @@ public final class PropertyAnimator extends Animator { * @param prefix "set" or "get", depending on whether we need a setter or getter. * @return Method the method associated with mPropertyName. */ private Method getPropertyFunction(String prefix) { private Method getPropertyFunction(String prefix, Class valueType) { // TODO: faster implementation... Method returnVal = null; String firstLetter = mPropertyName.substring(0, 1); String theRest = mPropertyName.substring(1); firstLetter = firstLetter.toUpperCase(); String setterName = prefix + firstLetter + theRest; Class args[] = new Class[1]; args[0] = mValueType; Class args[] = null; if (valueType != null) { args = new Class[1]; args[0] = valueType; } try { returnVal = mTarget.getClass().getMethod(setterName, args); } catch (NoSuchMethodException e) { Log.e("PropertyAnimator", "Couldn't find setter for property " + mPropertyName + ": " + e); "Couldn't find setter/getter for property " + mPropertyName + ": " + e); } return returnVal; } Loading Loading @@ -202,6 +205,31 @@ public final class PropertyAnimator extends Animator { mPropertyName = propertyName; } /** * A constructor that takes a single <code>float</code> value, which is the value that the * target object will animate to. When this constructor * is called, the system expects to find a setter for <code>propertyName</code> on * the target object that takes a value of the same type as the <code>Object</code>s. The * system also expects to find a similar getter function with which to derive the starting * value for the animation. * * @param duration The length of the animation, in milliseconds. * @param target The object whose property is to be animated. This object should * have a public function on it called <code>setName()</code>, where <code>name</code> is * the name of the property passed in as the <code>propertyName</code> parameter. * @param propertyName The name of the property on the <code>target</code> object * that will be animated. Given this name, the constructor will search for a * setter on the target object with the name <code>setPropertyName</code>. For example, * if the constructor is called with <code>propertyName = "foo"</code>, then the * target object should have a setter function with the name <code>setFoo()</code>. * @param valueTo The value to which the property will animate. */ public PropertyAnimator(int duration, Object target, String propertyName, float valueTo) { super(duration, valueTo); mTarget = target; mPropertyName = propertyName; } /** * A constructor that takes <code>int</code> values. When this constructor * is called, the system expects to find a setter for <code>propertyName</code> on Loading @@ -226,6 +254,31 @@ public final class PropertyAnimator extends Animator { mPropertyName = propertyName; } /** * A constructor that takes a single <code>int</code> value, which is the value that the * target object will animate to. When this constructor * is called, the system expects to find a setter for <code>propertyName</code> on * the target object that takes a value of the same type as the <code>Object</code>s. The * system also expects to find a similar getter function with which to derive the starting * value for the animation. * * @param duration The length of the animation, in milliseconds. * @param target The object whose property is to be animated. This object should * have a public function on it called <code>setName()</code>, where <code>name</code> is * the name of the property passed in as the <code>propertyName</code> parameter. * @param propertyName The name of the property on the <code>target</code> object * that will be animated. Given this name, the constructor will search for a * setter on the target object with the name <code>setPropertyName</code>. For example, * if the constructor is called with <code>propertyName = "foo"</code>, then the * target object should have a setter function with the name <code>setFoo()</code>. * @param valueTo The value to which the property will animate. */ public PropertyAnimator(int duration, Object target, String propertyName, int valueTo) { super(duration, valueTo); mTarget = target; mPropertyName = propertyName; } /** * A constructor that takes <code>double</code> values. When this constructor * is called, the system expects to find a setter for <code>propertyName</code> on Loading @@ -250,6 +303,31 @@ public final class PropertyAnimator extends Animator { mPropertyName = propertyName; } /** * A constructor that takes a single <code>double</code> value, which is the value that the * target object will animate to. When this constructor * is called, the system expects to find a setter for <code>propertyName</code> on * the target object that takes a value of the same type as the <code>Object</code>s. The * system also expects to find a similar getter function with which to derive the starting * value for the animation. * * @param duration The length of the animation, in milliseconds. * @param target The object whose property is to be animated. This object should * have a public function on it called <code>setName()</code>, where <code>name</code> is * the name of the property passed in as the <code>propertyName</code> parameter. * @param propertyName The name of the property on the <code>target</code> object * that will be animated. Given this name, the constructor will search for a * setter on the target object with the name <code>setPropertyName</code>. For example, * if the constructor is called with <code>propertyName = "foo"</code>, then the * target object should have a setter function with the name <code>setFoo()</code>. * @param valueTo The value to which the property will animate. */ public PropertyAnimator(int duration, Object target, String propertyName, double valueTo) { super(duration, valueTo); mTarget = target; mPropertyName = propertyName; } /** * A constructor that takes <code>Object</code> values. When this constructor * is called, the system expects to find a setter for <code>propertyName</code> on Loading @@ -274,6 +352,29 @@ public final class PropertyAnimator extends Animator { mPropertyName = propertyName; } /** * A constructor that takes a single <code>Object</code> value, which is the value that the * target object will animate to. When this constructor * is called, the system expects to find a setter for <code>propertyName</code> on * the target object that takes a value of the same type as the <code>Object</code>s. The * system also expects to find a similar getter function with which to derive the starting * value for the animation. * * @param duration The length of the animation, in milliseconds. * @param target The object whose property is to be animated. This object should * have a public function on it called <code>setName()</code>, where <code>name</code> is * the name of the property passed in as the <code>propertyName</code> parameter. * @param propertyName The name of the property on the <code>target</code> object * that will be animated. Given this name, the constructor will search for a * setter on the target object with the name <code>setPropertyName</code>. For example, * if the constructor is called with <code>propertyName = "foo"</code>, then the * target object should have a setter function with the name <code>setFoo()</code>. * @param valueTo The value to which the property will animate. */ public PropertyAnimator(int duration, Object target, String propertyName, Object valueTo) { this(duration, target, propertyName, null, valueTo); } /** * A constructor that takes <code>Keyframe</code>s. When this constructor * is called, the system expects to find a setter for <code>propertyName</code> on Loading Loading @@ -329,7 +430,7 @@ public final class PropertyAnimator extends Animator { return; } } mSetter = getPropertyFunction("set"); mSetter = getPropertyFunction("set", mValueType); if (propertyMap == null) { propertyMap = new HashMap<String, Method>(); sSetterPropertyMap.put(mTarget, propertyMap); Loading @@ -352,7 +453,7 @@ public final class PropertyAnimator extends Animator { return; } } mGetter = getPropertyFunction("get"); mGetter = getPropertyFunction("get", null); if (propertyMap == null) { propertyMap = new HashMap<String, Method>(); sGetterPropertyMap.put(mTarget, propertyMap); Loading