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

Fix LottieDrawable#start for non-View callbacks #2056

Merged
merged 2 commits into from Apr 13, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java
Expand Up @@ -551,7 +551,7 @@ public void draw(Canvas canvas, Matrix matrix) {
public void start() {
// Don't auto play when in edit mode.
Callback callback = getCallback();
if (callback instanceof View && !((View) callback).isInEditMode()) {
if (!(callback instanceof View) || !((View) callback).isInEditMode()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about this a bit more, it might be easier to read as if (is View && isInEditMode() return
The double negative with an or requires too much thought to grok 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed!

playAnimation();
}
}
Expand Down