public final class

ObjectAnimator

extends ValueAnimator

 java.lang.Object

androidx.core.animation.Animator

androidx.core.animation.ValueAnimator

↳androidx.core.animation.ObjectAnimator

Gradle dependencies

compile group: 'androidx.core', name: 'core-animation', version: '1.0.0'

  • groupId: androidx.core
  • artifactId: core-animation
  • version: 1.0.0

Artifact androidx.core:core-animation:1.0.0 it located at Google repository (https://maven.google.com/)

Overview

This subclass of ValueAnimator provides support for animating properties on target objects. The constructors of this class take parameters to define the target object that will be animated as well as the name of the property that will be animated. Appropriate set/get functions are then determined internally and the animation will call these functions as necessary to animate the property.

ObjectAnimator supports the use of PropertyValuesHolder and Keyframe in resource files to create more complex animations. Using PropertyValuesHolders allows animators to animate several properties in parallel.

Using Keyframes allows animations to follow more complex paths from the start to the end values. Note that you can specify explicit fractional values (from 0 to 1) for each keyframe to determine when, in the overall duration, the animation should arrive at that value. Alternatively, you can leave the fractions off and the keyframes will be equally distributed within the total duration. Also, a keyframe with no value will derive its value from the target object when the animator starts, just like animators with only one value specified. In addition, an optional interpolator can be specified. The interpolator will be applied on the interval between the keyframe that the interpolator is set on and the previous keyframe. When no interpolator is supplied, the default AccelerateDecelerateInterpolator will be used.

Developer Guides

For more information about animating with ObjectAnimator, read the Property Animation developer guide.

Summary

Fields
from ValueAnimatorINFINITE, RESTART, REVERSE
from AnimatorDURATION_INFINITE
Constructors
publicObjectAnimator()

Creates a new ObjectAnimator object.

Methods
public ObjectAnimatorclone()

public java.lang.StringgetNameForTrace()

Returns the name of this animator for debugging purposes.

public java.lang.StringgetPropertyName()

Gets the name of the property that will be animated.

public java.lang.ObjectgetTarget()

The target object whose property will be animated by this animation

public static ObjectAnimatorofArgb(java.lang.Object target, java.lang.String propertyName, int[] values[])

Constructs and returns an ObjectAnimator that animates between color values.

public static ObjectAnimatorofArgb(java.lang.Object target, <any> property, int[] values[])

Constructs and returns an ObjectAnimator that animates between color values.

public static ObjectAnimatorofFloat(java.lang.Object target, java.lang.String propertyName, float[] values[])

Constructs and returns an ObjectAnimator that animates between float values.

public static ObjectAnimatorofFloat(java.lang.Object target, java.lang.String xPropertyName, java.lang.String yPropertyName, Path path)

Constructs and returns an ObjectAnimator that animates coordinates along a Path using two properties.

public static ObjectAnimatorofFloat(java.lang.Object target, <any> xProperty, <any> yProperty, Path path)

Constructs and returns an ObjectAnimator that animates coordinates along a Path using two properties.

public static ObjectAnimatorofFloat(java.lang.Object target, <any> property, float[] values[])

Constructs and returns an ObjectAnimator that animates between float values.

public static ObjectAnimatorofInt(java.lang.Object target, java.lang.String propertyName, int[] values[])

Constructs and returns an ObjectAnimator that animates between int values.

public static ObjectAnimatorofInt(java.lang.Object target, java.lang.String xPropertyName, java.lang.String yPropertyName, Path path)

Constructs and returns an ObjectAnimator that animates coordinates along a Path using two properties.

public static ObjectAnimatorofInt(java.lang.Object target, <any> xProperty, <any> yProperty, Path path)

Constructs and returns an ObjectAnimator that animates coordinates along a Path using two properties.

public static ObjectAnimatorofInt(java.lang.Object target, <any> property, int[] values[])

Constructs and returns an ObjectAnimator that animates between int values.

public static ObjectAnimatorofMultiFloat(java.lang.Object target, java.lang.String propertyName, float[][] values[][])

Constructs and returns an ObjectAnimator that animates over float values for a multiple parameters setter.

public static ObjectAnimatorofMultiFloat(java.lang.Object target, java.lang.String propertyName, Path path)

Constructs and returns an ObjectAnimator that animates the target using a multi-float setter along the given Path.

public static ObjectAnimatorofMultiFloat(java.lang.Object target, java.lang.String propertyName, TypeConverter<java.lang.Object, UnknownReference> converter, TypeEvaluator<java.lang.Object> evaluator, java.lang.Object values[])

Constructs and returns an ObjectAnimator that animates over values for a multiple float parameters setter.

public static ObjectAnimatorofMultiInt(java.lang.Object target, java.lang.String propertyName, int[][] values[][])

Constructs and returns an ObjectAnimator that animates over int values for a multiple parameters setter.

public static ObjectAnimatorofMultiInt(java.lang.Object target, java.lang.String propertyName, Path path)

Constructs and returns an ObjectAnimator that animates the target using a multi-int setter along the given Path.

public static ObjectAnimatorofMultiInt(java.lang.Object target, java.lang.String propertyName, TypeConverter<java.lang.Object, UnknownReference> converter, TypeEvaluator<java.lang.Object> evaluator, java.lang.Object values[])

Constructs and returns an ObjectAnimator that animates over values for a multiple int parameters setter.

public static ObjectAnimatorofObject(java.lang.Object target, java.lang.String propertyName, TypeConverter<PointF, java.lang.Object> converter, Path path)

Constructs and returns an ObjectAnimator that animates a property along a Path.

public static ObjectAnimatorofObject(java.lang.Object target, java.lang.String propertyName, TypeEvaluator evaluator, java.lang.Object values[])

Constructs and returns an ObjectAnimator that animates between Object values.

public static ObjectAnimatorofObject(java.lang.Object target, <any> property, TypeConverter<PointF, java.lang.Object> converter, Path path)

Constructs and returns an ObjectAnimator that animates a property along a Path.

public static ObjectAnimatorofObject(java.lang.Object target, <any> property, TypeConverter<java.lang.Object, java.lang.Object> converter, TypeEvaluator<java.lang.Object> evaluator, java.lang.Object values[])

Constructs and returns an ObjectAnimator that animates between Object values.

public static ObjectAnimatorofObject(java.lang.Object target, <any> property, TypeEvaluator<java.lang.Object> evaluator, java.lang.Object values[])

Constructs and returns an ObjectAnimator that animates between Object values.

public static ObjectAnimatorofPropertyValuesHolder(java.lang.Object target, PropertyValuesHolder values[])

Constructs and returns an ObjectAnimator that animates between the sets of values specified in PropertyValueHolder objects.

public voidsetAutoCancel(boolean cancel)

autoCancel controls whether an ObjectAnimator will be canceled automatically when any other ObjectAnimator with the same target and properties is started.

public ObjectAnimatorsetDuration(long duration)

Sets the length of the animation.

public voidsetFloatValues(float[] values[])

Sets float values that will be animated between.

public voidsetIntValues(int[] values[])

Sets int values that will be animated between.

public voidsetObjectValues(java.lang.Object values[])

Sets the values to animate between for this animation.

public voidsetProperty(Property property)

Sets the property that will be animated.

public voidsetPropertyName(java.lang.String propertyName)

Sets the name of the property that will be animated.

public voidsetTarget(java.lang.Object target)

Sets the target object whose property will be animated by this animation.

public voidsetupEndValues()

This method tells the object to use appropriate information to extract ending values for the animation.

public voidsetupStartValues()

This method tells the object to use appropriate information to extract starting values for the animation.

public voidstart()

Starts this animation.

public java.lang.StringtoString()

from ValueAnimatorareAnimatorsEnabled, cancel, doAnimationFrame, end, getAnimatedFraction, getAnimatedValue, getAnimatedValue, getCurrentPlayTime, getDuration, getFrameDelay, getInterpolator, getRepeatCount, getRepeatMode, getStartDelay, getTotalDuration, getValues, isRunning, isStarted, ofArgb, ofFloat, ofInt, ofObject, ofPropertyValuesHolder, pause, resume, reverse, setCurrentFraction, setCurrentPlayTime, setEvaluator, setFrameDelay, setInterpolator, setNameForTrace, setRepeatCount, setRepeatMode, setStartDelay, setValues
from AnimatoraddListener, addPauseListener, addUpdateListener, isPaused, removeAllListeners, removeAllUpdateListeners, removeListener, removePauseListener, removeUpdateListener
from java.lang.Objectequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructors

public ObjectAnimator()

Creates a new ObjectAnimator object. This default constructor is primarily for use internally; the other constructors which take parameters are more generally useful.

Methods

public void setPropertyName(java.lang.String propertyName)

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 foo will result in a call to the function setFoo() on the target object. If either valueFrom or valueTo is null, then a getter function will also be derived and called.

For best performance of the mechanism that calls the setter function determined by the name of the property being animated, use float or int typed values, and make the setter function for those properties have a void 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.

Note that the setter function derived from this property name must take the same parameter type as the valueFrom and valueTo properties, otherwise the call to the setter function will fail.

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.

Parameters:

propertyName: The name of the property being animated. Should not be null.

public void setProperty(Property property)

Sets the property that will be animated. Property objects will take precedence over properties specified by the ObjectAnimator.setPropertyName(String) method. Animations should be set up to use one or the other, not both.

Parameters:

property: The property being animated. Should not be null.

public java.lang.String getPropertyName()

Gets the name of the property that will be animated. This name will be used to derive a setter function that will be called to set animated values. For example, a property name of foo will result in a call to the function setFoo() on the target object. If either valueFrom or valueTo is null, then a getter function will also be derived and called.

If this animator was created with a object instead of the string name of a property, then this method will return the of that Property object instead. If this animator was created with one or more PropertyValuesHolder objects, then this method will return the name of that object (if there was just one) or a comma-separated list of all of the names (if there are more than one).

public java.lang.String getNameForTrace()

Returns the name of this animator for debugging purposes.

public static ObjectAnimator ofInt(java.lang.Object target, java.lang.String propertyName, int[] values[])

Constructs and returns an ObjectAnimator that animates between int values. A single value implies that that value is the one being animated to, in which case the start value will be derived from the property being animated and the target object when ObjectAnimator.start() is called for the first time. Two values imply starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Parameters:

target: The object whose property is to be animated. This object should have a public method on it called setName(), where name is the value of the propertyName parameter.
propertyName: The name of the property being animated.
values: A set of values that the animation will animate between over time.

Returns:

An ObjectAnimator object that is set up to animate between the given values.

public static ObjectAnimator ofInt(java.lang.Object target, java.lang.String xPropertyName, java.lang.String yPropertyName, Path path)

Constructs and returns an ObjectAnimator that animates coordinates along a Path using two properties. A Path animation moves in two dimensions, animating coordinates (x, y) together to follow the line. In this variation, the coordinates are integers that are set to separate properties designated by xPropertyName and yPropertyName.

Parameters:

target: The object whose properties are to be animated. This object should have public methods on it called setNameX() and setNameY, where nameX and nameY are the value of xPropertyName and yPropertyName parameters, respectively.
xPropertyName: The name of the property for the x coordinate being animated.
yPropertyName: The name of the property for the y coordinate being animated.
path: The Path to animate values along.

Returns:

An ObjectAnimator object that is set up to animate along path.

public static ObjectAnimator ofInt(java.lang.Object target, <any> property, int[] values[])

Constructs and returns an ObjectAnimator that animates between int values. A single value implies that that value is the one being animated to, in which case the start value will be derived from the property being animated and the target object when ObjectAnimator.start() is called for the first time. Two values imply starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Parameters:

target: The object whose property is to be animated.
property: The property being animated.
values: A set of values that the animation will animate between over time.

Returns:

An ObjectAnimator object that is set up to animate between the given values.

public static ObjectAnimator ofInt(java.lang.Object target, <any> xProperty, <any> yProperty, Path path)

Constructs and returns an ObjectAnimator that animates coordinates along a Path using two properties. A Path animation moves in two dimensions, animating coordinates (x, y) together to follow the line. In this variation, the coordinates are integers that are set to separate properties, xProperty and yProperty.

Parameters:

target: The object whose properties are to be animated.
xProperty: The property for the x coordinate being animated.
yProperty: The property for the y coordinate being animated.
path: The Path to animate values along.

Returns:

An ObjectAnimator object that is set up to animate along path.

public static ObjectAnimator ofMultiInt(java.lang.Object target, java.lang.String propertyName, int[][] values[][])

Constructs and returns an ObjectAnimator that animates over int values for a multiple parameters setter. Only public methods that take only int parameters are supported. Each int[] contains a complete set of parameters to the setter method. At least two int[] values must be provided, a start and end. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Parameters:

target: The object whose property is to be animated. This object may have a public method on it called setName(), where name is the value of the propertyName parameter. propertyName may also be the case-sensitive complete name of the public setter method.
propertyName: The name of the property being animated or the name of the setter method.
values: A set of values that the animation will animate between over time.

Returns:

An ObjectAnimator object that is set up to animate between the given values.

public static ObjectAnimator ofMultiInt(java.lang.Object target, java.lang.String propertyName, Path path)

Constructs and returns an ObjectAnimator that animates the target using a multi-int setter along the given Path. A Path animation moves in two dimensions, animating coordinates (x, y) together to follow the line. In this variation, the coordinates are integer x and y coordinates used in the first and second parameter of the setter, respectively.

Parameters:

target: The object whose property is to be animated. This object may have a public method on it called setName(), where name is the value of the propertyName parameter. propertyName may also be the case-sensitive complete name of the public setter method.
propertyName: The name of the property being animated or the name of the setter method.
path: The Path to animate values along.

Returns:

An ObjectAnimator object that is set up to animate along path.

public static ObjectAnimator ofMultiInt(java.lang.Object target, java.lang.String propertyName, TypeConverter<java.lang.Object, UnknownReference> converter, TypeEvaluator<java.lang.Object> evaluator, java.lang.Object values[])

Constructs and returns an ObjectAnimator that animates over values for a multiple int parameters setter. Only public methods that take only int parameters are supported.

At least two values must be provided, a start and end. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Parameters:

target: The object whose property is to be animated. This object may have a public method on it called setName(), where name is the value of the propertyName parameter. propertyName may also be the case-sensitive complete name of the public setter method.
propertyName: The name of the property being animated or the name of the setter method.
converter: Converts T objects into int parameters for the multi-value setter.
evaluator: A TypeEvaluator that will be called on each animation frame to provide the necessary interpolation between the Object values to derive the animated value.
values: A set of values that the animation will animate between over time.

Returns:

An ObjectAnimator object that is set up to animate between the given values.

public static ObjectAnimator ofArgb(java.lang.Object target, java.lang.String propertyName, int[] values[])

Constructs and returns an ObjectAnimator that animates between color values. A single value implies that that value is the one being animated to, in which case the start value will be derived from the property being animated and the target object when ObjectAnimator.start() is called for the first time. Two values imply starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Parameters:

target: The object whose property is to be animated. This object should have a public method on it called setName(), where name is the value of the propertyName parameter.
propertyName: The name of the property being animated.
values: A set of values that the animation will animate between over time.

Returns:

An ObjectAnimator object that is set up to animate between the given values.

public static ObjectAnimator ofArgb(java.lang.Object target, <any> property, int[] values[])

Constructs and returns an ObjectAnimator that animates between color values. A single value implies that that value is the one being animated to, in which case the start value will be derived from the property being animated and the target object when ObjectAnimator.start() is called for the first time. Two values imply starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Parameters:

target: The object whose property is to be animated.
property: The property being animated.
values: A set of values that the animation will animate between over time.

Returns:

An ObjectAnimator object that is set up to animate between the given values.

public static ObjectAnimator ofFloat(java.lang.Object target, java.lang.String propertyName, float[] values[])

Constructs and returns an ObjectAnimator that animates between float values. A single value implies that that value is the one being animated to, in which case the start value will be derived from the property being animated and the target object when ObjectAnimator.start() is called for the first time. Two values imply starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Parameters:

target: The object whose property is to be animated. This object should have a public method on it called setName(), where name is the value of the propertyName parameter.
propertyName: The name of the property being animated.
values: A set of values that the animation will animate between over time.

Returns:

An ObjectAnimator object that is set up to animate between the given values.

public static ObjectAnimator ofFloat(java.lang.Object target, java.lang.String xPropertyName, java.lang.String yPropertyName, Path path)

Constructs and returns an ObjectAnimator that animates coordinates along a Path using two properties. A Path animation moves in two dimensions, animating coordinates (x, y) together to follow the line. In this variation, the coordinates are floats that are set to separate properties designated by xPropertyName and yPropertyName.

Parameters:

target: The object whose properties are to be animated. This object should have public methods on it called setNameX() and setNameY, where nameX and nameY are the value of the xPropertyName and yPropertyName parameters, respectively.
xPropertyName: The name of the property for the x coordinate being animated.
yPropertyName: The name of the property for the y coordinate being animated.
path: The Path to animate values along.

Returns:

An ObjectAnimator object that is set up to animate along path.

public static ObjectAnimator ofFloat(java.lang.Object target, <any> property, float[] values[])

Constructs and returns an ObjectAnimator that animates between float values. A single value implies that that value is the one being animated to, in which case the start value will be derived from the property being animated and the target object when ObjectAnimator.start() is called for the first time. Two values imply starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Parameters:

target: The object whose property is to be animated.
property: The property being animated.
values: A set of values that the animation will animate between over time.

Returns:

An ObjectAnimator object that is set up to animate between the given values.

public static ObjectAnimator ofFloat(java.lang.Object target, <any> xProperty, <any> yProperty, Path path)

Constructs and returns an ObjectAnimator that animates coordinates along a Path using two properties. A Path animation moves in two dimensions, animating coordinates (x, y) together to follow the line. In this variation, the coordinates are floats that are set to separate properties, xProperty and yProperty.

Parameters:

target: The object whose properties are to be animated.
xProperty: The property for the x coordinate being animated.
yProperty: The property for the y coordinate being animated.
path: The Path to animate values along.

Returns:

An ObjectAnimator object that is set up to animate along path.

public static ObjectAnimator ofMultiFloat(java.lang.Object target, java.lang.String propertyName, float[][] values[][])

Constructs and returns an ObjectAnimator that animates over float values for a multiple parameters setter. Only public methods that take only float parameters are supported. Each float[] contains a complete set of parameters to the setter method. At least two float[] values must be provided, a start and end. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Parameters:

target: The object whose property is to be animated. This object may have a public method on it called setName(), where name is the value of the propertyName parameter. propertyName may also be the case-sensitive complete name of the public setter method.
propertyName: The name of the property being animated or the name of the setter method.
values: A set of values that the animation will animate between over time.

Returns:

An ObjectAnimator object that is set up to animate between the given values.

public static ObjectAnimator ofMultiFloat(java.lang.Object target, java.lang.String propertyName, Path path)

Constructs and returns an ObjectAnimator that animates the target using a multi-float setter along the given Path. A Path animation moves in two dimensions, animating coordinates (x, y) together to follow the line. In this variation, the coordinates are float x and y coordinates used in the first and second parameter of the setter, respectively.

Parameters:

target: The object whose property is to be animated. This object may have a public method on it called setName(), where name is the value of the propertyName parameter. propertyName may also be the case-sensitive complete name of the public setter method.
propertyName: The name of the property being animated or the name of the setter method.
path: The Path to animate values along.

Returns:

An ObjectAnimator object that is set up to animate along path.

public static ObjectAnimator ofMultiFloat(java.lang.Object target, java.lang.String propertyName, TypeConverter<java.lang.Object, UnknownReference> converter, TypeEvaluator<java.lang.Object> evaluator, java.lang.Object values[])

Constructs and returns an ObjectAnimator that animates over values for a multiple float parameters setter. Only public methods that take only float parameters are supported.

At least two values must be provided, a start and end. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Parameters:

target: The object whose property is to be animated. This object may have a public method on it called setName(), where name is the value of the propertyName parameter. propertyName may also be the case-sensitive complete name of the public setter method.
propertyName: The name of the property being animated or the name of the setter method.
converter: Converts T objects into float parameters for the multi-value setter.
evaluator: A TypeEvaluator that will be called on each animation frame to provide the necessary interpolation between the Object values to derive the animated value.
values: A set of values that the animation will animate between over time.

Returns:

An ObjectAnimator object that is set up to animate between the given values.

public static ObjectAnimator ofObject(java.lang.Object target, java.lang.String propertyName, TypeEvaluator evaluator, java.lang.Object values[])

Constructs and returns an ObjectAnimator that animates between Object values. A single value implies that that value is the one being animated to, in which case the start value will be derived from the property being animated and the target object when ObjectAnimator.start() is called for the first time. Two values imply starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Note: The values are stored as references to the original objects, which means that changes to those objects after this method is called will affect the values on the animator. If the objects will be mutated externally after this method is called, callers should pass a copy of those objects instead.

Parameters:

target: The object whose property is to be animated. This object should have a public method on it called setName(), where name is the value of the propertyName parameter.
propertyName: The name of the property being animated.
evaluator: A TypeEvaluator that will be called on each animation frame to provide the necessary interpolation between the Object values to derive the animated value.
values: A set of values that the animation will animate between over time.

Returns:

An ObjectAnimator object that is set up to animate between the given values.

public static ObjectAnimator ofObject(java.lang.Object target, java.lang.String propertyName, TypeConverter<PointF, java.lang.Object> converter, Path path)

Constructs and returns an ObjectAnimator that animates a property along a Path. A Path animation moves in two dimensions, animating coordinates (x, y) together to follow the line. This variant animates the coordinates in a PointF to follow the Path. If the Property associated with propertyName uses a type other than PointF, converter can be used to change from PointF to the type associated with the Property.

Parameters:

target: The object whose property is to be animated. This object should have a public method on it called setName(), where name is the value of the propertyName parameter.
propertyName: The name of the property being animated.
converter: Converts a PointF to the type associated with the setter. May be null if conversion is unnecessary.
path: The Path to animate values along.

Returns:

An ObjectAnimator object that is set up to animate along path.

public static ObjectAnimator ofObject(java.lang.Object target, <any> property, TypeEvaluator<java.lang.Object> evaluator, java.lang.Object values[])

Constructs and returns an ObjectAnimator that animates between Object values. A single value implies that that value is the one being animated to, in which case the start value will be derived from the property being animated and the target object when ObjectAnimator.start() is called for the first time. Two values imply starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation).

