Animation canceling inside recyclerView
See original GitHub issueHi I’m using Lottie inside recyclerView.I put my json files inside asset folder.My goal is to play animation and when it finished then start activity.Here is a my source
`if (story.isRead) lottieAnimationView.setAnimation(“story_archive_gray.json”); else lottieAnimationView.setAnimation(“story_archive_blue.json”); rootView.setOnClickListener(view -> {
lottieAnimationView.addAnimatorListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
SPLogger.logMassage("animationListener","onAnimationEnd");
animation.cancel();
//call activity
}
@Override
public void onAnimationCancel(Animator animation) {
SPLogger.logMassage("animationListener","onAnimationCancel");
}
@Override
public void onAnimationRepeat(Animator animation) {
SPLogger.logMassage("animationListener","onAnimationRepeat");
}
});
lottieAnimationView.playAnimation();
});`
My problem is, sometimes can’t play animation successfully and onAnimationCancel called automatically .do you have any suggestion about my problem ? Thanks. Best regards
Issue Analytics
- State:
- Created 4 years ago
- Comments:16
Top Results From Across the Web
Lottie Animation canceling automatically in Android
I'm using lottie animation inside my recyclerView.Here is a my source if (story.isRead) lottieAnimationView.
Read more >Animations and Performance in Nested RecyclerViews - Reddit
To properly clean up the nested RecyclerView, release the ViewHolders back into the RecycledViewPool and to cancel running animations we ...
Read more >DefaultItemAnimator - Android Developers
This implementation of RecyclerView.ItemAnimator provides basic animations on remove, add, and move events that happen to the items in a RecyclerView.
Read more >RecyclerView animations - AndroidDevSummit write-up
It is worth recalling that RecyclerView. ItemAnimator is responsible only for animations between starting and final state of view. ...
Read more >RecyclerView Animations – Add & Remove Items
RecyclerView is a really useful way of displaying content in list form, particularly when the content is dynamic and / or there are...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@gpeal I am facing an opposite issue right now.
That is, if I play animation and scroll down in a
RecyclerViewbefore the animation finishes, and scroll back up, the animation plays from scratch again. I tried adding an animation listener and tried out some stuff inonAnimationCancel, such as setting the progress to1f, pausing, cancelling, setting animation composition again, and a combination of these; but could not get it to work. I’m pretty sure it’s not because of my logic to play animation (i.e. the code to start the animation does not get called again). I think it might internally be about the visibility changes that might be overriding anything I do.What I want to do is, if the animation is cancelled, I just wanna set the progress to 100% and show that as a static image. This works for the initial
onBindViewHoldercalls, because I do a similar thing for showing the current state of the image. Any ideas what could be going wrong? Would appreciate any help, thanks!I also encountered this , ` override fun onBindViewHolder(holder: MyViewHolder, position: Int) { val moment = momentList[position]