Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a Global Configuration to Default Cache Composition to Disabled #2485

Open
rluick15 opened this issue Mar 28, 2024 · 1 comment
Open

Comments

@rluick15
Copy link

Is your feature request related to a problem? Please describe.
Currently Lottie animations are cached by default and it is required to add the app:lottie_cacheComposition="false" flag in the xml on a per LottieAnimationView basis. This is a fairly easy thing to miss in cases where we do not desire a cache which can lead to large animations remaining in memory when we do not need them to be.

Describe the solution you'd like
Ideally this could be solved by a simple boolean field on the LottieConfig class to indicate if we want to globally default the cacheComposition value to false.

Describe alternatives you've considered
The only other alternative I see is to use LottieCompositionFactory.setMaxCacheSize and set it to 0 which totally disables the cache. While this may work for some, this does not work in cases where we want to selectively cache specific animations while not caching the majority of them.

Other future iterations could be a cap on memory size for the cache or maybe a configuration to only cache animations under a specific size.

@gpeal
Copy link
Collaborator

gpeal commented Apr 1, 2024

How would you imagine the API would look?

boolean field on the LottieConfig class to indicate if we want to globally default the cacheComposition value to false.

On the surface, your proposal sounds very similar to setting the max cache size to 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants