AnimatableListeners
added to them.
*/
public abstract class Animatable {
/**
* The set of listeners to be sent events through the life of an animation.
*/
ArrayListcancel()
causes the animation to
* stop in its tracks, sending an {@link AnimatableListener#onAnimationCancel(Animatable)} to
* its listeners, followed by an {@link AnimatableListener#onAnimationEnd(Animatable)} message.
*/
public void cancel() {
}
/**
* Ends the animation. This causes the animation to assign the end value of the property being
* animated, then calling the {@link AnimatableListener#onAnimationEnd(Animatable)} method on
* its listeners.
*/
public void end() {
}
/**
* Adds a listener to the set of listeners that are sent events through the life of an
* animation, such as start, repeat, and end.
*
* @param listener the listener to be added to the current set of listeners for this animation.
*/
public void addListener(AnimatableListener listener) {
if (mListeners == null) {
mListeners = new ArrayListAnimatable
object.
*
* @return ArrayListgetListeners()
followed by calling clear()
on the
* returned list of listeners.
*/
public void removeAllListeners() {
if (mListeners != null) {
mListeners.clear();
mListeners = null;
}
}
/**
* An animation listener receives notifications from an animation. * Notifications indicate animation related events, such as the end or the * repetition of the animation.
*/ public static interface AnimatableListener { /** *Notifies the start of the animation.
* * @param animation The started animation. */ void onAnimationStart(Animatable animation); /** *Notifies the end of the animation. This callback is not invoked * for animations with repeat count set to INFINITE.
* * @param animation The animation which reached its end. */ void onAnimationEnd(Animatable animation); /** *Notifies the cancellation of the animation. This callback is not invoked * for animations with repeat count set to INFINITE.
* * @param animation The animation which was canceled. */ void onAnimationCancel(Animatable animation); /** *Notifies the repetition of the animation.
* * @param animation The animation which was repeated. */ void onAnimationRepeat(Animatable animation); } }