Skip to content

Commit

Permalink
Fix LottieDrawable#start for non-View callbacks (#2056)
Browse files Browse the repository at this point in the history
Previously, the start function would be a noop if your callback was something other than a View instance.

With this change, if you use a non-View Callback (such as a Drawable), start will still call playAnimation; if the Callback was a View, it must still not be in edit mode to call playAnimation.
  • Loading branch information
ajarl committed Apr 13, 2022
1 parent bda22a1 commit 318b8ea
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java
Expand Up @@ -549,11 +549,12 @@ public void draw(Canvas canvas, Matrix matrix) {
@MainThread
@Override
public void start() {
// Don't auto play when in edit mode.
Callback callback = getCallback();
if (callback instanceof View && !((View) callback).isInEditMode()) {
playAnimation();
if (callback instanceof View && ((View) callback).isInEditMode()) {
// Don't auto play when in edit mode.
return;
}
playAnimation();
}

@MainThread
Expand Down

0 comments on commit 318b8ea

Please sign in to comment.