Awesome
PaginationSample
Sample of practical using of AutoLoadingRecyclerView and PaginationTool which transform common RecyclerView in RecyclerView with infinity pagination with RxJava help
Components
- <b>com.matsyuk.pagination_sample.utils</b> - <b><i>AutoLoadingRecyclerView</i></b> is a RecyclerView with the ability to add more items on it when reaches the end of the list, and <b><i>PaginationTool</i></b> is independent, more flexibla, stable and compact module which transform any RecyclerView in RecyclerView with infinity pagination. <b><i>AutoLoadingRecyclerView</i></b> and <b><i>PaginationTool</i></b> with correct error handling and reorienation screen handling
- <b>com.matsyuk.pagination_sample.data</b> - Fake data source for lists
- <b>com.matsyuk.pagination_sample.ui</b> - samples of practical using
Description
Article about AutoLoadingRecyclerView - http://habrahabr.ru/post/268991/
Article about PaginationTool - http://habrahabr.ru/post/271875/
Example of PaginationTool using
// RecyclerView pagination
PaginationTool<List<Item>> paginationTool = PaginationTool.
buildPagingObservable(
recyclerView,
offset -> EmulateResponseManager.getInstance().getEmulateResponse(offset, LIMIT))
.setLimit(LIMIT)
.build();
pagingSubscription = paginationTool
.getPagingObservable()
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Subscriber<List<Item>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(List<Item> items) {
recyclerViewAdapter.addNewItems(items);
recyclerViewAdapter.notifyItemInserted(recyclerViewAdapter.getItemCount() - items.size());
}
});
License
Copyright 2015 Eugene Matsyuk (matzuk2@mail.ru)
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.