-
Notifications
You must be signed in to change notification settings - Fork 183
Quick start with Load More Indicator
Vitaly Vivchar edited this page Feb 17, 2018
·
6 revisions
Step 1: Register the LoadMoreViewRenderer in your adapter
mRecyclerViewAdapter.registerRenderer(new LoadMoreViewRenderer(R.layout.your_load_more_layout, this));
Step 2: Create an EndlessScrollListener or use any other for example: https://stackoverflow.com/a/29893272/4894238
Step 3: Add call of the showLoadMore method
mRecyclerView.addOnScrollListener(new EndlessScrollListener() {
@Override
public void onLoadMore(int page, int totalItemsCount) {
mRecyclerViewAdapter.showLoadMore();
//send request to a server
}
});
Note: If you need you can manually hide the Load More Indicator:
mRecyclerViewAdapter.hideLoadMore();
Step 4: When a response will be received just call the setItems The Load More Indicator will be hidden automatically
public void updateList(List<ItemModel> list) {
mRecyclerViewAdapter.setItems(list);
}