-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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 LottieAnimationView.setProgress called from the view init method prevents the progress from being restored from the saved state #2072
Fix LottieAnimationView.setProgress called from the view init method prevents the progress from being restored from the saved state #2072
Conversation
If you were to set an initial progress but then were to subsequently change it or play the animation, wouldn't restoration overwrite the saved progress with what is set in XML? |
@gpeal I think it makes sense to check whether there is a progress attribute set in the XML and if yes - treat it as user-provided and prevent saved state restoration from overwriting the progress value. Also it will be nice to provide an option to restore saved progress even if the progress is set in the XML. I suggest adding an attribute named |
@flaringapp I'm still trying to wrap my head around the exact use case that's failing here. Could you create a sample project that highlights the issue? |
@gpeal Please take a look at this sample project |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay thanks for the sample. I've been very busy lately but found some time to take a look at this. let's move forward with your implementation as-is. Just swap the parameter order here but other than that, LGTM. Thanks for doing this.
setProgressInternal(true, progress); | ||
} | ||
|
||
private void setProgressInternal( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you swap the parameter order here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gpeal Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've rebased on master as well
…prevents the progress from being restored from the saved state
See #2069