-
Notifications
You must be signed in to change notification settings - Fork 27
AXrLottieGlideDecoder
AmirHosseinAghajari edited this page Oct 1, 2022
·
5 revisions
AXrLottieGlideDecoder is a Glide integration library for displaying AXrLottieDrawable.
// AXrLottieGlideDecoder
implementation 'io.github.aghajari:AXrLottieGlideDecoder:1.4.0'
// glide 4.10.0+
def GLIDE_VERSION = "4.14.0"
implementation "com.github.bumptech.glide:glide:${GLIDE_VERSION}"
annotationProcessor "com.github.bumptech.glide:compiler:${GLIDE_VERSION}"
- Load lottie from URL
final String url = "https://image-1.gapo.vn/images/kienht-gapo-sticker2.zip";
Glide.with(this)
.load(url)
.set(AXrLottieGlideOptions.ENABLED, true)
.set(AXrLottieGlideOptions.EXTENSION, ".zip")
.set(AXrLottieGlideOptions.NAME, url)
.set(AXrLottieGlideOptions.NETWORK, true)
.into(imageView);
- Load lottie from Assets
Glide.with(this)
.load(Uri.parse("file:///android_asset/loader.json"))
.set(AXrLottieGlideOptions.ENABLED, true)
.set(AXrLottieGlideOptions.NAME, "loader.json")
.set(AXrLottieGlideOptions.NETWORK, false)
.into(imageView);
- With AXrLottieOptions
AXrLottieOptions lottieOptions = new AXrLottieOptions()
.setAutoRepeat(AXrLottieDrawable.AUTO_REPEAT_INFINITE)
.setAutoRepeatMode(AXrLottieDrawable.REPEAT_MODE_REVERSE)
.setSpeed(2f);
Glide.with(this)
.load(Uri.parse("file:///android_asset/AnimatedSticker.tgs"))
.set(AXrLottieGlideOptions.ENABLED, true)
.set(AXrLottieGlideOptions.EXTENSION, ".tgs")
.set(AXrLottieGlideOptions.NAME, "AnimatedSticker.tgs")
.set(AXrLottieGlideOptions.NETWORK, false)
.set(AXrLottieGlideOptions.AUTO_START, false)
.set(AXrLottieGlideOptions.OPTIONS, lottieOptions)
.into(imageView);
- With thumbnail
final String url = "https://image-1.gapo.vn/images/kienht-gapo-sticker2.zip";
Glide.with(this)
.load(url)
.set(AXrLottieGlideOptions.ENABLED, true)
.set(AXrLottieGlideOptions.EXTENSION, ".zip")
.set(AXrLottieGlideOptions.NAME, url)
.set(AXrLottieGlideOptions.NETWORK, true)
.thumbnail(
Glide.with(this)
.load(Uri.parse("file:///android_asset/loader.json"))
.set(AXrLottieGlideOptions.ENABLED, true)
.set(AXrLottieGlideOptions.NAME, "loader.json")
.set(AXrLottieGlideOptions.NETWORK, false)
)
.into(imageView);
- ENABLED : Determines whether the request is related to AXrLottie or not. (Required)
- NAME : Specifies the cache name. (Required)
-
EXTENSION : Specifies the type of file format. (default =
.json
) - NETWORK : Used only to specify the cache path. (default = TRUE)
- AUTO_START : Determines whether the animation starts immediately or not. (default = TRUE)
- SIZE : Customizes the size of the lottie drawable.
- OPTIONS : Can be used to activate other AXrLottie options.
As default AXrLottie supports .zip
and .json
and the default extension is .json
!
You can add more extensions. Read...