-
Notifications
You must be signed in to change notification settings - Fork 554
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
Automatically fetch first result on load more, scrolls the RecyclerView #490
Comments
@meness, what do you mean, how many items are loaded, and why you think that it scrolls? I don't see this in the demoApp. I think I really need a video and a way to reproduce it. |
adapter = new FlexibleAdapter<>(null);
adapter.setEndlessScrollListener(this, new ProgressItem()).setLoadingMoreAtStartUp(true); @Override
public void onLoadMore(int lastPosition, int currentPage) {
presenter.fetchOffProducts(adapter.getItemCount(), 25);
}
public void productsFetched(List<Product> products) {
List<IFlexible> items = new ArrayList<>();
for (Product product : products) {
items.add(new ProductItem(product));
}
adapter.onLoadMoreComplete(items);
} |
Hi @davideas , You can reproduce this in the sample app in the FragmentInstagramHeaders class. Just replace initializeRecyclerView code with
You init the recycler with 0 items, and setLoadingMoreAtStartUp to true. After the items are loaded the recycler is scrolled a bit down and is not at the first item. |
Ok, thanks, I will try to investigate why. |
An update about the not easy investigation. In You can reproduce the behavior by doing (which are the key calls in the mAdapter.addItems(0, newItems);
mAdapter.removeScrollableFooter(mProgressItem);
//mAdapter.onLoadMoreComplete(newItems, 1000L); This occurs in main example in endless fragment too, I followed the execution flow, but there's nothing I could identify the cause. But if you invert by the removing the progress item before the adding, then it seems to work as expected. Now, I need to evaluate the impact of this change. I will come later for a new update. |
I moved the adding after the removal of the progressItem, this preserves also the feature to delay the removal to display a message in the progressItem. I release this fix in the new SNAPSHOT in few moments... |
Hi,
There's a method to fetch first result on load more automatically, I tested it and I found it scrolls the
RecyclerView
but it shouldn't.The text was updated successfully, but these errors were encountered: