Methods Summary |
---|
public void | addListener(android.animation.Animator$AnimatorListener listener)Adds a listener to the set of listeners that are sent events through the life of an
animation, such as start, repeat, and end.
if (mListeners == null) {
mListeners = new ArrayList<AnimatorListener>();
}
mListeners.add(listener);
|
public void | addPauseListener(android.animation.Animator$AnimatorPauseListener listener)Adds a pause listener to this animator.
if (mPauseListeners == null) {
mPauseListeners = new ArrayList<AnimatorPauseListener>();
}
mPauseListeners.add(listener);
|
public void | appendChangingConfigurations(int configs)Sets the changing configurations value to the union of the current changing configurations
and the provided configs.
This method is called while loading the animator.
mChangingConfigurations |= configs;
|
public boolean | canReverse()
return false;
|
public void | cancel()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 android.animation.Animator | clone()
try {
final Animator anim = (Animator) super.clone();
if (mListeners != null) {
anim.mListeners = new ArrayList<AnimatorListener>(mListeners);
}
if (mPauseListeners != null) {
anim.mPauseListeners = new ArrayList<AnimatorPauseListener>(mPauseListeners);
}
return anim;
} catch (CloneNotSupportedException e) {
throw new AssertionError();
}
|
public android.content.res.ConstantState | createConstantState()Return a {@link android.content.res.ConstantState} instance that holds the shared state of
this Animator.
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 new AnimatorConstantState(this);
|
public void | end()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 int | getChangingConfigurations()Return a mask of the configuration parameters for which this animator may change, requiring
that it should be re-created from Resources. The default implementation returns whatever
value was provided through setChangingConfigurations(int) or 0 by default.
return mChangingConfigurations;
|
public abstract long | getDuration()Gets the duration of the animation.
|
public TimeInterpolator | getInterpolator()Returns the timing interpolator that this animation uses.
return null;
|
public java.util.ArrayList | getListeners()Gets the set of {@link android.animation.Animator.AnimatorListener} objects that are currently
listening for events on this Animator object.
return mListeners;
|
public abstract long | getStartDelay()The amount of time, in milliseconds, to delay processing the animation
after {@link #start()} is called.
|
public boolean | isPaused()Returns whether this animator is currently in a paused state.
return mPaused;
|
public abstract boolean | isRunning()Returns whether this Animator is currently running (having been started and gone past any
initial startDelay period and not yet ended).
|
public boolean | isStarted()Returns whether this Animator has been started and not yet ended. This state is a superset
of the state of {@link #isRunning()}, because an Animator with a nonzero
{@link #getStartDelay() startDelay} will return true for {@link #isStarted()} during the
delay phase, whereas {@link #isRunning()} will return true only after the delay phase
is complete.
// Default method returns value for isRunning(). Subclasses should override to return a
// real value.
return isRunning();
|
public void | pause()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()}.
if (isStarted() && !mPaused) {
mPaused = true;
if (mPauseListeners != null) {
ArrayList<AnimatorPauseListener> tmpListeners =
(ArrayList<AnimatorPauseListener>) mPauseListeners.clone();
int numListeners = tmpListeners.size();
for (int i = 0; i < numListeners; ++i) {
tmpListeners.get(i).onAnimationPause(this);
}
}
}
|
public void | removeAllListeners()Removes all {@link #addListener(android.animation.Animator.AnimatorListener) listeners}
and {@link #addPauseListener(android.animation.Animator.AnimatorPauseListener)
pauseListeners} from this object.
if (mListeners != null) {
mListeners.clear();
mListeners = null;
}
if (mPauseListeners != null) {
mPauseListeners.clear();
mPauseListeners = null;
}
|
public void | removeListener(android.animation.Animator$AnimatorListener listener)Removes a listener from the set listening to this animation.
if (mListeners == null) {
return;
}
mListeners.remove(listener);
if (mListeners.size() == 0) {
mListeners = null;
}
|
public void | removePauseListener(android.animation.Animator$AnimatorPauseListener listener)Removes a pause listener from the set listening to this animation.
if (mPauseListeners == null) {
return;
}
mPauseListeners.remove(listener);
if (mPauseListeners.size() == 0) {
mPauseListeners = null;
}
|
public void | resume()Resumes a paused animation, causing the animator to pick up where it left off
when it was paused. This method should only be called on the same thread on
which the animation was started. Calls to resume() on an animator that is
not currently paused will be ignored.
if (mPaused) {
mPaused = false;
if (mPauseListeners != null) {
ArrayList<AnimatorPauseListener> tmpListeners =
(ArrayList<AnimatorPauseListener>) mPauseListeners.clone();
int numListeners = tmpListeners.size();
for (int i = 0; i < numListeners; ++i) {
tmpListeners.get(i).onAnimationResume(this);
}
}
}
|
public void | reverse()
throw new IllegalStateException("Reverse is not supported");
|
public void | setAllowRunningAsynchronously(boolean mayRunAsync)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:
- The animator is immutable while {@link #isStarted()} is true. Requests
to change duration, delay, etc... may be ignored.
- Lifecycle callback events may be asynchronous. Events such as
{@link Animator.AnimatorListener#onAnimationEnd(Animator)} or
{@link Animator.AnimatorListener#onAnimationRepeat(Animator)} may end up delayed
as they must be posted back to the UI thread, and any actions performed
by those callbacks (such as starting new animations) will not happen
in the same frame.
- State change requests ({@link #cancel()}, {@link #end()}, {@link #reverse()}, etc...)
may be asynchronous. It is guaranteed that all state changes that are
performed on the UI thread in the same frame will be applied as a single
atomic update, however that frame may be the current frame,
the next frame, or some future frame. This will also impact the observed
state of the Animator. For example, {@link #isStarted()} may still return true
after a call to {@link #end()}. Using the lifecycle callbacks is preferred over
queries to {@link #isStarted()}, {@link #isRunning()}, and {@link #isPaused()}
for this reason.
// It is up to subclasses to support this, if they can.
|
public void | setChangingConfigurations(int configs)Set a mask of the configuration parameters for which this animator may change, requiring
that it be re-created from resource.
mChangingConfigurations = configs;
|
public abstract android.animation.Animator | setDuration(long duration)Sets the duration of the animation.
|
public abstract void | setInterpolator(TimeInterpolator value)The time interpolator used in calculating the elapsed fraction of the
animation. The interpolator determines whether the animation runs with
linear or non-linear motion, such as acceleration and deceleration. The
default value is {@link android.view.animation.AccelerateDecelerateInterpolator}.
|
public abstract void | setStartDelay(long startDelay)The amount of time, in milliseconds, to delay processing the animation
after {@link #start()} is called.
|
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, {@link ValueAnimator}, but this method
is on the superclass for the convenience of dealing generically with those subclasses
that do handle targets.
|
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 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 | 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
{@link 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.
|