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

Allow resetting the lastPosition so rows animate again #57

Open
ThePromoter opened this issue Nov 19, 2015 · 4 comments
Open

Allow resetting the lastPosition so rows animate again #57

ThePromoter opened this issue Nov 19, 2015 · 4 comments

Comments

@ThePromoter
Copy link

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?

@maksimkurb
Copy link

+1

@brkckr
Copy link

brkckr commented Dec 6, 2015

+1, i m looking for the any solution to animate the recyclerview again.

@brkckr
Copy link

brkckr commented Dec 7, 2015

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.

@ThePromoter
Copy link
Author

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants