public abstract class IconicsAnimationProcessor
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
INFINITE
This value used used with the
repeatCount(int) property to repeat
the animation indefinitely. |
protected long |
mDuration |
protected android.animation.TimeInterpolator |
mInterpolator |
protected boolean |
mIsStartImmediately |
protected int |
mRepeatCount |
protected int |
mRepeatMode |
static int |
RESTART
When the animation reaches the end and
repeatCount is INFINITE
or a positive value, the animation restarts from the beginning. |
static int |
REVERSE
When the animation reaches the end and
repeatCount is INFINITE
or a positive value, the animation reverses direction on every iteration. |
| Constructor and Description |
|---|
IconicsAnimationProcessor() |
| Modifier and Type | Method and Description |
|---|---|
IconicsAnimationProcessor |
addListener(IconicsAnimationListener listener)
Adds a listener to the set of listeners that are sent events through the life of an
processor, such as start, repeat, and end.
|
IconicsAnimationProcessor |
addPauseListener(IconicsAnimationPauseListener listener)
Adds a pause listener to this processor.
|
abstract java.lang.String |
animationTag() |
void |
cancel()
Cancels the animation.
|
IconicsAnimationProcessor |
duration(long duration,
java.util.concurrent.TimeUnit timeUnit)
Sets the length of the animation.
|
void |
end()
Ends the animation.
|
protected float |
getAnimatedPercent() |
protected android.graphics.Rect |
getDrawableBounds()
Return the drawable's bounds Rect.
|
protected int[] |
getDrawableState()
Return the drawable's current state
|
IconicsAnimationProcessor |
interpolator(android.animation.TimeInterpolator interpolator)
The time interpolator used in calculating the elapsed fraction of this animation.
|
boolean |
isPaused()
Returns whether this processor is currently in a paused state.
|
boolean |
isRunning() |
boolean |
isStarted() |
protected void |
onDrawableAttached()
Called when a drawable was attached and now
getDrawableBounds() and
getDrawableState() will return valid values. |
protected void |
onDrawableDetached()
Called when a drawable was detached and now
getDrawableBounds() and
getDrawableState() will return null. |
void |
pause()
Pauses a running processor.
|
protected void |
processPostDraw(android.graphics.Canvas canvas)
Will be called after
.draw(Canvas). |
protected void |
processPreDraw(android.graphics.Canvas canvas,
IconicsBrush<android.text.TextPaint> iconBrush,
IconicsBrush<android.graphics.Paint> iconContourBrush,
IconicsBrush<android.graphics.Paint> backgroundBrush,
IconicsBrush<android.graphics.Paint> backgroundContourBrush)
Will be called before
.draw(Canvas). |
void |
removeAllListeners()
Removes all
listeners and
pauseListeners from this processor. |
void |
removeListener(IconicsAnimationListener listener)
Removes a listener from the set listening to this processor.
|
void |
removePauseListener(IconicsAnimationPauseListener listener)
Removes a pause listener from the set listening to this processor.
|
IconicsAnimationProcessor |
repeatCount(int repeatCount)
Sets how many times the animation should be repeated.
|
IconicsAnimationProcessor |
repeatMode(int value)
Defines what this animation should do when it reaches the end.
|
void |
resume()
Resumes a paused processor, causing the processor to pick up where it left off
when it was paused.
|
void |
reverse()
Plays the processor in reverse.
|
IconicsAnimationProcessor |
start()
Starts the animation, if processor is attached to drawable, otherwise sets flag to start
animation immediately after attaching
|
IconicsAnimationProcessor |
startImmediately(boolean startImmediately)
Set the flag for starting animation immediately after attach to drawable and after drawable
with the view is attached to window.
|
public static final int RESTART
repeatCount is INFINITE
or a positive value, the animation restarts from the beginning.public static final int REVERSE
repeatCount is INFINITE
or a positive value, the animation reverses direction on every iteration.public static final int INFINITE
repeatCount(int) property to repeat
the animation indefinitely.protected android.animation.TimeInterpolator mInterpolator
protected long mDuration
protected int mRepeatCount
protected int mRepeatMode
protected boolean mIsStartImmediately
public abstract java.lang.String animationTag()
public IconicsAnimationProcessor duration(long duration, java.util.concurrent.TimeUnit timeUnit)
duration - The length of the animation. This value cannot be negative.public IconicsAnimationProcessor repeatMode(int value)
public IconicsAnimationProcessor repeatCount(int repeatCount)
INFINITE, the repeat mode will be taken
into account. The repeat count is INFINITE by default.repeatCount - the number of times the animation should be repeatedpublic IconicsAnimationProcessor interpolator(android.animation.TimeInterpolator interpolator)
LinearInterpolatorinterpolator - the interpolator to be used by this processor. A value of null
will result in linear interpolation.public IconicsAnimationProcessor startImmediately(boolean startImmediately)
true.startImmediately - the flagpublic IconicsAnimationProcessor start()
public IconicsAnimationProcessor addListener(IconicsAnimationListener listener)
listener - the listener to be added to the current set of listeners for this processor.public void removeListener(IconicsAnimationListener listener)
listener - the listener to be removed from the current set of listeners for this
processor.public IconicsAnimationProcessor addPauseListener(IconicsAnimationPauseListener listener)
listener - the listener to be added to the current set of pause listeners
for this processor.public void removePauseListener(IconicsAnimationPauseListener listener)
listener - the listener to be removed from the current set of pause
listeners for this processor.public void removeAllListeners()
listeners and
pauseListeners from this processor.public void cancel()
end(), cancel() causes the animation to
stop in its tracks, sending an
IconicsAnimationListener.onAnimationCancel(IconicsAnimationProcessor) to
its listeners, followed by an
IconicsAnimationListener.onAnimationEnd(IconicsAnimationProcessor) message.
This method must be called on the thread that is running the processor.
public void end()
IconicsAnimationListener.onAnimationEnd(IconicsAnimationProcessor) method on
its listeners.
This method must be called on the thread that is running the processor.
public boolean isStarted()
public boolean isRunning()
public void reverse()
public void pause()
started or has since ended, then the call is ignored. Paused
processors can be resumed by calling resume().resume(),
isPaused()public void resume()
resume() on an processor that is
not currently paused will be ignored.pause(),
isPaused()public boolean isPaused()
protected void processPreDraw(android.graphics.Canvas canvas,
IconicsBrush<android.text.TextPaint> iconBrush,
IconicsBrush<android.graphics.Paint> iconContourBrush,
IconicsBrush<android.graphics.Paint> backgroundBrush,
IconicsBrush<android.graphics.Paint> backgroundContourBrush)
.draw(Canvas).
Useful for some changes, based on Paintprotected void processPostDraw(android.graphics.Canvas canvas)
.draw(Canvas).
Useful for some changes, based on canvas and need to restore canvas after drawing the icon
(scale, rotate etc.).protected int[] getDrawableState()
Nullability contract: calling this into
processPreDraw(Canvas, IconicsBrush, IconicsBrush, IconicsBrush, IconicsBrush) or
processPostDraw(Canvas) is guaranteed return @NonNull value, otherwise it
can be @Nullable.
protected android.graphics.Rect getDrawableBounds()
Nullability contract: calling this into
processPreDraw(Canvas, IconicsBrush, IconicsBrush, IconicsBrush, IconicsBrush) or
processPostDraw(Canvas) is guaranteed return @NonNull value, otherwise it
can be @Nullable.
protected float getAnimatedPercent()
protected void onDrawableAttached()
getDrawableBounds() and
getDrawableState() will return valid values. Good place to set some
drawable-dependent fieldsprotected void onDrawableDetached()
getDrawableBounds() and
getDrawableState() will return null. Good place to reset some
drawable-dependent fields