-
public abstract class GifDrawableInit<T extends GifDrawableInit<T>>
The base class for using the builder pattern with subclasses.
-
-
Method Summary
Modifier and Type Method Description T
sampleSize(@IntRange(from = 1, to = Character.MAX_VALUE) int sampleSize)
Sample size controlling subsampling, see setInSampleSize for more details. GifDrawable
build()
Appropriate constructor wrapper. T
with(GifDrawable drawable)
Sets drawable to be reused when creating new one. T
threadPoolSize(int threadPoolSize)
Sets thread pool size for rendering tasks. T
taskExecutor(ScheduledThreadPoolExecutor executor)
Sets or resets executor for rendering tasks. T
renderingTriggeredOnDraw(boolean isRenderingTriggeredOnDraw)
Sets whether rendering of the next frame is scheduled after drawing current one (so animationwill be paused if drawing does not happen) or just after rendering frame (no matter if it isdrawn or not). T
setRenderingTriggeredOnDraw(boolean isRenderingTriggeredOnDraw)
Equivalent to renderingTriggeredOnDraw. T
options(@Nullable() GifOptions options)
Indicates whether the content of this source is opaque. T
from(InputStream inputStream)
Wrapper of GifDrawable T
from(AssetFileDescriptor assetFileDescriptor)
Wrapper of GifDrawable T
from(FileDescriptor fileDescriptor)
Wrapper of GifDrawable T
from(AssetManager assetManager, String assetName)
Wrapper of GifDrawable T
from(ContentResolver contentResolver, Uri uri)
Wrapper of GifDrawable T
from(File file)
Wrapper of GifDrawable T
from(String filePath)
Wrapper of GifDrawable T
from(Array<byte> bytes)
Wrapper of GifDrawable T
from(ByteBuffer byteBuffer)
Wrapper of GifDrawable T
from(Resources resources, int resourceId)
Wrapper of GifDrawable InputSource
getInputSource()
Getter for the input source. GifDrawable
getOldDrawable()
Getter for the old drawable. ScheduledThreadPoolExecutor
getExecutor()
Getter for the executor. boolean
isRenderingTriggeredOnDraw()
GifOptions
getOptions()
Getter for the GIF options. -
-
Method Detail
-
sampleSize
T sampleSize(@IntRange(from = 1, to = Character.MAX_VALUE) int sampleSize)
Sample size controlling subsampling, see setInSampleSize for more details.Note that this call will overwrite sample size set previously by options
- Parameters:
sampleSize
- the sample size
-
build
GifDrawable build()
Appropriate constructor wrapper. Must be preceded by on of
{@code from()}
calls.
-
with
T with(GifDrawable drawable)
Sets drawable to be reused when creating new one.
- Parameters:
drawable
- drawable to be reused
-
threadPoolSize
T threadPoolSize(int threadPoolSize)
Sets thread pool size for rendering tasks.Warning: custom executor set by taskExecutor will be overwritten after setting pool size
- Parameters:
threadPoolSize
- size of the pool
-
taskExecutor
T taskExecutor(ScheduledThreadPoolExecutor executor)
Sets or resets executor for rendering tasks.Warning: value set by threadPoolSize will not be taken into account after setting executor
- Parameters:
executor
- executor to be used or null for default (each drawable instance has its own executor)
-
renderingTriggeredOnDraw
T renderingTriggeredOnDraw(boolean isRenderingTriggeredOnDraw)
Sets whether rendering of the next frame is scheduled after drawing current one (so animationwill be paused if drawing does not happen) or just after rendering frame (no matter if it isdrawn or not). However animation will never run if drawable is set to not visible. See isVisible for more information about drawable visibility.By default this option is enabled. Note that drawing does not happen if view containingdrawable is obscured. Disabling this option will prevent that however battery draining will behigher.
- Parameters:
isRenderingTriggeredOnDraw
- whether rendering of the next frame is scheduled after drawing (default)current one or just after it is rendered
-
setRenderingTriggeredOnDraw
T setRenderingTriggeredOnDraw(boolean isRenderingTriggeredOnDraw)
Equivalent to renderingTriggeredOnDraw. This method does not follow naming conventionand is preserved for backwards compatibility only.
- Parameters:
isRenderingTriggeredOnDraw
- whether rendering of the next frame is scheduled after drawing (default)current one or just after it is rendered
-
options
@Beta() T options(@Nullable() GifOptions options)
Indicates whether the content of this source is opaque. GIF that is known to be opaque cantake a faster drawing case than non-opaque one. See setOpaque for more information.Currently it is used only by GifTextureView, not by GifDrawable.
Note that this call will overwrite sample size set previously by sampleSize
- Parameters:
options
- null-ok; options controlling parameters like subsampling and opacity
-
from
T from(InputStream inputStream)
Wrapper of GifDrawable
- Parameters:
inputStream
- data source
-
from
T from(AssetFileDescriptor assetFileDescriptor)
Wrapper of GifDrawable
- Parameters:
assetFileDescriptor
- data source
-
from
T from(FileDescriptor fileDescriptor)
Wrapper of GifDrawable
- Parameters:
fileDescriptor
- data source
-
from
T from(AssetManager assetManager, String assetName)
Wrapper of GifDrawable
- Parameters:
assetManager
- assets sourceassetName
- asset file name
-
from
T from(ContentResolver contentResolver, Uri uri)
Wrapper of GifDrawable
- Parameters:
contentResolver
- resolver used to query{@code uri}
uri
- data source
-
from
T from(File file)
Wrapper of GifDrawable
- Parameters:
file
- data source
-
from
T from(String filePath)
Wrapper of GifDrawable
- Parameters:
filePath
- data source
-
from
T from(Array<byte> bytes)
Wrapper of GifDrawable
- Parameters:
bytes
- data source
-
from
T from(ByteBuffer byteBuffer)
Wrapper of GifDrawable
- Parameters:
byteBuffer
- data source
-
from
T from(Resources resources, int resourceId)
Wrapper of GifDrawable
- Parameters:
resources
- Resources to read fromresourceId
- resource id (data source)
-
getInputSource
InputSource getInputSource()
Getter for the input source.
-
getOldDrawable
GifDrawable getOldDrawable()
Getter for the old drawable.
-
getExecutor
ScheduledThreadPoolExecutor getExecutor()
Getter for the executor.
-
isRenderingTriggeredOnDraw
boolean isRenderingTriggeredOnDraw()
-
getOptions
GifOptions getOptions()
Getter for the GIF options.
-
-
-
-