-
public final class LottieConfig.Builder
-
-
Field Summary
Fields Modifier and Type Field Description private LottieNetworkFetchernetworkFetcherprivate booleanenableSystraceMarkersprivate booleanenableNetworkCacheprivate booleandisablePathInterpolatorCacheprivate AsyncUpdatesdefaultAsyncUpdatesprivate ReducedMotionOptionreducedMotionOption
-
Method Summary
Modifier and Type Method Description LottieConfig.BuildersetNetworkFetcher(@NonNull() LottieNetworkFetcher fetcher)Lottie has a default network fetching stack built on java.net.HttpURLConnection. LottieConfig.BuildersetEnableSystraceMarkers(boolean enable)Enable this if you want to run systrace to debug the performance of animations. LottieConfig.BuildersetEnableNetworkCache(boolean enable)Disable this if you want to completely disable internal Lottie cache for retrieving network animations.Internal network cache is enabled by default. LottieConfig.BuildersetDisablePathInterpolatorCache(boolean disable)When parsing animations, Lottie has a path interpolator cache. LottieConfig.BuildersetDefaultAsyncUpdates(AsyncUpdates asyncUpdates)Sets the default value for async updates. LottieConfig.BuildersetReducedMotionOption(ReducedMotionOption reducedMotionOption)Provide your own reduce motion option. LottieConfig.BuildersetNetworkCacheDir(@NonNull() File file)Provide your own network cache directory. LottieConfig.BuildersetNetworkCacheProvider(@NonNull() LottieNetworkCacheProvider fileCacheProvider)Provide your own network cache provider. LottieConfigbuild()-
-
Method Detail
-
setNetworkFetcher
@NonNull() LottieConfig.Builder setNetworkFetcher(@NonNull() LottieNetworkFetcher fetcher)
Lottie has a default network fetching stack built on java.net.HttpURLConnection. However, if you would like to hook into your ownnetwork stack for performance, caching, or analytics, you may replace the internal stack with your own.
-
setEnableSystraceMarkers
@NonNull() LottieConfig.Builder setEnableSystraceMarkers(boolean enable)
Enable this if you want to run systrace to debug the performance of animations.
DO NOT leave this enabled in production. The overhead is low but non-zero.
-
setEnableNetworkCache
@NonNull() LottieConfig.Builder setEnableNetworkCache(boolean enable)
Disable this if you want to completely disable internal Lottie cache for retrieving network animations.Internal network cache is enabled by default.
-
setDisablePathInterpolatorCache
@NonNull() LottieConfig.Builder setDisablePathInterpolatorCache(boolean disable)
When parsing animations, Lottie has a path interpolator cache. This cache allows Lottie to reuse PathInterpolatorsacross an animation. This is desirable in most cases. However, when shared across screenshot tests, it can cause slightdeviations in the rendering due to underlying approximations in the PathInterpolator.
The cache is enabled by default and should probably only be disabled for screenshot tests.
-
setDefaultAsyncUpdates
@NonNull() LottieConfig.Builder setDefaultAsyncUpdates(AsyncUpdates asyncUpdates)
Sets the default value for async updates.
-
setReducedMotionOption
@NonNull() LottieConfig.Builder setReducedMotionOption(ReducedMotionOption reducedMotionOption)
Provide your own reduce motion option. By default it uses SystemReducedMotionOption,which returns ReducedMotionMode.REDUCED_MOTION when the system AnimationScale is set to 0.
You can override this behavior by providing your own custom ReducedMotionOption.You can also use IgnoreDisabledSystemAnimationsOption if you want to ignore the system settings and always play the full animation.
-
setNetworkCacheDir
@NonNull() LottieConfig.Builder setNetworkCacheDir(@NonNull() File file)
Provide your own network cache directory. By default, animations will be saved in your application's cacheDir/lottie_network_cache.
-
setNetworkCacheProvider
@NonNull() LottieConfig.Builder setNetworkCacheProvider(@NonNull() LottieNetworkCacheProvider fileCacheProvider)
Provide your own network cache provider. By default, animations will be saved in your application's cacheDir/lottie_network_cache.
-
build
@NonNull() LottieConfig build()
-
-
-
-