-
-
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
Make LottieAnimationView reusable #7
Conversation
try { | ||
adapter.setFiles(getContext().getAssets().list("")); | ||
adapter.setFiles(AssetUtils.getJsonAssets(getContext(), "")); |
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.
Directories were appearing in the list and caused a crash when tapped, so this filters out any non-json assets.
971eb1b
to
2b5468b
Compare
@@ -163,34 +167,54 @@ protected void onDetachedFromWindow() { | |||
public void recycleBitmaps() { | |||
if (mainBitmap != null) { | |||
mainBitmap.recycle(); | |||
mainBitmap = null; |
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.
Ah, thank you
@@ -260,16 +293,30 @@ private void setJsonSync(JSONObject json) { | |||
setComposition(composition); | |||
} | |||
|
|||
private void onAnimationLoadingFail() { | |||
isAnimationLoading = false; |
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.
Maybe set playAnimationWhenCompositionSet to false?
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.
Good point. Done.
2b5468b
to
0eca9b5
Compare
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 won't to string everything back to real data
Also added
Cycle
to the sample app that cycles through all the available animation using the sameLottieAnimationView
.