public class GifDrawable extends GlideDrawable implements com.bumptech.glide.load.resource.gif.GifFrameLoader.FrameCallback
Drawable
that plays the frames of an animated GIF.Drawable.Callback, Drawable.ConstantState
LOOP_FOREVER, LOOP_INTRINSIC
Constructor and Description |
---|
GifDrawable(Context context,
GifDecoder.BitmapProvider bitmapProvider,
BitmapPool bitmapPool,
Transformation<Bitmap> frameTransformation,
int targetFrameWidth,
int targetFrameHeight,
GifHeader gifHeader,
byte[] data,
Bitmap firstFrame)
Constructor for GifDrawable.
|
GifDrawable(GifDrawable other,
Bitmap firstFrame,
Transformation<Bitmap> frameTransformation) |
Modifier and Type | Method and Description |
---|---|
void |
draw(Canvas canvas) |
Drawable.ConstantState |
getConstantState() |
byte[] |
getData() |
GifDecoder |
getDecoder() |
Bitmap |
getFirstFrame() |
int |
getFrameCount() |
Transformation<Bitmap> |
getFrameTransformation() |
int |
getIntrinsicHeight() |
int |
getIntrinsicWidth() |
int |
getOpacity() |
boolean |
isAnimated()
Returns
true if this drawable is animated. |
boolean |
isRunning() |
protected void |
onBoundsChange(Rect bounds) |
void |
onFrameReady(int frameIndex) |
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)
Sets the number of times the animation should loop.
|
boolean |
setVisible(boolean visible,
boolean restart) |
void |
start() |
void |
stop() |
clearColorFilter, copyBounds, copyBounds, createFromPath, createFromResourceStream, createFromResourceStream, createFromStream, createFromXml, createFromXmlInner, getAlpha, getBounds, getCallback, getChangingConfigurations, getCurrent, getLevel, getMinimumHeight, getMinimumWidth, getPadding, getState, getTransparentRegion, inflate, invalidateSelf, isAutoMirrored, isStateful, isVisible, jumpToCurrentState, mutate, onLevelChange, onStateChange, resolveOpacity, scheduleSelf, setAutoMirrored, setBounds, setBounds, setCallback, setChangingConfigurations, setColorFilter, setDither, setFilterBitmap, setLevel, setState, unscheduleSelf
public GifDrawable(Context context, GifDecoder.BitmapProvider bitmapProvider, BitmapPool bitmapPool, Transformation<Bitmap> frameTransformation, int targetFrameWidth, int targetFrameHeight, GifHeader gifHeader, byte[] data, Bitmap firstFrame)
context
- A context.bitmapProvider
- An GifDecoder.BitmapProvider
that can be used to
retrieve re-usable Bitmap
s.bitmapPool
- A BitmapPool
that can be used to return
the first frame when this drawable is recycled.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).gifHeader
- The header data for this gif.data
- The full bytes of the gif.firstFrame
- The decoded and transformed first frame of this gif.setFrameTransformation(com.bumptech.glide.load.Transformation, android.graphics.Bitmap)
public GifDrawable(GifDrawable other, Bitmap firstFrame, Transformation<Bitmap> frameTransformation)
public Bitmap getFirstFrame()
public void setFrameTransformation(Transformation<Bitmap> frameTransformation, Bitmap firstFrame)
public GifDecoder getDecoder()
public Transformation<Bitmap> getFrameTransformation()
public byte[] getData()
public int getFrameCount()
public void start()
start
in interface Animatable
public void stop()
stop
in interface Animatable
public boolean setVisible(boolean visible, boolean restart)
setVisible
in class Drawable
public int getIntrinsicWidth()
getIntrinsicWidth
in class Drawable
public int getIntrinsicHeight()
getIntrinsicHeight
in class Drawable
public boolean isRunning()
isRunning
in interface Animatable
protected void onBoundsChange(Rect bounds)
onBoundsChange
in class Drawable
public void setColorFilter(ColorFilter colorFilter)
setColorFilter
in class Drawable
public int getOpacity()
getOpacity
in class Drawable
public void onFrameReady(int frameIndex)
onFrameReady
in interface com.bumptech.glide.load.resource.gif.GifFrameLoader.FrameCallback
public Drawable.ConstantState getConstantState()
getConstantState
in class Drawable
public void recycle()
public boolean isAnimated()
GlideDrawable
true
if this drawable is animated.isAnimated
in class GlideDrawable
public void setLoopCount(int loopCount)
GlideDrawable
()
} returns true
. A loop count of <=0 indicates loop forever.setLoopCount
in class GlideDrawable