Closed brittonjg closed 8 years ago
Try a SwipeRefreshLayout http://developer.android.com/intl/es/training/swipe/add-swipe-interface.html
@brittonjg you might want to check out the source of the EndlessRecyclerOnScrollListener
should be possible to alter it, but would require some time.
If you do it, you can open a PR if you want ;)
@Rainer-Lang I am not sure what you mean, I have specifically removed swipe to refresh for this feature. Once the users reaches the top of the list, I am going to add new items above that once they have been retrieved from the server. This is a non standard UI feature.
@mikepenz Not an issue ;) I have completed the change in my project, but I haven't dealt with the current page implementation that you have. I'm not sure it makes much sense when scrolling up the list, because they would be negative, unless I always call it 0 and increase the total number.
I use getAdapterItem
which has an ID that I pass to the server to load previous content, but that is totally out of scope of FastAdapter.
@brittonjg Then you load previous items from a server when user reaches top?
@Rainer-Lang I load a different set of items.
In my case I have a set of game fixtures. The list starts at today's games and scrolls down for future games and up for previous games. So I have the potential to load future games at the bottom of the list and past games when the user reaches the top. Have I explained that better now?
@brittonjg Yes this explains it. :) So SwipeToRefresh is no option for you - I see.
@FabianTerhorst Maybe you could give a tip?
@Rainer-Lang I have it working now as per @mikepenz instructions, it's just the page number count and how you want that to work before I create a PR
@brittonjg I'm glad you did it :+1: perfect!
@brittonjg you can open the PR with the current implementation and we can have a discussion direct on the code. If you do the branch on a separate branch and create the PR from it, it is really easy to add additional commits to this PR
@mikepenz Will do. Maybe something for Monday though :)
@brittonjg did you by any chance finding a solution? I have the same requirement as you. Thanks.
For this i think we have to create another class with opposite logic.
@FabianTerhorst I tried but noticed RecyclerView.OnScrollListener#onScrolled was not called when user tries to scroll beyond the top. I probably can workaround it by adding extra items to both beginning of the list and the end of the list so that onScrolled is always triggered in either case. But just want to ask you guys first to find out if there is already a solution.
The new support lib version adds a new fling listener. Haven´t looked into it, but maybe its useful for that.
Request for enhancement: With the current
EndlessRecyclerOnScrollListener
it is possible to add more items to the bottom of the list. Would it be possible to add aonLoadMoreTop
toEndlessRecyclerOnScrollListener
, so that we know when the users reaches the threshold at the top of the list?