public class GifDrawable extends Drawable implements com.bumptech.glide.load.resource.gif.GifFrameLoader.FrameCallback, Animatable
Drawable that plays the frames of an animated GIF.Drawable.Callback, Drawable.ConstantState| Modifier and Type | Field and Description |
|---|---|
static int |
LOOP_FOREVER
A constant indicating that an animated drawable should loop continuously.
|
static int |
LOOP_INTRINSIC
A constant indicating that an animated drawable should loop for its default number of times.
|
| Constructor and Description |
|---|
GifDrawable(Context context,
GifDecoder gifDecoder,
BitmapPool bitmapPool,
Transformation<Bitmap> frameTransformation,
int targetFrameWidth,
int targetFrameHeight,
Bitmap firstFrame)
|
GifDrawable(Context context,
GifDecoder gifDecoder,
Transformation<Bitmap> frameTransformation,
int targetFrameWidth,
int targetFrameHeight,
Bitmap firstFrame)
Constructor for GifDrawable.
|
| Modifier and Type | Method and Description |
|---|---|
void |
draw(Canvas canvas) |
ByteBuffer |
getBuffer() |
Drawable.ConstantState |
getConstantState() |
Bitmap |
getFirstFrame() |
int |
getFrameCount() |
int |
getFrameIndex()
Returns the current frame index in the range 0..
getFrameCount() - 1, or -1 if no frame
is displayed. |
Transformation<Bitmap> |
getFrameTransformation() |
int |
getIntrinsicHeight() |
int |
getIntrinsicWidth() |
int |
getOpacity() |
int |
getSize() |
boolean |
isRunning() |
protected void |
onBoundsChange(Rect bounds) |
void |
onFrameReady() |
void |
recycle()
Clears any resources for loading frames that are currently held on to by this object.
|
void |
setAlpha(int i) |
void |
setColorFilter(ColorFilter colorFilter) |
void |
setFrameTransformation(Transformation<Bitmap> frameTransformation,
Bitmap firstFrame) |
void |
setLoopCount(int loopCount) |
boolean |
setVisible(boolean visible,
boolean restart) |
void |
start() |
void |
startFromFirstFrame()
Starts the animation from the first frame.
|
void |
stop() |
applyTheme, canApplyTheme, clearColorFilter, copyBounds, copyBounds, createFromPath, createFromResourceStream, createFromResourceStream, createFromStream, createFromXml, createFromXml, createFromXmlInner, createFromXmlInner, getAlpha, getBounds, getCallback, getChangingConfigurations, getColorFilter, getCurrent, getDirtyBounds, getHotspotBounds, getLayoutDirection, getLevel, getMinimumHeight, getMinimumWidth, getOutline, getPadding, getState, getTransparentRegion, inflate, inflate, invalidateSelf, isAutoMirrored, isFilterBitmap, isStateful, isVisible, jumpToCurrentState, mutate, onLayoutDirectionChanged, onLevelChange, onStateChange, resolveOpacity, scheduleSelf, setAutoMirrored, setBounds, setBounds, setCallback, setChangingConfigurations, setColorFilter, setDither, setFilterBitmap, setHotspot, setHotspotBounds, setLayoutDirection, setLevel, setState, setTint, setTintList, setTintMode, unscheduleSelfpublic static final int LOOP_FOREVER
public static final int LOOP_INTRINSIC
@Deprecated public GifDrawable(Context context, GifDecoder gifDecoder, BitmapPool bitmapPool, Transformation<Bitmap> frameTransformation, int targetFrameWidth, int targetFrameHeight, Bitmap firstFrame)
context - A context.bitmapPool - Ignored, see deprecation note.frameTransformation - An Transformation that can be
applied to each frame.targetFrameWidth - The desired width of the frames displayed by this drawable (the
width of the view or
Target
this drawable is being loaded into).targetFrameHeight - The desired height of the frames displayed by this drawable (the
height of the view or
Target
this drawable is being loaded into).gifDecoder - The decoder to use to decode GIF data.firstFrame - The decoded and transformed first frame of this GIF.setFrameTransformation(com.bumptech.glide.load.Transformation, android.graphics.Bitmap)public GifDrawable(Context context, GifDecoder gifDecoder, Transformation<Bitmap> frameTransformation, int targetFrameWidth, int targetFrameHeight, Bitmap firstFrame)
context - A context.frameTransformation - An Transformation that can be
applied to each frame.targetFrameWidth - The desired width of the frames displayed by this drawable (the
width of the view or
Target
this drawable is being loaded into).targetFrameHeight - The desired height of the frames displayed by this drawable (the
height of the view or
Target
this drawable is being loaded into).gifDecoder - The decoder to use to decode GIF data.firstFrame - The decoded and transformed first frame of this GIF.setFrameTransformation(com.bumptech.glide.load.Transformation, android.graphics.Bitmap)public int getSize()
public Bitmap getFirstFrame()
public void setFrameTransformation(Transformation<Bitmap> frameTransformation, Bitmap firstFrame)
public Transformation<Bitmap> getFrameTransformation()
public ByteBuffer getBuffer()
public int getFrameCount()
public int getFrameIndex()
getFrameCount() - 1, or -1 if no frame
is displayed.public void startFromFirstFrame()
public void start()
start in interface Animatablepublic void stop()
stop in interface Animatablepublic boolean setVisible(boolean visible,
boolean restart)
setVisible in class Drawablepublic int getIntrinsicWidth()
getIntrinsicWidth in class Drawablepublic int getIntrinsicHeight()
getIntrinsicHeight in class Drawablepublic boolean isRunning()
isRunning in interface Animatableprotected void onBoundsChange(Rect bounds)
onBoundsChange in class Drawablepublic void setColorFilter(ColorFilter colorFilter)
setColorFilter in class Drawablepublic int getOpacity()
getOpacity in class Drawablepublic void onFrameReady()
onFrameReady in interface com.bumptech.glide.load.resource.gif.GifFrameLoader.FrameCallbackpublic Drawable.ConstantState getConstantState()
getConstantState in class Drawablepublic void recycle()
public void setLoopCount(int loopCount)