Package icyllis.modernui.animation
Class Animator
java.lang.Object
icyllis.modernui.animation.Animator
- All Implemented Interfaces:
- Cloneable
- Direct Known Subclasses:
- AnimatorSet,- ValueAnimator
This is the base for classes which provide basic support for animations which can be
 started, ended, and have listeners added to them.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final longThe value used to indicate infinite duration (e.g.static final org.slf4j.Marker
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionfinal voidaddListener(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.abstract voidcancel()Cancels the animation.booleanclone()abstract voidend()Ends the animation.abstract longGets the duration of the animation.abstract TimeInterpolatorReturns the timing interpolator that this animation uses.final List<AnimatorListener> Gets the set ofAnimatorListenerobjects that are currently listening for events on thisAnimatorobject.abstract longThe amount of time, in milliseconds, to delay processing the animation afterstart()is called.abstract longGets the total duration of the animation, accounting for animation sequences, start delay, and repeating.final booleanisPaused()Returns whether this animator is currently in a paused state.abstract booleanReturns whether this Animator is currently running (having been started and gone past any initial startDelay period and not yet ended).abstract booleanReturns whether this Animator has been started and not yet ended.voidpause()Pauses a running animation.final voidRemoves alllistenersfrom this object.final voidremoveListener(AnimatorListener listener) Removes a listener from the set listening to this animation.voidresume()Resumes a paused animation, causing the animator to pick up where it left off when it was paused.voidreverse()abstract AnimatorsetDuration(long duration) Sets the duration of the animation.abstract voidsetInterpolator(TimeInterpolator value) The time interpolator used in calculating the elapsed fraction of the animation.abstract voidsetStartDelay(long startDelay) The amount of time, in milliseconds, to delay processing the animation afterstart()is called.voidSets the target object whose property will be animated by this animation.voidThis method tells the object to use appropriate information to extract ending values for the animation.voidThis method tells the object to use appropriate information to extract starting values for the animation.abstract voidstart()Starts this animation.
- 
Field Details- 
MARKERpublic static final org.slf4j.Marker MARKER
- 
DURATION_INFINITEpublic static final long DURATION_INFINITEThe value used to indicate infinite duration (e.g. when Animators repeat infinitely).- See Also:
 
 
- 
- 
Constructor Details- 
Animatorpublic Animator()
 
- 
- 
Method Details- 
startpublic abstract 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 toAnimatorListener.onAnimationStart(Animator, boolean)for any listeners of this animator.The animation started by calling this method will be run on the thread that called this method. 
- 
cancelpublic abstract void cancel()Cancels the animation. Unlikeend(),cancel()causes the animation to stop in its tracks, sending anAnimatorListener.onAnimationCancel(Animator)to its listeners, followed by anAnimatorListener.onAnimationEnd(Animator, boolean)message.This method must be called on the thread that is running the animation. 
- 
endpublic abstract void end()Ends the animation. This causes the animation to assign the end value of the property being animated, then calling theAnimatorListener.onAnimationEnd(Animator, boolean)method on its listeners.This method must be called on the thread that is running the animation. 
- 
pausepublic 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 beenstartedor has since ended, then the call is ignored. Paused animations can be resumed by callingresume().- See Also:
 
- 
resumepublic 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.- See Also:
 
- 
isPausedpublic final boolean isPaused()Returns whether this animator is currently in a paused state.- Returns:
- True if the animator is currently paused, false otherwise.
- See Also:
 
- 
setStartDelaypublic abstract void setStartDelay(long startDelay) The amount of time, in milliseconds, to delay processing the animation afterstart()is called.- Parameters:
- startDelay- The amount of the delay, in milliseconds
 
- 
getStartDelaypublic abstract long getStartDelay()The amount of time, in milliseconds, to delay processing the animation afterstart()is called.- Returns:
- the number of milliseconds to delay running the animation
 
- 
setDurationSets the duration of the animation.- Parameters:
- duration- The length of the animation, in milliseconds.
 
- 
getDurationpublic abstract long getDuration()Gets the duration of the animation.- Returns:
- The length of the animation, in milliseconds.
 
- 
getTotalDurationpublic abstract long getTotalDuration()Gets the total duration of the animation, accounting for animation sequences, start delay, and repeating. ReturnDURATION_INFINITEif the duration is infinite.- Returns:
- Total time an animation takes to finish, starting from the time start()is called.DURATION_INFINITEwill be returned if the animation or any child animation repeats infinite times.
 
- 
setInterpolatorThe 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 isTimeInterpolator.ACCELERATE_DECELERATE.- Parameters:
- value- the interpolator to be used by this animation
 
- 
getInterpolatorReturns the timing interpolator that this animation uses.- Returns:
- The timing interpolator for this animation.
 
- 
isRunningpublic abstract boolean isRunning()Returns whether this Animator is currently running (having been started and gone past any initial startDelay period and not yet ended).- Returns:
- Whether the Animator is running.
 
- 
isStartedpublic abstract boolean isStarted()Returns whether this Animator has been started and not yet ended. For reusable Animators (which most Animators are, apart from the one-shot animator), this state is a superset ofisRunning(), because an Animator with a nonzerogetStartDelay()will return true during the delay phase, whereasisRunning()will return true only after the delay phase is complete. Non-reusable animators will always return true after they have been started, because they cannot return to a non-started state.- Returns:
- whether the Animator has been started and not yet ended.
 
- 
addListenerAdds a listener to the set of listeners that are sent events through the life of an animation, such as start, repeat, and end.- Parameters:
- listener- the listener to be added to the current set of listeners for this animation.
 
- 
removeListenerRemoves a listener from the set listening to this animation.- Parameters:
- listener- the listener to be removed from the current set of listeners for this animation.
 
- 
removeAllListenerspublic final void removeAllListeners()Removes alllistenersfrom this object.
- 
getListenersGets the set ofAnimatorListenerobjects that are currently listening for events on thisAnimatorobject.- Returns:
- The set of listeners.
 
- 
clone
- 
setupStartValuespublic 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.
- 
setupEndValuespublic 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.
- 
setTargetSets the target object whose property will be animated by this animation. Not all subclasses operate on target objects, 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
 
- 
canReverse@Internal public boolean canReverse()
- 
reverse@Internal public void reverse()
 
-