Note: The values are stored as references to the original objects, which means that changes to those objects after this method is called will affect the values on the animator. If the objects will be mutated externally after this method is called, callers should pass a copy of those objects instead.

Parameters:

target: The object whose property is to be animated.
property: The property being animated.
evaluator: A TypeEvaluator that will be called on each animation frame to provide the necessary interpolation between the Object values to derive the animated value.
values: A set of values that the animation will animate between over time.

Returns:

An ObjectAnimator object that is set up to animate between the given values.

public static ObjectAnimator ofObject(java.lang.Object target, <any> property, TypeConverter<java.lang.Object, java.lang.Object> converter, TypeEvaluator<java.lang.Object> evaluator, java.lang.Object values[])

Constructs and returns an ObjectAnimator that animates between Object values. A single value implies that that value is the one being animated to, in which case the start value will be derived from the property being animated and the target object when ObjectAnimator.start() is called for the first time. Two values imply starting and ending values. More than two values imply a starting value, values to animate through along the way, and an ending value (these values will be distributed evenly across the duration of the animation). This variant supplies a TypeConverter to convert from the animated values to the type of the property. If only one value is supplied, the TypeConverter must be a BidirectionalTypeConverter to retrieve the current value.

Note: The values are stored as references to the original objects, which means that changes to those objects after this method is called will affect the values on the animator. If the objects will be mutated externally after this method is called, callers should pass a copy of those objects instead.

