public class LottieCompositionFactory
extends java.lang.Object
All factory methods take a cache key. The animation will be stored in an LRU cache for future use. In-progress tasks will also be held so they can be returned for subsequent requests for the same animation prior to the cache being populated.
| Modifier and Type | Method and Description |
|---|---|
static LottieTask<LottieComposition> |
fromAsset(android.content.Context context,
java.lang.String fileName)
Parse an animation from src/main/assets.
|
static LottieResult<LottieComposition> |
fromAssetSync(android.content.Context context,
java.lang.String fileName)
Parse an animation from src/main/assets.
|
static LottieTask<LottieComposition> |
fromJson(org.json.JSONObject json,
java.lang.String cacheKey)
Deprecated.
|
static LottieTask<LottieComposition> |
fromJsonInputStream(java.io.InputStream stream,
java.lang.String cacheKey)
Auto-closes the stream.
|
static LottieResult<LottieComposition> |
fromJsonInputStreamSync(java.io.InputStream stream,
java.lang.String cacheKey)
Return a LottieComposition for the given InputStream to json.
|
static LottieTask<LottieComposition> |
fromJsonReader(JsonReader reader,
java.lang.String cacheKey) |
static LottieResult<LottieComposition> |
fromJsonReaderSync(JsonReader reader,
java.lang.String cacheKey) |
static LottieTask<LottieComposition> |
fromJsonString(java.lang.String json,
java.lang.String cacheKey) |
static LottieResult<LottieComposition> |
fromJsonStringSync(java.lang.String json,
java.lang.String cacheKey)
Return a LottieComposition for the specified raw json string.
|
static LottieResult<LottieComposition> |
fromJsonSync(org.json.JSONObject json,
java.lang.String cacheKey)
Deprecated.
|
static LottieTask<LottieComposition> |
fromRawRes(android.content.Context context,
int rawRes)
Parse an animation from raw/res.
|
static LottieResult<LottieComposition> |
fromRawResSync(android.content.Context context,
int rawRes)
Parse an animation from raw/res.
|
static LottieTask<LottieComposition> |
fromUrl(android.content.Context context,
java.lang.String url)
Fetch an animation from an http url.
|
static LottieResult<LottieComposition> |
fromUrlSync(android.content.Context context,
java.lang.String url)
Fetch an animation from an http url.
|
static LottieTask<LottieComposition> |
fromZipStream(java.util.zip.ZipInputStream inputStream,
java.lang.String cacheKey) |
static LottieResult<LottieComposition> |
fromZipStreamSync(java.util.zip.ZipInputStream inputStream,
java.lang.String cacheKey)
Parses a zip input stream into a Lottie composition.
|
static void |
setMaxCacheSize(int size)
Set the maximum number of compositions to keep cached in memory.
|
public static void setMaxCacheSize(int size)
public static LottieTask<LottieComposition> fromUrl(android.content.Context context, java.lang.String url)
public static LottieResult<LottieComposition> fromUrlSync(android.content.Context context, java.lang.String url)
public static LottieTask<LottieComposition> fromAsset(android.content.Context context, java.lang.String fileName)
fromRawRes(Context, int) instead.
The asset file name will be used as a cache key so future usages won't have to parse the json again.
However, if your animation has images, you may package the json and images as a single flattened zip file in assets.fromZipStream(ZipInputStream, String)public static LottieResult<LottieComposition> fromAssetSync(android.content.Context context, java.lang.String fileName)
fromRawRes(Context, int) instead.
The asset file name will be used as a cache key so future usages won't have to parse the json again.
However, if your animation has images, you may package the json and images as a single flattened zip file in assets.public static LottieTask<LottieComposition> fromRawRes(android.content.Context context, int rawRes)
public static LottieResult<LottieComposition> fromRawResSync(android.content.Context context, int rawRes)
public static LottieTask<LottieComposition> fromJsonInputStream(java.io.InputStream stream, java.lang.String cacheKey)
public static LottieResult<LottieComposition> fromJsonInputStreamSync(java.io.InputStream stream, java.lang.String cacheKey)
@Deprecated public static LottieTask<LottieComposition> fromJson(org.json.JSONObject json, java.lang.String cacheKey)
fromJsonSync(JSONObject, String)@Deprecated public static LottieResult<LottieComposition> fromJsonSync(org.json.JSONObject json, java.lang.String cacheKey)
public static LottieTask<LottieComposition> fromJsonString(java.lang.String json, java.lang.String cacheKey)
fromJsonStringSync(String, String)public static LottieResult<LottieComposition> fromJsonStringSync(java.lang.String json, java.lang.String cacheKey)
public static LottieTask<LottieComposition> fromJsonReader(JsonReader reader, java.lang.String cacheKey)
public static LottieResult<LottieComposition> fromJsonReaderSync(JsonReader reader, java.lang.String cacheKey)
public static LottieTask<LottieComposition> fromZipStream(java.util.zip.ZipInputStream inputStream, java.lang.String cacheKey)
public static LottieResult<LottieComposition> fromZipStreamSync(java.util.zip.ZipInputStream inputStream, java.lang.String cacheKey)