{"id":15130662,"url":"https://github.com/luizgrp/sectionedrecyclerviewadapter","last_synced_at":"2025-09-28T20:31:54.639Z","repository":{"id":41067094,"uuid":"51262014","full_name":"luizgrp/SectionedRecyclerViewAdapter","owner":"luizgrp","description":"An Adapter that allows a RecyclerView to be split into Sections with headers and/or footers. Each Section can have its state controlled individually.","archived":true,"fork":false,"pushed_at":"2022-02-27T11:51:14.000Z","size":1650,"stargazers_count":1678,"open_issues_count":0,"forks_count":370,"subscribers_count":40,"default_branch":"master","last_synced_at":"2024-12-07T05:30:32.336Z","etag":null,"topics":["adapter","android","android-library","recyclerview"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luizgrp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-07T19:27:52.000Z","updated_at":"2024-11-16T06:52:08.000Z","dependencies_parsed_at":"2022-08-10T01:29:46.174Z","dependency_job_id":null,"html_url":"https://github.com/luizgrp/SectionedRecyclerViewAdapter","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luizgrp%2FSectionedRecyclerViewAdapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luizgrp%2FSectionedRecyclerViewAdapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luizgrp%2FSectionedRecyclerViewAdapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luizgrp%2FSectionedRecyclerViewAdapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luizgrp","download_url":"https://codeload.github.com/luizgrp/SectionedRecyclerViewAdapter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234563123,"owners_count":18853056,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adapter","android","android-library","recyclerview"],"created_at":"2024-09-26T03:03:25.360Z","updated_at":"2025-09-28T20:31:53.932Z","avatar_url":"https://github.com/luizgrp.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":":warning: **Archived**: this repository is no longer going to be maintained.\n\n# SectionedRecyclerViewAdapter\n\nAn Adapter that allows a RecyclerView to be split into Sections with headers and/or footers.\n\n[![](https://jitpack.io/v/luizgrp/SectionedRecyclerViewAdapter.svg)](https://jitpack.io/#luizgrp/SectionedRecyclerViewAdapter)\n[![Build Status](https://travis-ci.org/luizgrp/SectionedRecyclerViewAdapter.svg?branch=master)](https://travis-ci.org/luizgrp/SectionedRecyclerViewAdapter)\n[![codecov](https://codecov.io/gh/luizgrp/SectionedRecyclerViewAdapter/branch/master/graph/badge.svg)](https://codecov.io/gh/luizgrp/SectionedRecyclerViewAdapter)\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-SectionedRecyclerViewAdapter-green.svg?style=true)](https://android-arsenal.com/details/1/3471)\n\n![Linear](art/sc1.png)\n![Grid](art/sc4.png)\n\nIn addition, each Section can have its state(Loading/Loaded/Failed/Empty) controlled individually.\n\n![Loading](art/sc2.png)\n![Loaded](art/sc3.png)\n\n---\n\n## Gradle Dependency\n\n##### Step 1: Add jitpack repository to the [top-level](https://developer.android.com/studio/build#top-level) build.gradle file: \n```groovy\nallprojects {\n\trepositories {\n\t\t...\n\t\tmaven { url 'https://jitpack.io' }\n\t}\n}\n```\n\n##### Step 2: Add this library to the [module-level](https://developer.android.com/studio/build#module-level) build.gradle file:\n\n```groovy\ndependencies {\n\t...\n\timplementation 'com.github.luizgrp:SectionedRecyclerViewAdapter:v3.2.0'\n}\n```\n\nGuide to upgrade to version 3.x [here](https://github.com/luizgrp/SectionedRecyclerViewAdapter/wiki/Upgrading-to-3.x).\n\nLatest version without AndroidX: `1.2.0`.\n\n## Basic usage\n\n##### 1) Create a custom Section class:\n\n```java\nclass MySection extends Section {\n    List\u003cString\u003e itemList = Arrays.asList(\"Item1\", \"Item2\", \"Item3\");\n\n    public MySection() {\n        // call constructor with layout resources for this Section header and items\n        super(SectionParameters.builder()\n                .itemResourceId(R.layout.section_item)\n                .headerResourceId(R.layout.section_header)\n                .build());\n    }\n\n    @Override\n    public int getContentItemsTotal() {\n        return itemList.size(); // number of items of this section\n    }\n\n    @Override\n    public RecyclerView.ViewHolder getItemViewHolder(View view) {\n        // return a custom instance of ViewHolder for the items of this section\n        return new MyItemViewHolder(view);\n    }\n\n    @Override\n    public void onBindItemViewHolder(RecyclerView.ViewHolder holder, int position) {\n        MyItemViewHolder itemHolder = (MyItemViewHolder) holder;\n\n        // bind your view here\n        itemHolder.tvItem.setText(itemList.get(position));\n    }\n    \n    @Override\n    public RecyclerView.ViewHolder getHeaderViewHolder(View view) {\n        // return an empty instance of ViewHolder for the headers of this section\n        return new EmptyViewHolder(view);\n    }\n}\n```\n\n##### 2) Create a custom ViewHolder for the section items:\n\n```java\nclass MyItemViewHolder extends RecyclerView.ViewHolder {\n    private final TextView tvItem;\n\n    public MyItemViewHolder(View itemView) {\n        super(itemView);\n\n        tvItem = (TextView) itemView.findViewById(R.id.tvItem);\n    }\n}\n```\n\n##### 3) Set up your RecyclerView with the SectionedRecyclerViewAdapter:\n\n```java\n// Create an instance of SectionedRecyclerViewAdapter\nSectionedRecyclerViewAdapter sectionAdapter = new SectionedRecyclerViewAdapter();\n\n// Add your Sections\nsectionAdapter.addSection(new MySection());\n\n// Set up your RecyclerView with the SectionedRecyclerViewAdapter\nRecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview);\nrecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));\nrecyclerView.setAdapter(sectionAdapter);\n```\n\n## Demo app\n\nYou can find a demo app [here](app) with many examples on how to implement:\n\n- [Section with Header](app/src/main/java/io/github/luizgrp/sectionedrecyclerviewadapter/demo/example1/)\n- [Section with Header and Footer](app/src/main/java/io/github/luizgrp/sectionedrecyclerviewadapter/demo/example2/)\n- [Section with States](app/src/main/java/io/github/luizgrp/sectionedrecyclerviewadapter/demo/example3/)\n- [Expandable Section](app/src/main/java/io/github/luizgrp/sectionedrecyclerviewadapter/demo/example4/)\n- [Grid Section with Header](app/src/main/java/io/github/luizgrp/sectionedrecyclerviewadapter/demo/example5/)\n- [Expandable Grid Section](app/src/main/java/io/github/luizgrp/sectionedrecyclerviewadapter/demo/example6/)\n- [SearchView with Sections](app/src/main/java/io/github/luizgrp/sectionedrecyclerviewadapter/demo/example7/)\n- [Animations](app/src/main/java/io/github/luizgrp/sectionedrecyclerviewadapter/demo/example8/)\n- [Payloads](app/src/main/java/io/github/luizgrp/sectionedrecyclerviewadapter/demo/example9/)\n\n![Demo](art/demosc.png)\n\n## Apps on Google Play using this library\n\n- [JStock](https://play.google.com/store/apps/details?id=org.yccheok.jstock.gui)\n- [WeNote](https://play.google.com/store/apps/details?id=com.yocto.wenote)\n\n## License\n\n    The MIT License (MIT)\n\n    Copyright (c) 2016 Gustavo Pagani\n\n    Permission is hereby granted, free of charge, to any person obtaining a copy\n    of this software and associated documentation files (the \"Software\"), to deal\n    in the Software without restriction, including without limitation the rights\n    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n    copies of the Software, and to permit persons to whom the Software is\n    furnished to do so, subject to the following conditions:\n\n    The above copyright notice and this permission notice shall be included in all\n    copies or substantial portions of the Software.\n\n    THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n    SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluizgrp%2Fsectionedrecyclerviewadapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluizgrp%2Fsectionedrecyclerviewadapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluizgrp%2Fsectionedrecyclerviewadapter/lists"}