Skip to content
This repository has been archived by the owner on Nov 4, 2022. It is now read-only.

Fix a bug, don't trigger onMoreAsked when adapter has no data or visi… #71

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

doubleDragon
Copy link

Hi, i found two problem when using SuperRecyclerView.
First, there is no necessary to trigger api{#link onMoreAsked()} when adapter has no data or visibleItemCount equal totalItemCount, i have fixed in my fork project from you repo.
Second, i suggest you invoke api{#link processOnMore()} when scroll state equal RecyclerView.SCROLL_STATE_IDLE, because sometimes api{#link onMoreAsked()} always trigger loadingMore after scroll down.My suggest code like below:

@OverRide
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if(newState == RecyclerView.SCROLL_STATE_IDLE) {
processOnMore();
}
}

@Malinskiy
Copy link
Owner

@doubleDragon Hi! Unfortunately if you do it this way there will be an edge case on initial start of view where you set the adapter with small number of items (not enough to fill in the screen). In this case I'd like to fetch more, but if you handle scroll state and data your way it won't call onMoreAsked.

But for the adapter case that is not set - feel free to create a PR for that, I'll merge it.

Let me know what you think

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

Successfully merging this pull request may close these issues.

2 participants