public class ReEncodingGifResourceEncoder extends Object implements ResourceEncoder<GifDrawable>
ResourceEncoder
that can write
GifDrawable
to cache.Modifier and Type | Field and Description |
---|---|
static Option<Boolean> |
ENCODE_TRANSFORMATION
A boolean option that, if set to
true , causes the fully transformed
GIF to be written to cache. |
Constructor and Description |
---|
ReEncodingGifResourceEncoder(Context context,
BitmapPool bitmapPool) |
Modifier and Type | Method and Description |
---|---|
boolean |
encode(Resource<GifDrawable> resource,
File file,
Options options)
Writes the given data to the given output stream and returns True if the write completed
successfully and should be committed.
|
EncodeStrategy |
getEncodeStrategy(Options options) |
public static final Option<Boolean> ENCODE_TRANSFORMATION
true
, causes the fully transformed
GIF to be written to cache.
Warning - encoding GIFs is slow and often produces larger and less efficient GIFs than the originals. Re-encoding may be worth it to decrease the size of very large GIFs.
Defaults to false
.
public ReEncodingGifResourceEncoder(@NonNull Context context, @NonNull BitmapPool bitmapPool)
@NonNull public EncodeStrategy getEncodeStrategy(@NonNull Options options)
getEncodeStrategy
in interface ResourceEncoder<GifDrawable>
public boolean encode(@NonNull Resource<GifDrawable> resource, @NonNull File file, @NonNull Options options)
Encoder
encode
in interface Encoder<Resource<GifDrawable>>
resource
- The data to write.file
- The File to write the data to.options
- The put of options to apply when encoding.