All Projects → luizgrp → Sectionedrecyclerviewadapter

luizgrp / Sectionedrecyclerviewadapter

Licence: mit
An Adapter that allows a RecyclerView to be split into Sections with headers and/or footers. Each Section can have its state controlled individually.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Sectionedrecyclerviewadapter

Poweradapter
Adapter for RecyclerView(only 21KB).RecyclerView万能适配器(仅21KB)
Stars: ✭ 112 (-93.25%)
Mutual labels:  adapter, recyclerview
Superadapter
[Deprecated]. 🚀 Adapter(BaseAdapter, RecyclerView.Adapter) wrapper for Android. 一个Adapter同时适用RecyclerView、ListView、GridView等。
Stars: ✭ 638 (-61.54%)
Mutual labels:  adapter, recyclerview
Flexibleadapter
Fast and versatile Adapter for RecyclerView which regroups several features into one library to considerably improve the user experience :-)
Stars: ✭ 3,482 (+109.89%)
Mutual labels:  adapter, recyclerview
Tableview
TableView is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells.
Stars: ✭ 2,928 (+76.49%)
Mutual labels:  adapter, recyclerview
Google Books Android Viewer
Android library to bridge between RecyclerView and sources like web page or database. Includes demonstrator (Google Books viewer)
Stars: ✭ 37 (-97.77%)
Mutual labels:  adapter, recyclerview
Boardview
A draggable boardview for java android (Kanban style)
Stars: ✭ 309 (-81.37%)
Mutual labels:  adapter, recyclerview
Multiitem
一个优雅的实现多类型的RecyclerView类库 支持DataBinding Form表单录入 跨多个RecyclerView拖动
Stars: ✭ 381 (-77.03%)
Mutual labels:  adapter, recyclerview
recycler-adapter
RecyclerView-driven declarative UIs
Stars: ✭ 124 (-92.53%)
Mutual labels:  adapter, recyclerview
Candyview
Implement any RecyclerView in just 1 Line. CandyView handles everything for you.
Stars: ✭ 15 (-99.1%)
Mutual labels:  adapter, recyclerview
Slimadapter
A slim & clean & typeable Adapter without# VIEWHOLDER
Stars: ✭ 939 (-43.4%)
Mutual labels:  adapter, recyclerview
adapster
Android library designed to enrich and make your RecyclerView adapters more SOLID
Stars: ✭ 17 (-98.98%)
Mutual labels:  adapter, recyclerview
Grouprecyclerviewadapter
可增删改查、可动画展开收起、可吸附悬浮动态可配置的分组列表
Stars: ✭ 41 (-97.53%)
Mutual labels:  adapter, recyclerview
GhostAdapter
No description or website provided.
Stars: ✭ 15 (-99.1%)
Mutual labels:  adapter, recyclerview
Fastadapter
The bullet proof, fast and easy to use adapter library, which minimizes developing time to a fraction...
Stars: ✭ 3,512 (+111.69%)
Mutual labels:  adapter, recyclerview
AdapterLayout
ViewGroup backed by RecyclerView.Adapter = magic
Stars: ✭ 58 (-96.5%)
Mutual labels:  adapter, recyclerview
Adapter
A quick adapter library for RecyclerView, GridView, ListView, ViewPager, Spinner
Stars: ✭ 376 (-77.34%)
Mutual labels:  adapter, recyclerview
GenericAdapter
⛳️ Easy to use android databinding ready recyclerview adapter
Stars: ✭ 26 (-98.43%)
Mutual labels:  adapter, recyclerview
GenericRecyclerAdapter
Easiest way to use RecyclerView. Reduce boilerplate code! You don't need to write adapters for listing pages anymore!
Stars: ✭ 53 (-96.81%)
Mutual labels:  adapter, recyclerview
Multityperecyclerviewadapter
一个专注于RecyclerView优雅刷新(接管资源和数据源)、高灵活、低耦合、健壮性以及高效性的MVP模式库,支持大多数Adapter
Stars: ✭ 763 (-54.01%)
Mutual labels:  adapter, recyclerview
Flagchatadapter
FlagChatAdapter is easy to implement enchanting recycler view adapter. Just extend your adapter with FlagChatAdapter, impliment some methods and voila! You have got the most beautiful looking chat on your phone. Zero boilerplate code, just put your variables in the right direction.
Stars: ✭ 39 (-97.65%)
Mutual labels:  adapter, recyclerview

⚠️ Archived: this repository is no longer going to be maintained.

SectionedRecyclerViewAdapter

An Adapter that allows a RecyclerView to be split into Sections with headers and/or footers.

Version Total Downloads Build Status codecov Android Arsenal

Linear Grid

In addition, each Section can have its state(Loading/Loaded/Failed/Empty) controlled individually.

Loading Loaded


Gradle Dependency

Step 1: Add jitpack repository to the top-level build.gradle file:
allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}
Step 2: Add this library to the module-level build.gradle file:
dependencies {
	...
	implementation 'com.github.luizgrp:SectionedRecyclerViewAdapter:v3.2.0'
}

Guide to upgrade to version 3.x here.

Latest version without AndroidX: 1.2.0.

Basic usage

1) Create a custom Section class:
class MySection extends Section {
    List<String> itemList = Arrays.asList("Item1", "Item2", "Item3");

    public MySection() {
        // call constructor with layout resources for this Section header and items
        super(SectionParameters.builder()
                .itemResourceId(R.layout.section_item)
                .headerResourceId(R.layout.section_header)
                .build());
    }

    @Override
    public int getContentItemsTotal() {
        return itemList.size(); // number of items of this section
    }

    @Override
    public RecyclerView.ViewHolder getItemViewHolder(View view) {
        // return a custom instance of ViewHolder for the items of this section
        return new MyItemViewHolder(view);
    }

    @Override
    public void onBindItemViewHolder(RecyclerView.ViewHolder holder, int position) {
        MyItemViewHolder itemHolder = (MyItemViewHolder) holder;

        // bind your view here
        itemHolder.tvItem.setText(itemList.get(position));
    }
    
    @Override
    public RecyclerView.ViewHolder getHeaderViewHolder(View view) {
        // return an empty instance of ViewHolder for the headers of this section
        return new EmptyViewHolder(view);
    }
}
2) Create a custom ViewHolder for the section items:
class MyItemViewHolder extends RecyclerView.ViewHolder {
    private final TextView tvItem;

    public MyItemViewHolder(View itemView) {
        super(itemView);

        tvItem = (TextView) itemView.findViewById(R.id.tvItem);
    }
}
3) Set up your RecyclerView with the SectionedRecyclerViewAdapter:
// Create an instance of SectionedRecyclerViewAdapter
SectionedRecyclerViewAdapter sectionAdapter = new SectionedRecyclerViewAdapter();

// Add your Sections
sectionAdapter.addSection(new MySection());

// Set up your RecyclerView with the SectionedRecyclerViewAdapter
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerview);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setAdapter(sectionAdapter);

Demo app

You can find a demo app here with many examples on how to implement:

Demo

Apps on Google Play using this library

License

The MIT License (MIT)

Copyright (c) 2016 Gustavo Pagani

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].