recyclerview-animators
recyclerview-animators copied to clipboard
Allow resetting the lastPosition so rows animate again
I have an infinite scroll implementation in place, which works wonderfully with this library. I also have pull to refresh setup, and I noticed that after I pull to refresh and all of my items are freshly re-populated...the rows don't animate anymore as they're revealed.
I believe this is due to the mLastPosition variable remembering the value from before the pull to refresh, so ideally I'd like a way to reset that back down to -1 so that views are animated again.
Is there support for this functionality already that I'm overlooking?
+1
+1, i m looking for the any solution to animate the recyclerview again.
Guys, i found a solution that is already coded by wasabeef. 10x again.
AlphaInAnimationAdapter alphaAdapter = new AlphaInAnimationAdapter(tga); ScaleInAnimationAdapter scaleAdapter = new ScaleInAnimationAdapter(alphaAdapter); scaleAdapter.setFirstOnly(false); //This line allows to animate the recyclerview again and again.
@brkckr this causes the rows to animate in every time, even after they are initially loaded. My use case is slightly different.
Let's say I have 20 total items, and I'm showing 5 at a time. When the fragment is first loaded and I scroll down, the 15 new rows all animate in perfectly. If I scroll up again, they do not animate in...since they have already been loaded.
If I then do a hard pull-to-refresh on the list, only the first 5 are shown again. Only now do I want the 15 new rows to re-animate as they appear.
Using setFirstOnly causes the items to always animate in, regardless of whether or not they had already been loaded previously. This may work for some use cases, but it's not exactly what I'm looking for.
EDIT: After looking into your suggestion, I did stumble across the setStartPosition method though...which does solve my use case. Calling setStartPosition(-1) appears to do the trick for me...so thanks for pointing me in the right direction!