Parameters:

target: The object whose property is to be animated.
property: The property being animated.
converter: Converts the animated object to the Property type.
evaluator: A TypeEvaluator that will be called on each animation frame to provide the necessary interpolation between the Object values to derive the animated value.
values: A set of values that the animation will animate between over time.

Returns:

An ObjectAnimator object that is set up to animate between the given values.

public static ObjectAnimator ofObject(java.lang.Object target, <any> property, TypeConverter<PointF, java.lang.Object> converter, Path path)

Constructs and returns an ObjectAnimator that animates a property along a Path. A Path animation moves in two dimensions, animating coordinates (x, y) together to follow the line. This variant animates the coordinates in a PointF to follow the Path. If property uses a type other than PointF, converter can be used to change from PointF to the type associated with the Property.

The PointF passed to converter or property, if converter is null, is reused on each animation frame and should not be stored by the setter or TypeConverter.

Parameters:

target: The object whose property is to be animated.
property: The property being animated. Should not be null.
converter: Converts a PointF to the type associated with the setter. May be null if conversion is unnecessary.
path: The Path to animate values along.

Returns:

An ObjectAnimator object that is set up to animate along path.

public static ObjectAnimator ofPropertyValuesHolder(java.lang.Object target, PropertyValuesHolder values[])

Constructs and returns an ObjectAnimator that animates between the sets of values specified in PropertyValueHolder objects. This variant should be used when animating several properties at once with the same ObjectAnimator, since PropertyValuesHolder allows you to associate a set of animation values with a property name.

Parameters:

target: The object whose property is to be animated. Depending on how the PropertyValuesObjects were constructed, the target object should either have the objects used to construct the PropertyValuesHolder objects or (if the PropertyValuesHOlder objects were created with property names) the target object should have public methods on it called setName(), where name is the name of the property passed in as the propertyName parameter for each of the PropertyValuesHolder objects.
values: A set of PropertyValuesHolder objects whose values will be animated between over time.

Returns:

An ObjectAnimator object that is set up to animate between the given values.

public void setIntValues(int[] values[])

Sets int values that will be animated between. A single value implies that that value is the one being animated to. However, this is not typically useful in a ValueAnimator object because there is no way for the object to determine the starting value for the animation (unlike ObjectAnimator, which can derive that value from the target object and property being animated). Therefore, there should typically be two or more values.

If there are already multiple sets of values defined for this ValueAnimator via more than one PropertyValuesHolder object, this method will set the values for the first of those objects.

Parameters:

