Problem with endless scrolling and LOAD_MORE_RESET delay
See original GitHub issueWorking with the endless scrolling feature and items limit per page in server replies, I found out that if the limit is small enough for whatever reason, the adapter loads just the first page (other than the initial one, so 2 pages).
This happens because the adapter’s onLoadMoreComplete
method sends the LOAD_MORE_RESET
message to the handler with a delay of 200L (not editable) and before this delay has passed, the viewholder calls the adapter’s onLoadMore but finds the mLoading
boolean to be true (because the handler is in charge of setting it to false upon receiving the LOAD_MORE_RESET message) and does nothing.
At this point it’s unable to re-trigger the onLoadMore method because there are few elements in the list for each pag so the recyclerview is not scrollable, the elements can’t be recycled and the built-in onBindViewHolder method (which calls the adapter’s onLoadMore) can’t be re-executed when the delay of the LOAD_MORE_RESET has passed.
I know this can be tricky to read but hope everything is clear. If something is not, please ask.
Is this actually a bug or am mis-implementing something?
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
@Aselox, I removed the delay, but I had to modify the code in more points. I will commit in rc1 branch and i will create a SNAPSHOT this evening or tomorrow evening. Now, the loading more automatically fills the screen even one by one, until it’s full or no load more, then you need to scroll down to trigger again the listener.
@borisdamato, please be aware that, Endless Scrolling is going to be changed very soon. In order to support the new features and a better logic, the behaviors and callbacks methods will be refactored.
Please check issue #233 for the latest developments.