Skip to content

Commit

Permalink
Respect autoPlay when setting a new composition (#2469)
Browse files Browse the repository at this point in the history
Fixes #2464
  • Loading branch information
gpeal committed Feb 27, 2024
1 parent 16e95c4 commit 5ad8744
Showing 1 changed file with 4 additions and 0 deletions.
Expand Up @@ -641,6 +641,9 @@ public void setComposition(@NonNull LottieComposition composition) {

ignoreUnschedule = true;
boolean isNewComposition = lottieDrawable.setComposition(composition);
if (autoPlay) {
lottieDrawable.playAnimation();
}
ignoreUnschedule = false;
if (getDrawable() == lottieDrawable && !isNewComposition) {
// We can avoid re-setting the drawable, and invalidating the view, since the composition
Expand Down Expand Up @@ -1080,6 +1083,7 @@ public <T> void addValueCallback(KeyPath keyPath, T property,

@MainThread
public void cancelAnimation() {
autoPlay = false;
userActionsTaken.add(UserActionTaken.PLAY_OPTION);
lottieDrawable.cancelAnimation();
}
Expand Down

0 comments on commit 5ad8744

Please sign in to comment.