-
- All Implemented Interfaces:
-
android.os.Parcelable,java.io.Serializable
public class GifAnimationMetaData implements Serializable, Parcelable
Lightweight version of pl.droidsonroids.gif.GifDrawable used to retrieve metadata of GIF only, without having to allocate the memory for its pixels.
-
-
Field Summary
Fields Modifier and Type Field Description public final static Parcelable.Creator<GifAnimationMetaData>CREATOR
-
Constructor Summary
Constructors Constructor Description GifAnimationMetaData(Resources res, int id)Retrieves from resource. GifAnimationMetaData(AssetManager assets, String assetName)Retrieves metadata from asset. GifAnimationMetaData(String filePath)Constructs metadata from given file path. GifAnimationMetaData(File file)Equivalent to {@code}GifMetadata(file.GifAnimationMetaData(InputStream stream)Retrieves metadata from InputStream.InputStream must support marking, IllegalArgumentException will be thrown otherwise. GifAnimationMetaData(AssetFileDescriptor afd)Retrieves metadata from AssetFileDescriptor. GifAnimationMetaData(FileDescriptor fd)Retrieves metadata from FileDescriptor GifAnimationMetaData(Array<byte> bytes)Retrieves metadata from byte array. GifAnimationMetaData(ByteBuffer buffer)Retrieves metadata from ByteBuffer. GifAnimationMetaData(ContentResolver resolver, Uri uri)Retrieves metadata from android.net.Uri which is resolved using {@code resolver}.
-
Method Summary
Modifier and Type Method Description intgetWidth()intgetHeight()intgetNumberOfFrames()intgetLoopCount()See getLoopCount intgetDuration()See getDuration booleanisAnimated()longgetAllocationByteCount()Like getAllocationByteCount but does not include memory needed for backing android.graphics.Bitmap. longgetDrawableAllocationByteCount(@Nullable() GifDrawable oldDrawable, @IntRange(from = 1, to = Character.MAX_VALUE) int sampleSize)Like getAllocationByteCount but includes also backing android.graphics.Bitmap and takes sample size into account. longgetMetadataAllocationByteCount()SeegetMetadataAllocationByteCount StringtoString()intdescribeContents()voidwriteToParcel(Parcel dest, int flags)-
-
Constructor Detail
-
GifAnimationMetaData
GifAnimationMetaData(Resources res, int id)
Retrieves from resource.- Parameters:
res- Resources to read fromid- resource id
-
GifAnimationMetaData
GifAnimationMetaData(AssetManager assets, String assetName)
Retrieves metadata from asset.- Parameters:
assets- AssetManager to read fromassetName- name of the asset
-
GifAnimationMetaData
GifAnimationMetaData(String filePath)
Constructs metadata from given file path.- Parameters:
filePath- path to the GIF file
-
GifAnimationMetaData
GifAnimationMetaData(File file)
Equivalent to{@code}GifMetadata(file.- Parameters:
file- the GIF file
-
GifAnimationMetaData
GifAnimationMetaData(InputStream stream)
Retrieves metadata from InputStream.InputStream must support marking, IllegalArgumentException will be thrown otherwise.- Parameters:
stream- stream to read from
-
GifAnimationMetaData
GifAnimationMetaData(AssetFileDescriptor afd)
Retrieves metadata from AssetFileDescriptor.- Parameters:
afd- source
-
GifAnimationMetaData
GifAnimationMetaData(FileDescriptor fd)
Retrieves metadata from FileDescriptor- Parameters:
fd- source
-
GifAnimationMetaData
GifAnimationMetaData(Array<byte> bytes)
Retrieves metadata from byte array.- Parameters:
bytes- raw GIF bytes
-
GifAnimationMetaData
GifAnimationMetaData(ByteBuffer buffer)
Retrieves metadata from ByteBuffer.- Parameters:
buffer- buffer containing GIF data
-
GifAnimationMetaData
GifAnimationMetaData(ContentResolver resolver, Uri uri)
Retrieves metadata from android.net.Uri which is resolved using{@code resolver}.- Parameters:
resolver- resolver, null is allowed for file:// scheme Uris onlyuri- GIF Uri, cannot be null.
-
-
Method Detail
-
getWidth
int getWidth()
-
getHeight
int getHeight()
-
getNumberOfFrames
int getNumberOfFrames()
-
getLoopCount
int getLoopCount()
See getLoopCount
-
getDuration
int getDuration()
See getDuration
-
isAnimated
boolean isAnimated()
-
getAllocationByteCount
long getAllocationByteCount()
Like getAllocationByteCount but does not include memory needed for backing android.graphics.Bitmap.
{@code Bitmap}in{@code GifDrawable}may be allocated at the time of creation or existing one may be reused if with is used.This method assumes no subsampling (sample size = 1).To calculate allocation byte count of GifDrawable created from the same input source getDrawableAllocationByteCount can be used.
-
getDrawableAllocationByteCount
@Beta() long getDrawableAllocationByteCount(@Nullable() GifDrawable oldDrawable, @IntRange(from = 1, to = Character.MAX_VALUE) int sampleSize)
Like getAllocationByteCount but includes also backing android.graphics.Bitmap and takes sample size into account.
- Parameters:
oldDrawable- optional old drawable to be reused, pass{@code null}if there is no onesampleSize- sample size, pass{@code 1}if not using subsampling
-
getMetadataAllocationByteCount
long getMetadataAllocationByteCount()
-
describeContents
int describeContents()
-
writeToParcel
void writeToParcel(Parcel dest, int flags)
-
-
-
-