java.lang.Object | ||
↳ | android.graphics.drawable.Drawable | |
↳ | com.facebook.fresco.animation.drawable.AnimatedDrawable2 |
Experimental new animated drawable that uses a supplied AnimationBackend
for drawing
frames.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
interface | AnimatedDrawable2.DrawListener | draw(Canvas) listener that is notified for each draw call. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
AnimatedDrawable2() | |||||||||||
AnimatedDrawable2(AnimationBackend animationBackend) |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void | draw(Canvas canvas) | ||||||||||
void |
dropCaches()
Informs the Drawable to drop its caches.
| ||||||||||
AnimationBackend | getAnimationBackend() | ||||||||||
long | getDroppedFrames() | ||||||||||
int |
getFrameCount()
Get the number of frames for the animation.
| ||||||||||
int | getIntrinsicHeight() | ||||||||||
int | getIntrinsicWidth() | ||||||||||
int |
getLoopCount()
Get the loop count of the animation.
| ||||||||||
long |
getLoopDurationMs()
Get the animation duration for 1 loop by summing all frame durations.
| ||||||||||
int | getOpacity() | ||||||||||
long | getStartTimeMs() | ||||||||||
boolean | isInfiniteAnimation() | ||||||||||
boolean |
isRunning()
Check whether the animation is running.
| ||||||||||
void |
jumpToFrame(int targetFrameNumber)
Jump immediately to the given frame number.
| ||||||||||
void | setAlpha(int alpha) | ||||||||||
void |
setAnimationBackend(AnimationBackend animationBackend)
Update the animation backend to be used for the animation.
| ||||||||||
void |
setAnimationListener(AnimationListener animationListener)
Set an animation listener that is notified for various animation events.
| ||||||||||
void | setColorFilter(ColorFilter colorFilter) | ||||||||||
void |
setDrawListener(AnimatedDrawable2.DrawListener drawListener)
Set a draw listener that is notified for each
draw(Canvas) call. | ||||||||||
void |
setFrameSchedulingDelayMs(long frameSchedulingDelayMs)
Frame scheduling delay to shift the target render time for a frame within the frame's visible
window.
| ||||||||||
void |
setFrameSchedulingOffsetMs(long frameSchedulingOffsetMs)
Frame scheduling offset to shift the animation time by the given offset.
| ||||||||||
void |
start()
Start the animation.
| ||||||||||
void |
stop()
Stop the animation at the current frame.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void | onBoundsChange(Rect bounds) | ||||||||||
boolean |
onLevelChange(int level)
Set the animation to the given level.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.graphics.drawable.Drawable
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
android.graphics.drawable.Animatable
| |||||||||||
From interface
com.facebook.drawable.base.DrawableWithCaches
|
Informs the Drawable to drop its caches.
Get the number of frames for the animation. If no animation backend is set, 0 will be returned.
Get the loop count of the animation. The returned value is either LOOP_COUNT_INFINITE
if the animation is repeated infinitely or a positive
integer that corresponds to the number of loops. If no animation backend is set, LOOP_COUNT_INFINITE
will be returned.
LOOP_COUNT_INFINITE
Get the animation duration for 1 loop by summing all frame durations.
Check whether the animation is running.
Jump immediately to the given frame number. The animation will not be paused if it is running. If the animation is not running, the animation will not be started.
targetFrameNumber | the frame number to jump to |
---|
Update the animation backend to be used for the animation. This will also stop the animation. In order to remove the current animation backend, call this method with null.
animationBackend | the animation backend to be used or null |
---|
Set an animation listener that is notified for various animation events.
animationListener | the listener to use |
---|
Set a draw listener that is notified for each draw(Canvas)
call.
drawListener | the listener to use |
---|
Frame scheduling delay to shift the target render time for a frame within the frame's visible window. If the value is set to 0, the frame will be scheduled right at the beginning of the frame's visible window.
frameSchedulingDelayMs | the delay to use in ms |
---|
Frame scheduling offset to shift the animation time by the given offset. This is similar to #mFrameSchedulingDelayMs but instead of delaying the invalidation, this offsets the animation time by the given value.
frameSchedulingOffsetMs | the offset to use in ms |
---|
Start the animation.
Stop the animation at the current frame. It can be resumed by calling start()
again.
Set the animation to the given level. The level represents the animation time in ms. If the animation time is greater than the last frame time for the last loop, the last frame will be displayed.
If the animation is running (e.g. if start()
has been called, the level change will
be ignored. In this case, stop()
the animation first.
level | the animation time in ms |
---|