values: A set of values that the animation will animate between over time.

public void setFloatValues(float[] values[])

Sets float values that will be animated between. A single value implies that that value is the one being animated to. However, this is not typically useful in a ValueAnimator object because there is no way for the object to determine the starting value for the animation (unlike ObjectAnimator, which can derive that value from the target object and property being animated). Therefore, there should typically be two or more values.

If there are already multiple sets of values defined for this ValueAnimator via more than one PropertyValuesHolder object, this method will set the values for the first of those objects.

Parameters:

values: A set of values that the animation will animate between over time.

public void setObjectValues(java.lang.Object values[])

Sets the values to animate between for this animation. A single value implies that that value is the one being animated to. However, this is not typically useful in a ValueAnimator object because there is no way for the object to determine the starting value for the animation (unlike ObjectAnimator, which can derive that value from the target object and property being animated). Therefore, there should typically be two or more values.

Note: The Object values are stored as references to the original objects, which means that changes to those objects after this method is called will affect the values on the animator. If the objects will be mutated externally after this method is called, callers should pass a copy of those objects instead.

If there are already multiple sets of values defined for this ValueAnimator via more than one PropertyValuesHolder object, this method will set the values for the first of those objects.

There should be a TypeEvaluator set on the ValueAnimator that knows how to interpolate between these value objects. ValueAnimator only knows how to interpolate between the primitive types specified in the other setValues() methods.

Parameters:

values: The set of values to animate between.

public void setAutoCancel(boolean cancel)

autoCancel controls whether an ObjectAnimator will be canceled automatically when any other ObjectAnimator with the same target and properties is started. Setting this flag may make it easier to run different animators on the same target object without having to keep track of whether there are conflicting animators that need to be manually canceled. Canceling animators must have the same exact set of target properties, in the same order.

Parameters:

cancel: Whether future ObjectAnimators with the same target and properties as this ObjectAnimator will cause this ObjectAnimator to be canceled.

public void start()

Starts this animation. If the animation has a nonzero startDelay, the animation will start running after that delay elapses. A non-delayed animation will have its initial value(s) set immediately, followed by calls to Animator.AnimatorListener.onAnimationStart(Animator) for any listeners of this animator.

The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.

public ObjectAnimator setDuration(long duration)

Sets the length of the animation. The default duration is 300 milliseconds.

Parameters:

duration: The length of the animation, in milliseconds.

Returns:

ObjectAnimator The object called with setDuration(). This return value makes it easier to compose statements together that construct and then set the duration, as in ObjectAnimator.ofInt(target, propertyName, 0, 10).setDuration(500).start().

public java.lang.Object getTarget()

The target object whose property will be animated by this animation

Returns:

The object being animated

public void setTarget(java.lang.Object target)

