AnimatorListeners
added to them.
*/
public abstract class Animator implements Cloneable {
/**
* The value used to indicate infinite duration (e.g. when Animators repeat infinitely).
*/
public static final long DURATION_INFINITE = -1;
/**
* The set of listeners to be sent events through the life of an animation.
*/
ArrayListThe 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 void start() { } /** * Cancels the animation. Unlike {@link #end()},cancel()
causes the animation to
* stop in its tracks, sending an
* {@link android.animation.Animator.AnimatorListener#onAnimationCancel(Animator)} to
* its listeners, followed by an
* {@link android.animation.Animator.AnimatorListener#onAnimationEnd(Animator)} message.
*
* This method must be called on the thread that is running the animation.
*/ public void cancel() { } /** * Ends the animation. This causes the animation to assign the end value of the property being * animated, then calling the * {@link android.animation.Animator.AnimatorListener#onAnimationEnd(Animator)} method on * its listeners. * *This method must be called on the thread that is running the animation.
*/ public void end() { } /** * Pauses a running animation. This method should only be called on the same thread on * which the animation was started. If the animation has not yet been {@link * #isStarted() started} or has since ended, then the call is ignored. Paused * animations can be resumed by calling {@link #resume()}. * * @see #resume() * @see #isPaused() * @see AnimatorPauseListener */ public void pause() { if (isStarted() && !mPaused) { mPaused = true; if (mPauseListeners != null) { ArrayListAnimator
object.
*
* @return ArrayList
* This constant state is used to create new instances of this animator when needed, instead
* of re-loading it from resources. Default implementation creates a new
* {@link AnimatorConstantState}. You can override this method to provide your custom logic or
* return null if you don't want this animator to be cached.
*
* @return The ConfigurationBoundResourceCache.BaseConstantState associated to this Animator.
* @see android.content.res.ConstantState
* @see #clone()
* @hide
*/
public ConstantState
* 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.
*
* @param target The object being animated
*/
public void setTarget(@Nullable Object target) {
}
// Hide reverse() and canReverse() for now since reverse() only work for simple
// cases, like we don't support sequential, neither startDelay.
// TODO: make reverse() works for all the Animators.
/**
* @hide
*/
public boolean canReverse() {
return false;
}
/**
* @hide
*/
public void reverse() {
throw new IllegalStateException("Reverse is not supported");
}
/**
* An animation listener receives notifications from an animation.
* Notifications indicate animation related events, such as the end or the
* repetition of the animation. Notifies the start of the animation. Notifies the end of the animation. This callback is not invoked
* for animations with repeat count set to INFINITE. Notifies the cancellation of the animation. This callback is not invoked
* for animations with repeat count set to INFINITE. Notifies the repetition of the animation. Notifies that the animation was paused. Notifies that the animation was resumed, after being
* previously paused. Whether or not the Animator is allowed to run asynchronously off of
* the UI thread. This is a hint that informs the Animator that it is
* OK to run the animation off-thread, however the Animator may decide
* that it must run the animation on the UI thread anyway.
*
* Regardless of whether or not the animation runs asynchronously, all
* listener callbacks will be called on the UI thread. To be able to use this hint the following must be true:
* When {@link #newInstance()} is called, default implementation clones the Animator.
*/
private static class AnimatorConstantState extends ConstantState
*
* @hide
*/
public void setAllowRunningAsynchronously(boolean mayRunAsync) {
// It is up to subclasses to support this, if they can.
}
/**
* Creates a {@link ConstantState} which holds changing configurations information associated
* with the given Animator.
*