public final class TuSdkGifDrawable
extends android.graphics.drawable.Drawable
implements android.graphics.drawable.Animatable
限定符和类型 | 类和说明 |
---|---|
static interface |
TuSdkGifDrawable.TuGifAnimationListener |
限定符和类型 | 字段和说明 |
---|---|
android.graphics.Bitmap |
mBuffer
当前帧缓冲位图
|
GifHelper |
mGifHelper
native 辅助类
|
构造器和说明 |
---|
TuSdkGifDrawable(android.content.res.AssetFileDescriptor afd) |
TuSdkGifDrawable(android.content.ContentResolver resolver,
android.net.Uri uri) |
TuSdkGifDrawable(java.io.File file)
Create gifDrawable from File object
|
TuSdkGifDrawable(java.io.FileDescriptor fd) |
TuSdkGifDrawable(GifHelper gifInfoHandle,
TuSdkGifDrawable oldDrawable,
java.util.concurrent.ScheduledThreadPoolExecutor executor,
boolean isRenderingTriggeredOnDraw) |
TuSdkGifDrawable(android.content.res.Resources res,
int id)
Create gifDrawable from resource
|
TuSdkGifDrawable(java.lang.String filePath)
Create gifDrawable from absolute file path
|
限定符和类型 | 方法和说明 |
---|---|
void |
addAnimationListener(TuSdkGifDrawable.TuGifAnimationListener listener)
Adds a new animation listener
|
static TuSdkGifDrawable |
createFromResource(android.content.res.Resources res,
int resourceId) |
void |
draw(android.graphics.Canvas canvas)
Reads and renders new frame if needed then draws last rendered frame.
|
int |
getAlpha() |
android.graphics.ColorFilter |
getColorFilter() |
float |
getCornerRadius()
获取圆角半径
|
int |
getCurrentFrameIndex()
Returns zero-based index of recently rendered frame in given loop or -1 when drawable is recycled.
|
int |
getCurrentLoop()
Returns zero-based index of currently played animation loop.
|
int |
getCurrentPosition()
Retrieves elapsed time from the beginning of a current loop of animation.
|
int |
getDuration()
Retrieves duration of one loop of the animation.
|
GifHelper.GifError |
getError()
Retrieves last error which is also the indicator of current GIF status.
|
int |
getFrameDuration(int index)
获取特定帧的播放时长,单位:毫秒
|
int |
getIntrinsicHeight() |
int |
getIntrinsicWidth() |
int |
getLoopCount()
动画循环次数,默认:1,0 表示一直循环播放
|
int |
getNumberOfFrames()
获取Gif总帧数
|
int |
getOpacity()
See
Drawable.getOpacity() |
boolean |
isAnimationCompleted()
动画是否播放完毕
|
boolean |
isRecycled() |
boolean |
isRunning() |
protected void |
onBoundsChange(android.graphics.Rect bounds) |
void |
pause()
Equivalent of
stop() |
void |
recycle()
Frees any memory allocated
|
boolean |
removeAnimationListener(TuSdkGifDrawable.TuGifAnimationListener listener)
Removes an animation listener
|
void |
reset()
Causes the animation to start over.
|
void |
setAlpha(int alpha) |
void |
setColorFilter(android.graphics.ColorFilter cf) |
void |
setCornerRadius(float cornerRadius)
设置圆角半径
|
void |
setDither(boolean dither)
已过时。
|
void |
setLoopCount(int loopCount)
Sets loop count of the animation.
|
void |
setSpeed(float factor)
Sets new animation speed factor.
|
boolean |
setVisible(boolean visible,
boolean restart)
Sets whether this drawable is visible.
|
void |
start()
Starts the animation.
|
void |
stop()
Stops the animation.
|
java.lang.String |
toString() |
applyTheme, canApplyTheme, clearColorFilter, copyBounds, copyBounds, createFromPath, createFromResourceStream, createFromResourceStream, createFromStream, createFromXml, createFromXml, createFromXmlInner, createFromXmlInner, getBounds, getCallback, getChangingConfigurations, getConstantState, getCurrent, getDirtyBounds, getHotspotBounds, getLayoutDirection, getLevel, getMinimumHeight, getMinimumWidth, getOpticalInsets, getOutline, getPadding, getState, getTransparentRegion, inflate, inflate, invalidateSelf, isAutoMirrored, isFilterBitmap, isProjected, isStateful, isVisible, jumpToCurrentState, mutate, onLayoutDirectionChanged, onLevelChange, onStateChange, resolveOpacity, scheduleSelf, setAutoMirrored, setBounds, setBounds, setCallback, setChangingConfigurations, setColorFilter, setFilterBitmap, setHotspot, setHotspotBounds, setLayoutDirection, setLevel, setState, setTint, setTintBlendMode, setTintList, setTintMode, unscheduleSelf
public final android.graphics.Bitmap mBuffer
public final GifHelper mGifHelper
public TuSdkGifDrawable(android.content.res.Resources res, int id) throws android.content.res.Resources.NotFoundException, java.io.IOException
res
- Resourcesid
- Resource id (raw or drawable)android.content.res.Resources.NotFoundException
- Resource Not foundjava.io.IOException
- Failed to parse gifpublic TuSdkGifDrawable(java.lang.String filePath) throws GifHelper.GifIOException
filePath
- GifHelper.GifIOException
public TuSdkGifDrawable(java.io.File file) throws java.io.IOException
file
- java.io.IOException
public TuSdkGifDrawable(android.content.res.AssetFileDescriptor afd) throws java.io.IOException
java.io.IOException
public TuSdkGifDrawable(java.io.FileDescriptor fd) throws java.io.IOException
java.io.IOException
public TuSdkGifDrawable(android.content.ContentResolver resolver, android.net.Uri uri) throws java.io.IOException
java.io.IOException
public TuSdkGifDrawable(GifHelper gifInfoHandle, TuSdkGifDrawable oldDrawable, java.util.concurrent.ScheduledThreadPoolExecutor executor, boolean isRenderingTriggeredOnDraw)
public static TuSdkGifDrawable createFromResource(android.content.res.Resources res, int resourceId)
public void recycle()
public boolean isRecycled()
public int getIntrinsicHeight()
getIntrinsicHeight
在类中 android.graphics.drawable.Drawable
public int getIntrinsicWidth()
getIntrinsicWidth
在类中 android.graphics.drawable.Drawable
public void setAlpha(int alpha)
setAlpha
在类中 android.graphics.drawable.Drawable
public void setColorFilter(android.graphics.ColorFilter cf)
setColorFilter
在类中 android.graphics.drawable.Drawable
public android.graphics.ColorFilter getColorFilter()
getColorFilter
在类中 android.graphics.drawable.Drawable
public int getOpacity()
Drawable.getOpacity()
getOpacity
在类中 android.graphics.drawable.Drawable
PixelFormat.TRANSPARENT
public void start()
start
在接口中 android.graphics.drawable.Animatable
public void reset()
public void stop()
stop
在接口中 android.graphics.drawable.Animatable
public boolean isRunning()
isRunning
在接口中 android.graphics.drawable.Animatable
public int getLoopCount()
public void setLoopCount(int loopCount)
loopCount
- loop count, 0 means infinitypublic int getNumberOfFrames()
public GifHelper.GifError getError()
public void setSpeed(float factor)
public void pause()
stop()
public int getDuration()
public int getCurrentPosition()
protected void onBoundsChange(android.graphics.Rect bounds)
onBoundsChange
在类中 android.graphics.drawable.Drawable
public void draw(android.graphics.Canvas canvas)
draw
在类中 android.graphics.drawable.Drawable
canvas
- canvas to draw intopublic int getAlpha()
getAlpha
在类中 android.graphics.drawable.Drawable
@Deprecated public void setDither(boolean dither)
setDither
在类中 android.graphics.drawable.Drawable
public void addAnimationListener(TuSdkGifDrawable.TuGifAnimationListener listener)
listener
- animation listener to be added, not nulljava.lang.NullPointerException
- if listener is nullpublic boolean removeAnimationListener(TuSdkGifDrawable.TuGifAnimationListener listener)
listener
- animation listener to be removedpublic boolean setVisible(boolean visible, boolean restart)
setVisible
在类中 android.graphics.drawable.Drawable
public int getCurrentFrameIndex()
public int getCurrentLoop()
public boolean isAnimationCompleted()
public int getFrameDuration(int index)
index
- index of the framejava.lang.IndexOutOfBoundsException
- if index < 0 or index >= number of framespublic void setCornerRadius(float cornerRadius)
cornerRadius
- 圆角半径public float getCornerRadius()
public java.lang.String toString()
toString
在类中 java.lang.Object