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

Move window/view visibility handling from LottieAnimationView to LottieDrawable #1981

Merged
merged 1 commit into from
Jan 14, 2022

Conversation

gpeal
Copy link
Collaborator

@gpeal gpeal commented Jan 9, 2022

Previously, all of the logic to pause/resume Lottie animations on events such as hiding a view, backgrounding an app, etc. were handled by LottieAnimationView. This logic works fine for the default cause. However, LottieDrawable had no notion of visibility handling itself. As a result, if somebody were to use LottieDrawable on its own, they would have to get the lifecycle exactly right or else they could risk leaking animators and impacting the user's battery life.

This PR combines all of the logic into Drawable.setVisible. This also simplifies things because it is a single API vs views that have to deal with window attachment and visibility changes.

I ran all existing FragmentVisibilityTests and they all pass and the intention is to maintain backwards compatibility.

@LottieSnapshotBot
Copy link

Snapshot Tests
28: Report Diff

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

Successfully merging this pull request may close these issues.

3 participants