Ejemplo n.º 1
0
 /**
  * Sets the name of the property that will be animated. This name is used to derive a setter
  * function that will be called to set animated values. For example, a property name of <code>foo
  * </code> will result in a call to the function <code>setFoo()</code> on the target object. If
  * either <code>valueFrom</code> or <code>valueTo</code> is null, then a getter function will also
  * be derived and called.
  *
  * <p>For best performance of the mechanism that calls the setter function determined by the name
  * of the property being animated, use <code>float</code> or <code>int</code> typed values, and
  * make the setter function for those properties have a <code>void</code> return value. This will
  * cause the code to take an optimized path for these constrained circumstances. Other property
  * types and return types will work, but will have more overhead in processing the requests due to
  * normal reflection mechanisms.
  *
  * <p>Note that the setter function derived from this property name must take the same parameter
  * type as the <code>valueFrom</code> and <code>valueTo</code> properties, otherwise the call to
  * the setter function will fail.
  *
  * <p>If this ObjectAnimator has been set up to animate several properties together, using more
  * than one PropertyValuesHolder objects, then setting the propertyName simply sets the
  * propertyName in the first of those PropertyValuesHolder objects.
  *
  * @param propertyName The name of the property being animated. Should not be null.
  */
 public void setPropertyName(String propertyName) {
   // mValues could be null if this is being constructed piecemeal. Just record the
   // propertyName to be used later when setValues() is called if so.
   if (mValues != null) {
     PropertyValuesHolder valuesHolder = mValues[0];
     String oldName = valuesHolder.getPropertyName();
     valuesHolder.setPropertyName(propertyName);
     mValuesMap.remove(oldName);
     mValuesMap.put(propertyName, valuesHolder);
   }
   mPropertyName = propertyName;
   // New property/values/target should cause re-initialization prior to starting
   mInitialized = false;
 }