java.lang.Object | ||
↳ | ImageView | |
↳ | co.megacool.megacool.GifImageView |
A view that can display a GIF. You usually won't create this yourself. The GIF is initially
paused, call start()
to start playing. This class is safe to modify from any thread.
When the GIF preview is no longer needed, it must be destroyed by calling destroy()
.
Attempting to start a GIF that was previously destroyed will result in undefined behavior
This class is only available from API level 18 and up.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
GifImageView(Context context) | |||||||||||
GifImageView(Context context, AttributeSet attrs) | |||||||||||
GifImageView(Context context, AttributeSet attrs, int defStyleAttr) |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
destroy()
Call this when you are finished with the GIF preview.
| ||||||||||
int |
getNumberOfFrames()
Get the number of frames to be shown in the preview.
| ||||||||||
boolean | isRunning() | ||||||||||
void |
onWindowFocusChanged(boolean hasWindowFocus)
Used to detect when the preview is visible to automatically pause/start it
| ||||||||||
void |
setRepeat(boolean repeat)
By default the GIF will loop endlessly.
| ||||||||||
void |
start()
Start animating the GIF.
| ||||||||||
void |
stop()
Stop animating the GIF.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Call this when you are finished with the GIF preview. Failure to call this may result in memory leaks. Once you have called this, the GifImageView will still be present on the screen, but it will no longer run. Should you wish to continue playing the GIF again, you will need to create a new GifImageView
Get the number of frames to be shown in the preview. Note that this might change during the preview being shown if the recording hasn't completed storing all of its frames to disk
Used to detect when the preview is visible to automatically pause/start it
hasWindowFocus | true if visible, false if not |
---|
By default the GIF will loop endlessly. Set this to false to only play the GIF once.
repeat | whether the GIF should repeat after the first play |
---|
Start animating the GIF.
Stop animating the GIF.