Coder Social home page Coder Social logo

paginationhandler's Introduction

PaginationHandler

You can handle pagination with this project, I've put one sample code in HowToUse file in project directory an i will write one sample class and test for this as soon I can, but I will explain here either.


For handling pagination in your project you must use following codes:

   new PaginationHandler.Builder()
            .setRecyclerView(recyclerView)  // set recyclerView that you want to handle pagination
            .setOffsetCount(5)    // set row count until end of list to load more happened
            .setLoadMoreListener(new PaginationInterface() {      // handle loadMore,
                @Override
                public void onLoadMore(final PaginationCompletionInterface pageComplete) {
                   
                }
            }).build();
  • In first line you've create new object of PaginationHandler by Builder class,
  • then you set RecyclerView object ( this line is mandatory and you must put it ), be sure you set adapter and layoutManager to your recyclerView, so first you must init your recyclerView with layoutManager and Adapter, then use this snippet code
  • In next line we set offsetCount value, this value is declare where you want to send loadMore request from last, 5 is means when I've reach to 5 last row in recyclerView, send loadMore request, default value is 3
  • You must to setLoadMoreListener to put your pagination code into there, after scroll reach to your desire position, onLoadMore will be called,
  • PaginationCompleteInterface is an interface that you use it when your job has been completed with loadMore to tell PaginationHandler to be ready for next request
  • then use build() method to create your method.
  • You can use your custom LayoutManager class, if your class is not instance of LinearLayoutManager, GridLayoutManager or StaggeredGridLayoutManager you MUST SET setFindLastItemInLayoutManagerInterface in builder object, setColumncount is an optional method when your layoutManager has more than one column.

With new Version You can manage pagination from top either, for getting how you can do it please see Home.class file, I've put everything there

Contribution

Comments, contributions and patches are greatly appreciated.

License

The MIT License (MIT).

paginationhandler's People

Contributors

shayanpourvatan avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

paginationhandler's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.