From ccf9a564964f83d590912bb8025013d1a5deadc4 Mon Sep 17 00:00:00 2001 From: Meisam Beiranvand Date: Mon, 14 Oct 2019 17:34:41 +0330 Subject: [PATCH 1/4] create README --- README.md | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..0dddcb1 --- /dev/null +++ b/README.md @@ -0,0 +1,97 @@ +# Paginated RecyclerView +[![](https://jitpack.io/v/softrunapp/Paginated-RecyclerView.svg)](https://jitpack.io/#softrunapp/Paginated-RecyclerView) + + +Android Paginated Recycler view Library + +## Preview + +
+preview +preview +preview + + + +## Gradle + +Add it in your root build.gradle at the end of repositories: + + + allprojects { + repositories { + ... + maven { url 'https://jitpack.io' } + } + } +Add the dependency: + + dependencies { + implementation 'com.github.softrunapp:Paginated-RecyclerView:1.0.0' + } + + + + +## Usage +Using Paginated RecyclerView is really simple. + +1. Create adapter class extends from PaginatedAdapter and set your model and your view holder: + +```java + public class MyAdapter extends PaginatedAdapter { + ... + @Override + public void onBindViewHolder(@NonNull ViewHolder holder, int position) { + getItem(position); //get item whit position + } + ... +``` + +2. Set items to your adapter in your Activity: + +```java + MyAdapter adapter = new MyAdapter(); + adapter.setDefaultRecyclerView(this, R.id.recyclerView); //set recyclerview with id and Activity. by default set LinearLayout for LayoutManager and setFixSize to true + adapter.setOnPaginationListener(new PaginatedAdapter.OnPaginationListener() { + @Override + public void onCurrentPage(int page) { + //current page which loaded in list + } + + @Override + public void onNextPage(int page) { + // call your method to get next page + } + + @Override + public void onFinish() { + // end of the list and all pages loaded + } + }); +``` + +3. Get first page of your data + +```java + adapter.submitItems(yourListData); +``` + +## Customization +most of them are self-explaining + +```java + MyAdapter adapter = new MyAdapter(); + //setters + adapter.setStartPage(1); //set first page of data. default value is 1. + adapter.setPageSize(10); //set page data size. default value is 10. + adapter.setRecyclerView(recyclerView); // set your RecyclerView with options + + //getters + adapter.getStartPage(); // return start page + adapter.getCurrentPage(); // return last page which loaded + adapter.getRecyclerView(); // return recycler view +``` +## Example + +## License From d7b37c8fc33a9e2819b5df27cc01bfa63bc706ca Mon Sep 17 00:00:00 2001 From: Meisam Beiranvand Date: Mon, 14 Oct 2019 17:39:59 +0330 Subject: [PATCH 2/4] Update README --- README.md | 43 +++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 0dddcb1..16c966d 100644 --- a/README.md +++ b/README.md @@ -2,16 +2,9 @@ [![](https://jitpack.io/v/softrunapp/Paginated-RecyclerView.svg)](https://jitpack.io/#softrunapp/Paginated-RecyclerView) -Android Paginated Recycler view Library - -## Preview - -
-preview -preview -preview - +Android Paginated Recycler view Library. +This is simple android library to pagination data in RecyclerView list. ## Gradle @@ -54,21 +47,21 @@ Using Paginated RecyclerView is really simple. MyAdapter adapter = new MyAdapter(); adapter.setDefaultRecyclerView(this, R.id.recyclerView); //set recyclerview with id and Activity. by default set LinearLayout for LayoutManager and setFixSize to true adapter.setOnPaginationListener(new PaginatedAdapter.OnPaginationListener() { - @Override - public void onCurrentPage(int page) { - //current page which loaded in list - } - - @Override - public void onNextPage(int page) { - // call your method to get next page - } - - @Override - public void onFinish() { - // end of the list and all pages loaded - } - }); + @Override + public void onCurrentPage(int page) { + //current page which loaded in list + } + + @Override + public void onNextPage(int page) { + // call your method to get next page + } + + @Override + public void onFinish() { + // end of the list and all pages loaded + } + }); ``` 3. Get first page of your data @@ -92,6 +85,4 @@ most of them are self-explaining adapter.getCurrentPage(); // return last page which loaded adapter.getRecyclerView(); // return recycler view ``` -## Example - ## License From ebe536a90dec37d1c0893b5a2d114fe6dd13398b Mon Sep 17 00:00:00 2001 From: Meisam Beiranvand Date: Mon, 14 Oct 2019 17:44:42 +0330 Subject: [PATCH 3/4] Create LICENSE --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..90a90c4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Meisam Beiranvand + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From e398211dc842a6ec191d1ea74694db21c29dc7b3 Mon Sep 17 00:00:00 2001 From: Meisam Beiranvand Date: Mon, 14 Oct 2019 17:45:52 +0330 Subject: [PATCH 4/4] update README --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index 16c966d..0e93c89 100644 --- a/README.md +++ b/README.md @@ -86,3 +86,24 @@ most of them are self-explaining adapter.getRecyclerView(); // return recycler view ``` ## License + MIT License + + Copyright (c) 2019 Meisam Beiranvand + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE.