public class LottieDrawable
extends android.graphics.drawable.Drawable
implements android.graphics.drawable.Drawable.Callback
recycleBitmaps() when you are done
or else you will leak bitmaps.
It is preferable to use LottieAnimationView when possible because it
handles bitmap recycling and asynchronous loading
of compositions.
| Constructor and Description |
|---|
LottieDrawable() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAnimatorListener(android.animation.Animator.AnimatorListener listener) |
void |
addAnimatorUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener updateListener) |
void |
cancelAnimation() |
void |
draw(android.graphics.Canvas canvas) |
void |
enableMergePathsForKitKatAndAbove(boolean enable)
Enable this to get merge path support for devices running KitKat (19) and above.
|
int |
getAlpha() |
LottieComposition |
getComposition() |
int |
getIntrinsicHeight() |
int |
getIntrinsicWidth() |
int |
getOpacity() |
float |
getProgress() |
float |
getScale() |
boolean |
hasMasks()
Returns whether or not any layers in this composition has masks.
|
boolean |
hasMatte()
Returns whether or not any layers in this composition has a matte layer.
|
void |
invalidateDrawable(android.graphics.drawable.Drawable who)
These Drawable.Callback methods proxy the calls so that this is the drawable that is
actually invalidated, not a child one which will not pass the view's validateDrawable check.
|
void |
invalidateSelf() |
boolean |
isAnimating() |
boolean |
isLooping() |
void |
loop(boolean loop) |
void |
playAnimation() |
void |
recycleBitmaps()
If you have image assets and use
LottieDrawable directly, you must call this yourself. |
void |
removeAnimatorListener(android.animation.Animator.AnimatorListener listener) |
void |
removeAnimatorUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener updateListener) |
void |
resumeAnimation() |
void |
resumeReverseAnimation() |
void |
reverseAnimation() |
void |
scheduleDrawable(android.graphics.drawable.Drawable who,
java.lang.Runnable what,
long when) |
void |
setAlpha(int alpha) |
void |
setColorFilter(android.graphics.ColorFilter colorFilter) |
boolean |
setComposition(LottieComposition composition) |
void |
setImageAssetDelegate(ImageAssetDelegate assetDelegate)
Use this if you can't bundle images with your app.
|
void |
setImagesAssetsFolder(java.lang.String imageAssetsFolder)
If you use image assets, you must explicitly specify the folder in assets/ in which they are
located because bodymovin uses the name filenames across all compositions (img_#).
|
void |
setProgress(float progress) |
void |
setScale(float scale) |
void |
setSpeed(float speed) |
void |
unscheduleDrawable(android.graphics.drawable.Drawable who,
java.lang.Runnable what) |
applyTheme, canApplyTheme, clearColorFilter, copyBounds, copyBounds, createFromPath, createFromResourceStream, createFromResourceStream, createFromStream, createFromXml, createFromXml, createFromXmlInner, createFromXmlInner, getBounds, getCallback, getChangingConfigurations, getColorFilter, getConstantState, getCurrent, getDirtyBounds, getHotspotBounds, getLayoutDirection, getLevel, getMinimumHeight, getMinimumWidth, getOutline, getPadding, getState, getTransparentRegion, inflate, inflate, isAutoMirrored, isFilterBitmap, isStateful, isVisible, jumpToCurrentState, mutate, onBoundsChange, onLayoutDirectionChanged, onLevelChange, onStateChange, resolveOpacity, scheduleSelf, setAutoMirrored, setBounds, setBounds, setCallback, setChangingConfigurations, setColorFilter, setDither, setFilterBitmap, setHotspot, setHotspotBounds, setLayoutDirection, setLevel, setState, setTint, setTintList, setTintMode, setVisible, unscheduleSelfpublic boolean hasMasks()
public boolean hasMatte()
public void enableMergePathsForKitKatAndAbove(boolean enable)
public void setImagesAssetsFolder(java.lang.String imageAssetsFolder)
recycleBitmaps() when you
are done. Calling recycleBitmaps() doesn't have to be final and LottieDrawable
will recreate the bitmaps if needed but they will leak if you don't recycle them.public void recycleBitmaps()
LottieDrawable directly, you must call this yourself.
Calling recycleBitmaps() doesn't have to be final and LottieDrawable
will recreate the bitmaps if needed but they will leak if you don't recycle them.public boolean setComposition(LottieComposition composition)
public void invalidateSelf()
invalidateSelf in class android.graphics.drawable.Drawablepublic void setAlpha(int alpha)
setAlpha in class android.graphics.drawable.Drawablepublic int getAlpha()
getAlpha in class android.graphics.drawable.Drawablepublic void setColorFilter(android.graphics.ColorFilter colorFilter)
setColorFilter in class android.graphics.drawable.Drawablepublic int getOpacity()
getOpacity in class android.graphics.drawable.Drawablepublic void draw(android.graphics.Canvas canvas)
draw in class android.graphics.drawable.Drawablepublic void loop(boolean loop)
public boolean isLooping()
public boolean isAnimating()
public void playAnimation()
public void resumeAnimation()
public void resumeReverseAnimation()
public void reverseAnimation()
public void setSpeed(float speed)
public void setProgress(float progress)
public float getProgress()
public void setScale(float scale)
public void setImageAssetDelegate(ImageAssetDelegate assetDelegate)
public float getScale()
public LottieComposition getComposition()
public void cancelAnimation()
public void addAnimatorUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener updateListener)
public void removeAnimatorUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener updateListener)
public void addAnimatorListener(android.animation.Animator.AnimatorListener listener)
public void removeAnimatorListener(android.animation.Animator.AnimatorListener listener)
public int getIntrinsicWidth()
getIntrinsicWidth in class android.graphics.drawable.Drawablepublic int getIntrinsicHeight()
getIntrinsicHeight in class android.graphics.drawable.Drawablepublic void invalidateDrawable(android.graphics.drawable.Drawable who)
invalidateDrawable in interface android.graphics.drawable.Drawable.Callbackpublic void scheduleDrawable(android.graphics.drawable.Drawable who,
java.lang.Runnable what,
long when)
scheduleDrawable in interface android.graphics.drawable.Drawable.Callbackpublic void unscheduleDrawable(android.graphics.drawable.Drawable who,
java.lang.Runnable what)
unscheduleDrawable in interface android.graphics.drawable.Drawable.Callback