Skip to content

Commit

Permalink
Clear onVisibleAction once the action is taken (#2066)
Browse files Browse the repository at this point in the history
The root cause of #2053 is that once the fragment was paused and resumed, the onResumeAction was set to RESUME and never cleared. The compass view in the linked project triggered a relayout on every frame which caused the visibility action run over and over again. The animation itself happens to have an empty first frame so it appeared as if the animation disappeared.

Fixes #2053
  • Loading branch information
gpeal committed Apr 24, 2022
1 parent f0ff8a3 commit 61e8844
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java
Expand Up @@ -583,6 +583,7 @@ public void playAnimation() {
if (animationsEnabled() || getRepeatCount() == 0) {
if (isVisible()) {
animator.playAnimation();
onVisibleAction = OnVisibleAction.NONE;
} else {
onVisibleAction = OnVisibleAction.PLAY;
}
Expand Down Expand Up @@ -620,6 +621,7 @@ public void resumeAnimation() {
if (animationsEnabled() || getRepeatCount() == 0) {
if (isVisible()) {
animator.resumeAnimation();
onVisibleAction = OnVisibleAction.NONE;
} else {
onVisibleAction = OnVisibleAction.RESUME;
}
Expand Down

0 comments on commit 61e8844

Please sign in to comment.