Sets the target object whose property will be animated by this animation. Not all subclasses operate on target objects (for example, ValueAnimator, but this method is on the superclass for the convenience of dealing generically with those subclasses that do handle targets.

Note: The target is stored as a weak reference internally to avoid leaking resources by having animators directly reference old targets. Therefore, you should ensure that animator targets always have a hard reference elsewhere.

Parameters:

target: The object being animated

public void setupStartValues()

This method tells the object to use appropriate information to extract starting values for the animation. For example, a AnimatorSet object will pass this call to its child objects to tell them to set up the values. A ObjectAnimator object will use the information it has about its target object and PropertyValuesHolder objects to get the start values for its properties. A ValueAnimator object will ignore the request since it does not have enough information (such as a target object) to gather these values.

public void setupEndValues()

This method tells the object to use appropriate information to extract ending values for the animation. For example, a AnimatorSet object will pass this call to its child objects to tell them to set up the values. A ObjectAnimator object will use the information it has about its target object and PropertyValuesHolder objects to get the start values for its properties. A ValueAnimator object will ignore the request since it does not have enough information (such as a target object) to gather these values.

public ObjectAnimator clone()

public java.lang.String toString()

Source

/*
 * Copyright 2018 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 androidx.core.animation;

import android.annotation.SuppressLint;
import android.graphics.Path;
import android.graphics.PointF;
import android.util.Log;
import android.util.Property;

import androidx.annotation.CallSuper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import java.lang.ref.WeakReference;

/**
 * This subclass of {@link ValueAnimator} provides support for animating properties on target
 * objects. The constructors of this class take parameters to define the target object that will be
 * animated as well as the name of the property that will be animated. Appropriate set/get functions
 * are then determined internally and the animation will call these functions as necessary to
 * animate the property.
 *
 * <p>ObjectAnimator supports the use of {@link PropertyValuesHolder} and {@link Keyframe} in
 * resource files to create more complex animations. Using PropertyValuesHolders allows animators to
 * animate several properties in parallel.</p>
 *
 * <p>Using Keyframes allows animations to follow more complex paths from the start
 * to the end values. Note that you can specify explicit fractional values (from 0 to 1) for
 * each keyframe to determine when, in the overall duration, the animation should arrive at that
 * value. Alternatively, you can leave the fractions off and the keyframes will be equally
 * distributed within the total duration. Also, a keyframe with no value will derive its value
 * from the target object when the animator starts, just like animators with only one
 * value specified. In addition, an optional interpolator can be specified. The interpolator will
 * be applied on the interval between the keyframe that the interpolator is set on and the previous
 * keyframe. When no interpolator is supplied, the default {@link AccelerateDecelerateInterpolator}
 * will be used. </p>
 *
 * <div class="special reference">
 * <h3>Developer Guides</h3>
 * <p>For more information about animating with {@code ObjectAnimator}, read the
 * <a href="{@docRoot}guide/topics/graphics/prop-animation.html#object-animator">Property
 * Animation</a> developer guide.</p>
 * </div>
 *
 * @see #setPropertyName(String)
 *
 */
@SuppressWarnings("unchecked")
public final class ObjectAnimator extends ValueAnimator {
    private static final String LOG_TAG = "ObjectAnimator";

    private static final boolean DBG = false;

    /**
     * A weak reference to the target object on which the property exists, set
     * in the constructor. We'll cancel the animation if this goes away.
     */
    private WeakReference<Object> mTarget;

    private String mPropertyName;

    private Property mProperty;

    private boolean mAutoCancel = false;

    /**
     * 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>
     *
     * <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>
     *
     * <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.</p>
     *
     * @param propertyName The name of the property being animated. Should not be null.
     */
    public void setPropertyName(@NonNull 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;
    }

    /**
     * Sets the property that will be animated. Property objects will take precedence over
     * properties specified by the {@link #setPropertyName(String)} method. Animations should
     * be set up to use one or the other, not both.
     *
     * @param property The property being animated. Should not be null.
     */
    public void setProperty(@NonNull Property property) {
        // 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.setProperty(property);
            mValuesMap.remove(oldName);
            mValuesMap.put(mPropertyName, valuesHolder);
        }
        if (mProperty != null) {
            mPropertyName = property.getName();
        }
        mProperty = property;
        // New property/values/target should cause re-initialization prior to starting
        mInitialized = false;
    }

    /**
     * Gets the name of the property that will be animated. This name will be 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>If this animator was created with a {@link Property} object instead of the
     * string name of a property, then this method will return the {@link
     * Property#getName() name} of that Property object instead. If this animator was
     * created with one or more {@link PropertyValuesHolder} objects, then this method
     * will return the {@link PropertyValuesHolder#getPropertyName() name} of that
     * object (if there was just one) or a comma-separated list of all of the
     * names (if there are more than one).</p>
     */
    @NonNull
    public String getPropertyName() {
        String propertyName = null;
        if (mPropertyName != null) {
            propertyName = mPropertyName;
        } else if (mProperty != null) {
            propertyName = mProperty.getName();
        } else if (mValues != null && mValues.length > 0) {
            for (int i = 0; i < mValues.length; ++i) {
                if (i == 0) {
                    propertyName = "";
                } else {
                    propertyName += ",";
                }
                propertyName += mValues[i].getPropertyName();
            }
        }
        return propertyName;
    }

    @Override
    @NonNull
    public String getNameForTrace() {
        return mAnimTraceName == null ? "animator:" + getPropertyName() : mAnimTraceName;
    }

    /**
     * Creates a new ObjectAnimator object. This default constructor is primarily for
     * use internally; the other constructors which take parameters are more generally
     * useful.
     */
    public ObjectAnimator() {
    }

    /**
     * Private utility constructor that initializes the target object and name of the
     * property being animated.
     *
     * @param target The object whose property is to be animated. This object should
     * have a public method on it called <code>setName()</code>, where <code>name</code> is
     * the value of the <code>propertyName</code> parameter.
     * @param propertyName The name of the property being animated.
     */
    private ObjectAnimator(Object target, String propertyName) {
        setTarget(target);
        setPropertyName(propertyName);
    }

    /**
     * Private utility constructor that initializes the target object and property being animated.
     *
     * @param target The object whose property is to be animated.
     * @param property The property being animated.
     */
    private <T> ObjectAnimator(T target, Property<T, ?> property) {
        setTarget(target);
        setProperty(property);
    }

    /**
     * Constructs and returns an ObjectAnimator that animates between int values. A single
     * value implies that that value is the one being animated to, in which case the start value
     * will be derived from the property being animated and the target object when {@link #start()}
     * is called for the first time. Two values imply starting and ending values. More than two
     * values imply a starting value, values to animate through along the way, and an ending value
     * (these values will be distributed evenly across the duration of the animation).
     *
     * @param target The object whose property is to be animated. This object should
     * have a public method on it called <code>setName()</code>, where <code>name</code> is
     * the value of the <code>propertyName</code> parameter.
     * @param propertyName The name of the property being animated.
     * @param values A set of values that the animation will animate between over time.
     * @return An ObjectAnimator object that is set up to animate between the given values.
     */
    @NonNull
    public static ObjectAnimator ofInt(@NonNull Object target, @NonNull String propertyName,
            @NonNull int... values) {
        ObjectAnimator anim = new ObjectAnimator(target, propertyName);
        anim.setIntValues(values);
        return anim;
    }

    /**
     * Constructs and returns an ObjectAnimator that animates coordinates along a <code>Path</code>
     * using two properties. A <code>Path</code></> animation moves in two dimensions, animating
     * coordinates <code>(x, y)</code> together to follow the line. In this variation, the
     * coordinates are integers that are set to separate properties designated by
     * <code>xPropertyName</code> and <code>yPropertyName</code>.
     *
     * @param target The object whose properties are to be animated. This object should
     *               have public methods on it called <code>setNameX()</code> and
     *               <code>setNameY</code>, where <code>nameX</code> and <code>nameY</code>
     *               are the value of <code>xPropertyName</code> and <code>yPropertyName</code>
     *               parameters, respectively.
     * @param xPropertyName The name of the property for the x coordinate being animated.
     * @param yPropertyName The name of the property for the y coordinate being animated.
     * @param path The <code>Path</code> to animate values along.
     * @return An ObjectAnimator object that is set up to animate along <code>path</code>.
     */
    @NonNull
    public static ObjectAnimator ofInt(@NonNull Object target, @NonNull String xPropertyName,
            @NonNull String yPropertyName, @NonNull Path path) {
        PathKeyframes keyframes = KeyframeSet.ofPath(path);
        PropertyValuesHolder x = PropertyValuesHolder.ofKeyframes(xPropertyName,
                keyframes.createXIntKeyframes());
        PropertyValuesHolder y = PropertyValuesHolder.ofKeyframes(yPropertyName,
                keyframes.createYIntKeyframes());
        return ofPropertyValuesHolder(target, x, y);
    }

    /**
     * Constructs and returns an ObjectAnimator that animates between int values. A single
     * value implies that that value is the one being animated to, in which case the start value
     * will be derived from the property being animated and the target object when {@link #start()}
     * is called for the first time. Two values imply starting and ending values. More than two
     * values imply a starting value, values to animate through along the way, and an ending value
     * (these values will be distributed evenly across the duration of the animation).
     *
     * @param target The object whose property is to be animated.
     * @param property The property being animated.
     * @param values A set of values that the animation will animate between over time.
     * @return An ObjectAnimator object that is set up to animate between the given values.
     */
    @NonNull
    public static <T> ObjectAnimator ofInt(@NonNull T target,
            @NonNull Property<T, Integer> property, @NonNull int... values) {
        ObjectAnimator anim = new ObjectAnimator(target, property);
        anim.setIntValues(values);
        return anim;
    }

    /**
     * Constructs and returns an ObjectAnimator that animates coordinates along a <code>Path</code>
     * using two properties.  A <code>Path</code></> animation moves in two dimensions, animating
     * coordinates <code>(x, y)</code> together to follow the line. In this variation, the
     * coordinates are integers that are set to separate properties, <code>xProperty</code> and
     * <code>yProperty</code>.
     *
     * @param target The object whose properties are to be animated.
     * @param xProperty The property for the x coordinate being animated.
     * @param yProperty The property for the y coordinate being animated.
     * @param path The <code>Path</code> to animate values along.
     * @return An ObjectAnimator object that is set up to animate along <code>path</code>.
     */
    @NonNull
    public static <T> ObjectAnimator ofInt(@NonNull T target,
            @Nullable Property<T, Integer> xProperty, @Nullable Property<T, Integer> yProperty,
            @NonNull Path path) {
        PathKeyframes keyframes = KeyframeSet.ofPath(path);
        PropertyValuesHolder x = PropertyValuesHolder.ofKeyframes(xProperty,
                keyframes.createXIntKeyframes());
        PropertyValuesHolder y = PropertyValuesHolder.ofKeyframes(yProperty,
                keyframes.createYIntKeyframes());
        return ofPropertyValuesHolder(target, x, y);
    }

    /**
     * Constructs and returns an ObjectAnimator that animates over int values for a multiple
     * parameters setter. Only public methods that take only int parameters are supported.
     * Each <code>int[]</code> contains a complete set of parameters to the setter method.
     * At least two <code>int[]</code> values must be provided, a start and end. More than two
     * values imply a starting value, values to animate through along the way, and an ending
     * value (these values will be distributed evenly across the duration of the animation).
     *
     * @param target The object whose property is to be animated. This object may
     * have a public method on it called <code>setName()</code>, where <code>name</code> is
     * the value of the <code>propertyName</code> parameter. <code>propertyName</code> may also
     * be the case-sensitive complete name of the public setter method.
     * @param propertyName The name of the property being animated or the name of the setter method.
     * @param values A set of values that the animation will animate between over time.
     * @return An ObjectAnimator object that is set up to animate between the given values.
     */
    @NonNull
    public static ObjectAnimator ofMultiInt(
            @NonNull Object target,
            @NonNull String propertyName,
            @SuppressLint("ArrayReturn") /* Platform API */ @NonNull int[][] values
    ) {
        PropertyValuesHolder pvh = PropertyValuesHolder.ofMultiInt(propertyName, values);
        return ofPropertyValuesHolder(target, pvh);
    }

    /**
     * Constructs and returns an ObjectAnimator that animates the target using a multi-int setter
     * along the given <code>Path</code>. A <code>Path</code></> animation moves in two dimensions,
     * animating coordinates <code>(x, y)</code> together to follow the line. In this variation, the
     * coordinates are integer x and y coordinates used in the first and second parameter of the
     * setter, respectively.
     *
     * @param target The object whose property is to be animated. This object may
     * have a public method on it called <code>setName()</code>, where <code>name</code> is
     * the value of the <code>propertyName</code> parameter. <code>propertyName</code> may also
     * be the case-sensitive complete name of the public setter method.
     * @param propertyName The name of the property being animated or the name of the setter method.
     * @param path The <code>Path</code> to animate values along.
     * @return An ObjectAnimator object that is set up to animate along <code>path</code>.
     */
    @NonNull
    public static ObjectAnimator ofMultiInt(@NonNull Object target, @NonNull String propertyName,
            @NonNull Path path) {
        PropertyValuesHolder pvh = PropertyValuesHolder.ofMultiInt(propertyName, path);
        return ofPropertyValuesHolder(target, pvh);
    }

    /**
     * Constructs and returns an ObjectAnimator that animates over values for a multiple int
     * parameters setter. Only public methods that take only int parameters are supported.
     * <p>At least two values must be provided, a start and end. More than two
     * values imply a starting value, values to animate through along the way, and an ending
     * value (these values will be distributed evenly across the duration of the animation).</p>
     *
     * @param target The object whose property is to be animated. This object may
     * have a public method on it called <code>setName()</code>, where <code>name</code> is
     * the value of the <code>propertyName</code> parameter. <code>propertyName</code> may also
     * be the case-sensitive complete name of the public setter method.
     * @param propertyName The name of the property being animated or the name of the setter method.
     * @param converter Converts T objects into int parameters for the multi-value setter.
     * @param evaluator A TypeEvaluator that will be called on each animation frame to
     * provide the necessary interpolation between the Object values to derive the animated
     * value.
     * @param values A set of values that the animation will animate between over time.
     * @return An ObjectAnimator object that is set up to animate between the given values.
     */
    @SafeVarargs
    @NonNull
    public static <T> ObjectAnimator ofMultiInt(@NonNull Object target,
            @NonNull String propertyName, @NonNull TypeConverter<T, int[]> converter,
            @NonNull TypeEvaluator<T> evaluator, @NonNull T... values) {
        PropertyValuesHolder pvh = PropertyValuesHolder.ofMultiInt(propertyName, converter,
                evaluator, values);
        return ObjectAnimator.ofPropertyValuesHolder(target, pvh);
    }

    /**
     * Constructs and returns an ObjectAnimator that animates between color values. A single
     * value implies that that value is the one being animated to, in which case the start value
     * will be derived from the property being animated and the target object when {@link #start()}
     * is called for the first time. Two values imply starting and ending values. More than two
     * values imply a starting value, values to animate through along the way, and an ending value
     * (these values will be distributed evenly across the duration of the animation).
     *
     * @param target The object whose property is to be animated. This object should
     * have a public method on it called <code>setName()</code>, where <code>name</code> is
     * the value of the <code>propertyName</code> parameter.
     * @param propertyName The name of the property being animated.
     * @param values A set of values that the animation will animate between over time.
     * @return An ObjectAnimator object that is set up to animate between the given values.
     */
    @NonNull
    public static ObjectAnimator ofArgb(@NonNull Object target, @NonNull String propertyName,
            @NonNull int... values) {
        ObjectAnimator animator = ofInt(target, propertyName, values);
        animator.setEvaluator(ArgbEvaluator.getInstance());
        return animator;
    }

    /**
     * Constructs and returns an ObjectAnimator that animates between color values. A single
     * value implies that that value is the one being animated to, in which case the start value
     * will be derived from the property being animated and the target object when {@link #start()}
     * is called for the first time. Two values imply starting and ending values. More than two
     * values imply a starting value, values to animate through along the way, and an ending value
     * (these values will be distributed evenly across the duration of the animation).
     *
     * @param target The object whose property is to be animated.
     * @param property The property being animated.
     * @param values A set of values that the animation will animate between over time.
     * @return An ObjectAnimator object that is set up to animate between the given values.
     */
    @NonNull
    public static <T> ObjectAnimator ofArgb(@NonNull T target,
            @NonNull Property<T, Integer> property, @NonNull int... values) {
        ObjectAnimator animator = ofInt(target, property, values);
        animator.setEvaluator(ArgbEvaluator.getInstance());
        return animator;
    }

    /**
     * Constructs and returns an ObjectAnimator that animates between float values. A single
     * value implies that that value is the one being animated to, in which case the start value
     * will be derived from the property being animated and the target object when {@link #start()}
     * is called for the first time. Two values imply starting and ending values. More than two
     * values imply a starting value, values to animate through along the way, and an ending value
     * (these values will be distributed evenly across the duration of the animation).
     *
     * @param target The object whose property is to be animated. This object should
     * have a public method on it called <code>setName()</code>, where <code>name</code> is
     * the value of the <code>propertyName</code> parameter.
     * @param propertyName The name of the property being animated.
     * @param values A set of values that the animation will animate between over time.
     * @return An ObjectAnimator object that is set up to animate between the given values.
     */
    @NonNull
    public static ObjectAnimator ofFloat(@NonNull Object target, @NonNull String propertyName,
            @NonNull float... values) {
        ObjectAnimator anim = new ObjectAnimator(target, propertyName);
        anim.setFloatValues(values);
        return anim;
    }

    /**
     * Constructs and returns an ObjectAnimator that animates coordinates along a <code>Path</code>
     * using two properties. A <code>Path</code></> animation moves in two dimensions, animating
     * coordinates <code>(x, y)</code> together to follow the line. In this variation, the
     * coordinates are floats that are set to separate properties designated by
     * <code>xPropertyName</code> and <code>yPropertyName</code>.
     *
     * @param target The object whose properties are to be animated. This object should
     *               have public methods on it called <code>setNameX()</code> and
     *               <code>setNameY</code>, where <code>nameX</code> and <code>nameY</code>
     *               are the value of the <code>xPropertyName</code> and <code>yPropertyName</code>
     *               parameters, respectively.
     * @param xPropertyName The name of the property for the x coordinate being animated.
     * @param yPropertyName The name of the property for the y coordinate being animated.
     * @param path The <code>Path</code> to animate values along.
     * @return An ObjectAnimator object that is set up to animate along <code>path</code>.
     */
    @NonNull
    public static ObjectAnimator ofFloat(@NonNull Object target, @Nullable String xPropertyName,
            @Nullable String yPropertyName, @NonNull Path path) {
        PathKeyframes keyframes = KeyframeSet.ofPath(path);
        PropertyValuesHolder x = PropertyValuesHolder.ofKeyframes(xPropertyName,
                keyframes.createXFloatKeyframes());
        PropertyValuesHolder y = PropertyValuesHolder.ofKeyframes(yPropertyName,
                keyframes.createYFloatKeyframes());
        return ofPropertyValuesHolder(target, x, y);
    }

    /**
     * Constructs and returns an ObjectAnimator that animates between float values. A single
     * value implies that that value is the one being animated to, in which case the start value
     * will be derived from the property being animated and the target object when {@link #start()}
     * is called for the first time. Two values imply starting and ending values. More than two
     * values imply a starting value, values to animate through along the way, and an ending value
     * (these values will be distributed evenly across the duration of the animation).
     *
     * @param target The object whose property is to be animated.
     * @param property The property being animated.
     * @param values A set of values that the animation will animate between over time.
     * @return An ObjectAnimator object that is set up to animate between the given values.
     */
    @NonNull
    public static <T> ObjectAnimator ofFloat(@NonNull T target,
            @NonNull Property<T, Float> property, @NonNull float... values) {
        ObjectAnimator anim = new ObjectAnimator(target, property);
        anim.setFloatValues(values);
        return anim;
    }

    /**
     * Constructs and returns an ObjectAnimator that animates coordinates along a <code>Path</code>
     * using two properties. A <code>Path</code></> animation moves in two dimensions, animating
     * coordinates <code>(x, y)</code> together to follow the line. In this variation, the
     * coordinates are floats that are set to separate properties, <code>xProperty</code> and
     * <code>yProperty</code>.
     *
     * @param target The object whose properties are to be animated.
     * @param xProperty The property for the x coordinate being animated.
     * @param yProperty The property for the y coordinate being animated.
     * @param path The <code>Path</code> to animate values along.
     * @return An ObjectAnimator object that is set up to animate along <code>path</code>.
     */
    @NonNull
    public static <T> ObjectAnimator ofFloat(@NonNull T target,
            @Nullable Property<T, Float> xProperty, @Nullable Property<T, Float> yProperty,
            @NonNull Path path) {
        PathKeyframes keyframes = KeyframeSet.ofPath(path);
        PropertyValuesHolder x = PropertyValuesHolder.ofKeyframes(xProperty,
                keyframes.createXFloatKeyframes());
        PropertyValuesHolder y = PropertyValuesHolder.ofKeyframes(yProperty,
                keyframes.createYFloatKeyframes());
        return ofPropertyValuesHolder(target, x, y);
    }

    /**
     * Constructs and returns an ObjectAnimator that animates over float values for a multiple
     * parameters setter. Only public methods that take only float parameters are supported.
     * Each <code>float[]</code> contains a complete set of parameters to the setter method.
     * At least two <code>float[]</code> values must be provided, a start and end. More than two
     * values imply a starting value, values to animate through along the way, and an ending
     * value (these values will be distributed evenly across the duration of the animation).
     *
     * @param target The object whose property is to be animated. This object may
     * have a public method on it called <code>setName()</code>, where <code>name</code> is
     * the value of the <code>propertyName</code> parameter. <code>propertyName</code> may also
     * be the case-sensitive complete name of the public setter method.
     * @param propertyName The name of the property being animated or the name of the setter method.
     * @param values A set of values that the animation will animate between over time.
     * @return An ObjectAnimator object that is set up to animate between the given values.
     */
    @NonNull
    public static ObjectAnimator ofMultiFloat(
            @NonNull Object target,
            @NonNull String propertyName,
            @SuppressLint("ArrayReturn") /* Platform API */ @NonNull float[][] values
    ) {
        PropertyValuesHolder pvh = PropertyValuesHolder.ofMultiFloat(propertyName, values);
        return ofPropertyValuesHolder(target, pvh);
    }

    /**
     * Constructs and returns an ObjectAnimator that animates the target using a multi-float setter
     * along the given <code>Path</code>. A <code>Path</code></> animation moves in two dimensions,
     * animating coordinates <code>(x, y)</code> together to follow the line. In this variation, the
     * coordinates are float x and y coordinates used in the first and second parameter of the
     * setter, respectively.
     *
     * @param target The object whose property is to be animated. This object may
     * have a public method on it called <code>setName()</code>, where <code>name</code> is
     * the value of the <code>propertyName</code> parameter. <code>propertyName</code> may also
     * be the case-sensitive complete name of the public setter method.
     * @param propertyName The name of the property being animated or the name of the setter method.
     * @param path The <code>Path</code> to animate values along.
     * @return An ObjectAnimator object that is set up to animate along <code>path</code>.
     */
    @NonNull
    public static ObjectAnimator ofMultiFloat(@NonNull Object target, @NonNull String propertyName,
            @NonNull Path path) {
        PropertyValuesHolder pvh = PropertyValuesHolder.ofMultiFloat(propertyName, path);
        return ofPropertyValuesHolder(target, pvh);
    }

    /**
     * Constructs and returns an ObjectAnimator that animates over values for a multiple float
     * parameters setter. Only public methods that take only float parameters are supported.
     * <p>At least two values must be provided, a start and end. More than two
     * values imply a starting value, values to animate through along the way, and an ending
     * value (these values will be distributed evenly across the duration of the animation).</p>
     *
     * @param target The object whose property is to be animated. This object may
     * have a public method on it called <code>setName()</code>, where <code>name</code> is
     * the value of the <code>propertyName</code> parameter. <code>propertyName</code> may also
     * be the case-sensitive complete name of the public setter method.
     * @param propertyName The name of the property being animated or the name of the setter method.
     * @param converter Converts T objects into float parameters for the multi-value setter.
     * @param evaluator A TypeEvaluator that will be called on each animation frame to
     * provide the necessary interpolation between the Object values to derive the animated
     * value.
     * @param values A set of values that the animation will animate between over time.
     * @return An ObjectAnimator object that is set up to animate between the given values.
     */
    @SafeVarargs
    @NonNull
    public static <T> ObjectAnimator ofMultiFloat(@NonNull Object target,
            @NonNull String propertyName, @NonNull TypeConverter<T, float[]> converter,
            @NonNull TypeEvaluator<T> evaluator, @NonNull T... values) {
        PropertyValuesHolder pvh = PropertyValuesHolder.ofMultiFloat(propertyName, converter,
                evaluator, values);
        return ObjectAnimator.ofPropertyValuesHolder(target, pvh);
    }

    /**
     * Constructs and returns an ObjectAnimator that animates between Object values. A single
     * value implies that that value is the one being animated to, in which case the start value
     * will be derived from the property being animated and the target object when {@link #start()}
     * is called for the first time. Two values imply starting and ending values. More than two
     * values imply a starting value, values to animate through along the way, and an ending value
     * (these values will be distributed evenly across the duration of the animation).
     *
     * <p><strong>Note:</strong> The values are stored as references to the original
     * objects, which means that changes to those objects after this method is called will
     * affect the values on the animator. If the objects will be mutated externally after
     * this method is called, callers should pass a copy of those objects instead.
     *
     * @param target The object whose property is to be animated. This object should
     * have a public method on it called <code>setName()</code>, where <code>name</code> is
     * the value of the <code>propertyName</code> parameter.
     * @param propertyName The name of the property being animated.
     * @param evaluator A TypeEvaluator that will be called on each animation frame to
     * provide the necessary interpolation between the Object values to derive the animated
     * value.
     * @param values A set of values that the animation will animate between over time.
     * @return An ObjectAnimator object that is set up to animate between the given values.
     */
    @NonNull
    public static ObjectAnimator ofObject(@NonNull Object target, @NonNull String propertyName,
            @NonNull TypeEvaluator evaluator, @NonNull Object... values) {
        ObjectAnimator anim = new ObjectAnimator(target, propertyName);
        anim.setObjectValues(values);
        anim.setEvaluator(evaluator);
        return anim;
    }

    /**
     * Constructs and returns an ObjectAnimator that animates a property along a <code>Path</code>.
     * A <code>Path</code></> animation moves in two dimensions, animating coordinates
     * <code>(x, y)</code> together to follow the line. This variant animates the coordinates
     * in a <code>PointF</code> to follow the <code>Path</code>. If the <code>Property</code>
     * associated with <code>propertyName</code> uses a type other than <code>PointF</code>,
     * <code>converter</code> can be used to change from <code>PointF</code> to the type
     * associated with the <code>Property</code>.
     *
     * @param target The object whose property is to be animated. This object should
     * have a public method on it called <code>setName()</code>, where <code>name</code> is
     * the value of the <code>propertyName</code> parameter.
     * @param propertyName The name of the property being animated.
     * @param converter Converts a PointF to the type associated with the setter. May be
     *                  null if conversion is unnecessary.
     * @param path The <code>Path</code> to animate values along.
     * @return An ObjectAnimator object that is set up to animate along <code>path</code>.
     */
    @NonNull
    public static ObjectAnimator ofObject(@NonNull Object target, @NonNull String propertyName,
            @Nullable TypeConverter<PointF, ?> converter, @NonNull Path path) {
        PropertyValuesHolder pvh = PropertyValuesHolder.ofObject(propertyName, converter, path);
        return ofPropertyValuesHolder(target, pvh);
    }

    /**
     * Constructs and returns an ObjectAnimator that animates between Object values. A single
     * value implies that that value is the one being animated to, in which case the start value
     * will be derived from the property being animated and the target object when {@link #start()}
     * is called for the first time. Two values imply starting and ending values. More than two
     * values imply a starting value, values to animate through along the way, and an ending value
     * (these values will be distributed evenly across the duration of the animation).
     *
     * <p><strong>Note:</strong> The values are stored as references to the original
     * objects, which means that changes to those objects after this method is called will
     * affect the values on the animator. If the objects will be mutated externally after
     * this method is called, callers should pass a copy of those objects instead.
     *
     * @param target The object whose property is to be animated.
     * @param property The property being animated.
     * @param evaluator A TypeEvaluator that will be called on each animation frame to
     * provide the necessary interpolation between the Object values to derive the animated
     * value.
     * @param values A set of values that the animation will animate between over time.
     * @return An ObjectAnimator object that is set up to animate between the given values.
     */
    @NonNull
    @SafeVarargs
    public static <T, V> ObjectAnimator ofObject(@NonNull T target,
            @NonNull Property<T, V> property, @NonNull TypeEvaluator<V> evaluator,
            @NonNull V... values) {
        ObjectAnimator anim = new ObjectAnimator(target, property);
        anim.setObjectValues(values);
        anim.setEvaluator(evaluator);
        return anim;
    }

    /**
     * Constructs and returns an ObjectAnimator that animates between Object values. A single
     * value implies that that value is the one being animated to, in which case the start value
     * will be derived from the property being animated and the target object when {@link #start()}
     * is called for the first time. Two values imply starting and ending values. More than two
     * values imply a starting value, values to animate through along the way, and an ending value
     * (these values will be distributed evenly across the duration of the animation).
     * This variant supplies a <code>TypeConverter</code> to convert from the animated values to the
     * type of the property. If only one value is supplied, the <code>TypeConverter</code> must be a
     * {@link BidirectionalTypeConverter} to retrieve the current value.
     *
     * <p><strong>Note:</strong> The values are stored as references to the original
     * objects, which means that changes to those objects after this method is called will
     * affect the values on the animator. If the objects will be mutated externally after
     * this method is called, callers should pass a copy of those objects instead.
     *
     * @param target The object whose property is to be animated.
     * @param property The property being animated.
     * @param converter Converts the animated object to the Property type.
     * @param evaluator A TypeEvaluator that will be called on each animation frame to
     * provide the necessary interpolation between the Object values to derive the animated
     * value.
     * @param values A set of values that the animation will animate between over time.
     * @return An ObjectAnimator object that is set up to animate between the given values.
     */
    @NonNull
    @SafeVarargs
    public static <T, V, P> ObjectAnimator ofObject(@NonNull T target,
            @NonNull Property<T, P> property, @NonNull TypeConverter<V, P> converter,
            @NonNull TypeEvaluator<V> evaluator, @NonNull V... values) {
        PropertyValuesHolder pvh = PropertyValuesHolder.ofObject(property, converter, evaluator,
                values);
        return ofPropertyValuesHolder(target, pvh);
    }

    /**
     * Constructs and returns an ObjectAnimator that animates a property along a <code>Path</code>.
     * A <code>Path</code></> animation moves in two dimensions, animating coordinates
     * <code>(x, y)</code> together to follow the line. This variant animates the coordinates
     * in a <code>PointF</code> to follow the <code>Path</code>. If <code>property</code>
     * uses a type other than <code>PointF</code>, <code>converter</code> can be used to change
     * from <code>PointF</code> to the type associated with the <code>Property</code>.
     *
     * <p>The PointF passed to <code>converter</code> or <code>property</code>, if
     * <code>converter</code> is <code>null</code>, is reused on each animation frame and should
     * not be stored by the setter or TypeConverter.</p>
     *
     * @param target The object whose property is to be animated.
     * @param property The property being animated. Should not be null.
     * @param converter Converts a PointF to the type associated with the setter. May be
     *                  null if conversion is unnecessary.
     * @param path The <code>Path</code> to animate values along.
     * @return An ObjectAnimator object that is set up to animate along <code>path</code>.
     */
    @NonNull
    public static <T, V> ObjectAnimator ofObject(@NonNull T target,
            @NonNull Property<T, V> property, @Nullable TypeConverter<PointF, V> converter,
            @NonNull Path path) {
        PropertyValuesHolder pvh = PropertyValuesHolder.ofObject(property, converter, path);
        return ofPropertyValuesHolder(target, pvh);
    }

    /**
     * Constructs and returns an ObjectAnimator that animates between the sets of values specified
     * in <code>PropertyValueHolder</code> objects. This variant should be used when animating
     * several properties at once with the same ObjectAnimator, since PropertyValuesHolder allows
     * you to associate a set of animation values with a property name.
     *
     * @param target The object whose property is to be animated. Depending on how the
     * PropertyValuesObjects were constructed, the target object should either have the {@link
     * Property} objects used to construct the PropertyValuesHolder objects or (if the
     * PropertyValuesHOlder objects were created with property names) the target object should have
     * public methods on it called <code>setName()</code>, where <code>name</code> is the name of
     * the property passed in as the <code>propertyName</code> parameter for each of the
     * PropertyValuesHolder objects.
     * @param values A set of PropertyValuesHolder objects whose values will be animated between
     * over time.
     * @return An ObjectAnimator object that is set up to animate between the given values.
     */
    @NonNull
    public static ObjectAnimator ofPropertyValuesHolder(@NonNull Object target,
            @NonNull PropertyValuesHolder... values) {
        ObjectAnimator anim = new ObjectAnimator();
        anim.setTarget(target);
        anim.setValues(values);
        return anim;
    }

    @Override
    public void setIntValues(@NonNull int... values) {
        if (mValues == null || mValues.length == 0) {
            // No values yet - this animator is being constructed piecemeal. Init the values with
            // whatever the current propertyName is
            if (mProperty != null) {
                setValues(PropertyValuesHolder.ofInt(mProperty, values));
            } else {
                setValues(PropertyValuesHolder.ofInt(mPropertyName, values));
            }
        } else {
            super.setIntValues(values);
        }
    }

    @Override
    public void setFloatValues(@NonNull float... values) {
        if (mValues == null || mValues.length == 0) {
            // No values yet - this animator is being constructed piecemeal. Init the values with
            // whatever the current propertyName is
            if (mProperty != null) {
                setValues(PropertyValuesHolder.ofFloat(mProperty, values));
            } else {
                setValues(PropertyValuesHolder.ofFloat(mPropertyName, values));
            }
        } else {
            super.setFloatValues(values);
        }
    }

    @Override
    public void setObjectValues(@NonNull Object... values) {
        if (mValues == null || mValues.length == 0) {
            // No values yet - this animator is being constructed piecemeal. Init the values with
            // whatever the current propertyName is
            if (mProperty != null) {
                setValues(PropertyValuesHolder.ofObject(mProperty, (TypeEvaluator) null, values));
            } else {
                setValues(PropertyValuesHolder.ofObject(mPropertyName,
                        (TypeEvaluator) null, values));
            }
        } else {
            super.setObjectValues(values);
        }
    }

    /**
     * autoCancel controls whether an ObjectAnimator will be canceled automatically
     * when any other ObjectAnimator with the same target and properties is started.
     * Setting this flag may make it easier to run different animators on the same target
     * object without having to keep track of whether there are conflicting animators that
     * need to be manually canceled. Canceling animators must have the same exact set of
     * target properties, in the same order.
     *
     * @param cancel Whether future ObjectAnimators with the same target and properties
     * as this ObjectAnimator will cause this ObjectAnimator to be canceled.
     */
    public void setAutoCancel(boolean cancel) {
        mAutoCancel = cancel;
    }

    private boolean hasSameTargetAndProperties(@Nullable Animator anim) {
        if (anim instanceof ObjectAnimator) {
            PropertyValuesHolder[] theirValues = ((ObjectAnimator) anim).getValues();
            if (((ObjectAnimator) anim).getTarget() == getTarget()
                    && mValues.length == theirValues.length) {
                for (int i = 0; i < mValues.length; ++i) {
                    PropertyValuesHolder pvhMine = mValues[i];
                    PropertyValuesHolder pvhTheirs = theirValues[i];
                    if (pvhMine.getPropertyName() == null
                            || !pvhMine.getPropertyName().equals(pvhTheirs.getPropertyName())) {
                        return false;
                    }
                }
                return true;
            }
        }
        return false;
    }

    @Override
    public void start() {
        AnimationHandler.getInstance().autoCancelBasedOn(this);
        if (DBG) {
            Log.d(LOG_TAG, "Anim target, duration: " + getTarget() + ", " + getDuration());
            for (int i = 0; i < mValues.length; ++i) {
                PropertyValuesHolder pvh = mValues[i];
                Log.d(LOG_TAG, "   Values[" + i + "]: " + pvh.getPropertyName() + ", "
                        + pvh.mKeyframes.getValue(0) + ", "
                        + pvh.mKeyframes.getValue(1));
            }
        }
        super.start();
    }

    boolean shouldAutoCancel(AnimationHandler.AnimationFrameCallback anim) {
        if (anim == null) {
            return false;
        }

        if (anim instanceof ObjectAnimator) {
            ObjectAnimator objAnim = (ObjectAnimator) anim;
            if (objAnim.mAutoCancel && hasSameTargetAndProperties(objAnim)) {
                return true;
            }
        }
        return false;
    }

    /**
     * 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. This includes setting mEvaluator, if the user has not yet
     * set it up, and the setter/getter methods, if the user did not supply
     * them.
     *
     *  <p>Overriders of this method should call the superclass method to cause
     *  internal mechanisms to be set up correctly.</p>
     */
    @CallSuper
    @Override
    void initAnimation() {
        if (!mInitialized) {
            // mValueType may change due to setter/getter setup; do this before calling
            // super.init(), which uses mValueType to set up the default type evaluator.
            final Object target = getTarget();
            if (target != null) {
                final int numValues = mValues.length;
                for (int i = 0; i < numValues; ++i) {
                    mValues[i].setupSetterAndGetter(target);
                }
            }
            super.initAnimation();
        }
    }

    /**
     * Sets the length of the animation. The default duration is 300 milliseconds.
     *
     * @param duration The length of the animation, in milliseconds.
     * @return ObjectAnimator The object called with setDuration(). This return
     * value makes it easier to compose statements together that construct and then set the
     * duration, as in
     * <code>ObjectAnimator.ofInt(target, propertyName, 0, 10).setDuration(500).start()</code>.
     */
    @Override
    @NonNull
    public ObjectAnimator setDuration(long duration) {
        super.setDuration(duration);
        return this;
    }


    /**
     * The target object whose property will be animated by this animation
     *
     * @return The object being animated
     */
    @Nullable
    public Object getTarget() {
        return mTarget == null ? null : mTarget.get();
    }

    @Override
    public void setTarget(@Nullable Object target) {
        final Object oldTarget = getTarget();
        if (oldTarget != target) {
            if (isStarted()) {
                cancel();
            }
            mTarget = target == null ? null : new WeakReference<Object>(target);
            // New target should cause re-initialization prior to starting
            mInitialized = false;
        }
    }

    @Override
    public void setupStartValues() {
        initAnimation();

        final Object target = getTarget();
        if (target != null) {
            final int numValues = mValues.length;
            for (int i = 0; i < numValues; ++i) {
                mValues[i].setupStartValue(target);
            }
        }
    }

    @Override
    public void setupEndValues() {
        initAnimation();

        final Object target = getTarget();
        if (target != null) {
            final int numValues = mValues.length;
            for (int i = 0; i < numValues; ++i) {
                mValues[i].setupEndValue(target);
            }
        }
    }

    /**
     * This method is called with the elapsed fraction of the animation during every
     * animation frame. This function turns the elapsed fraction into an interpolated fraction
     * and then into an animated value (from the evaluator. The function is called mostly during
     * animation updates, but it is also called when the <code>end()</code>
     * function is called, to set the final value on the property.
     *
     * <p>Overrides of this method must call the superclass to perform the calculation
     * of the animated value.</p>
     *
     * @param fraction The elapsed fraction of the animation.
     */
    @CallSuper
    @Override
    void animateValue(float fraction) {
        final Object target = getTarget();
        if (mTarget != null && target == null) {
            // We lost the target reference, cancel and clean up. Note: we allow null target if the
            /// target has never been set.
            cancel();
            return;
        }

        super.animateValue(fraction);
        int numValues = mValues.length;
        for (int i = 0; i < numValues; ++i) {
            mValues[i].setAnimatedValue(target);
        }
    }

    @Override
    boolean isInitialized() {
        return mInitialized;
    }

    @SuppressLint("NoClone") /* Platform API */
    @NonNull
    @Override
    public ObjectAnimator clone() {
        final ObjectAnimator anim = (ObjectAnimator) super.clone();
        return anim;
    }

    @Override
    @NonNull
    public String toString() {
        String returnVal = "ObjectAnimator@" + Integer.toHexString(hashCode()) + ", target "
                + getTarget();
        if (mValues != null) {
            for (int i = 0; i < mValues.length; ++i) {
                returnVal += "\n    " + mValues[i].toString();
            }
        }
        return returnVal;
    }
}