Skip to content

matzuk/PaginationSample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PaginationSample

Sample of practical using of AutoLoadingRecyclerView and PaginationTool which transform common RecyclerView in RecyclerView with infinity pagination with RxJava help

Components

  1. com.matsyuk.pagination_sample.utils - AutoLoadingRecyclerView is a RecyclerView with the ability to add more items on it when reaches the end of the list, and PaginationTool is independent, more flexibla, stable and compact module which transform any RecyclerView in RecyclerView with infinity pagination. AutoLoadingRecyclerView and PaginationTool with correct error handling and reorienation screen handling
  2. com.matsyuk.pagination_sample.data - Fake data source for lists
  3. com.matsyuk.pagination_sample.ui - 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.

About

Sample of practical using of AutoLoadingRecyclerView and PaginationTool

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages