All Projects → Commit451 → AdapterLayout

Commit451 / AdapterLayout

Licence: Apache-2.0 License
ViewGroup backed by RecyclerView.Adapter = magic

Programming Languages

kotlin
9241 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to AdapterLayout

Dsladapter
🔥 Kotlin时代的Adapter, Dsl 的形式使用 RecyclerView.Adapter, 支持折叠展开, 树结构,悬停,情感图状态切换, 加载更多, 多类型Item,侧滑菜单等
Stars: ✭ 231 (+298.28%)
Mutual labels:  adapter, recyclerview
Modular2Recycler
Modular²Recycler is a RecyclerView.Adapter that is modular squared.
Stars: ✭ 72 (+24.14%)
Mutual labels:  adapter, recyclerview
InstantRecyclerView
A library that helps to implement a complex list with RecyclerView.(RecyclerView使用的封装与优化,帮助你快速利用RecyclerView构建复杂列表)
Stars: ✭ 22 (-62.07%)
Mutual labels:  adapter, recyclerview
Easyadapter
This project demonstrates simple approach for implementation complex lists, based on RecyclerView.
Stars: ✭ 187 (+222.41%)
Mutual labels:  adapter, recyclerview
TheGreatAdapter
Multiple items adapter made too easy, including headers and footers.
Stars: ✭ 46 (-20.69%)
Mutual labels:  adapter, recyclerview
Multiselectadapter
MultiSelectAdapter可以让你的Adapter快速实现多选和批量操作
Stars: ✭ 195 (+236.21%)
Mutual labels:  adapter, recyclerview
recycler-adapter
RecyclerView-driven declarative UIs
Stars: ✭ 124 (+113.79%)
Mutual labels:  adapter, recyclerview
Kotlin Adapter
🔥 RecyclerView,AbsListView适配器, 支持多种视图样式, 支持吸顶、侧滑删除、拖拽效果
Stars: ✭ 132 (+127.59%)
Mutual labels:  adapter, recyclerview
MixAdapter
Compose multiple Adapter for RecyclerView in Android
Stars: ✭ 19 (-67.24%)
Mutual labels:  adapter, recyclerview
ARVI
Android library designed to simplify the implementation of the video autoplay in the RecyclerView
Stars: ✭ 69 (+18.97%)
Mutual labels:  adapter, recyclerview
Sherlockadapter
一个万能的封装了RecyclerView.Adapter的功能库。
Stars: ✭ 186 (+220.69%)
Mutual labels:  adapter, recyclerview
GenericAdapter
⛳️ Easy to use android databinding ready recyclerview adapter
Stars: ✭ 26 (-55.17%)
Mutual labels:  adapter, recyclerview
Easyadapter
Android 轻量级适配器,简化使用,适应所有的AbsListView、RecyclerView。支持HeaderView与FooterView~
Stars: ✭ 160 (+175.86%)
Mutual labels:  adapter, recyclerview
Commonadapter
一个适用于ListView/GridView/RecyclerView的Adapter库,简化大量重复代码,支持多种布局,可自定义图片加载的实现。
Stars: ✭ 219 (+277.59%)
Mutual labels:  adapter, recyclerview
Recyclerviewadapter
A RecyclerView Adapter that support load more and add headerview
Stars: ✭ 141 (+143.1%)
Mutual labels:  adapter, recyclerview
MultiTypeAdapter
RecyclerView通用多类型适配器MultiTypeAdapter,以布局文件为单位更细粒度的条目复用。
Stars: ✭ 18 (-68.97%)
Mutual labels:  adapter, recyclerview
Poweradapter
Adapter for RecyclerView(only 21KB).RecyclerView万能适配器(仅21KB)
Stars: ✭ 112 (+93.1%)
Mutual labels:  adapter, recyclerview
Sectionedrecyclerviewadapter
An Adapter that allows a RecyclerView to be split into Sections with headers and/or footers. Each Section can have its state controlled individually.
Stars: ✭ 1,659 (+2760.34%)
Mutual labels:  adapter, recyclerview
PrimeAdapter
PrimeAdapter makes working with RecyclerView easier.
Stars: ✭ 54 (-6.9%)
Mutual labels:  adapter, recyclerview
RecyclerViewAdapter
A RecyclerView Adapter that support load more and add headerview
Stars: ✭ 145 (+150%)
Mutual labels:  adapter, recyclerview

AdapterLayout

ViewGroup backed by RecyclerView.Adapter, allowing for easy data set manipulation with non recycling views. Aka RecyclerView minus the recycling.

Build Status

Dependency

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}

and within your application build.gradle

dependencies {
    implementation 'com.github.Commit451.AdapterLayout:adapterlayout:latest.release.here'
}

and for FlowLayout support: Maven Central

dependencies {
    //add the latest of FlowLayout
    implementation 'com.wefika:flowlayout:latest.release.here'
    implementation 'com.github.Commit451.AdapterLayout:adapterflowlayout:latest.release.here'
}

and for Kotlin extensions support:

dependencies {
    implementation 'com.github.Commit451.AdapterLayout:adapterlayout-kotlin:latest.release.here'
}

Usage

See the sample project for full usage.

//CheeseAdapter is a RecyclerView adapter
CheeseAdapter cheeseAdapter = new CheeseAdapter();
adapterLinearLayout adapterLinearLayout = (AdapterLinearLayout) findViewById(R.id.adapter_linear_layout);
adapterLinearLayout.setAdapter(cheeseAdapter);

Later, when you get your data set:

ArrayList<Cheese> cheeses = loadCheeses();
//addAll is a method in our custom RecyclerView.Adapter
cheeseAdapter.addAll(cheeses);

At this point, the data will be added to the LinearLayout so long as your RecyclerView.Adapter works correctly. onCreateViewHolder and onBindViewHolder will be called as needed.

But... Why?

This library is useful for displaying data sets that are repeating, but do not need to be recycled as they would be in a RecyclerView. This could be the case if you wanted to display a list of items within a ScrollView, or wanted to use a custom ViewGroup that did not extend RecyclerView.

But Why RecyclerView Adapter?

Most developers should be using RecyclerView instead of ListView and should be familiar with creating a RecyclerView.Adapter. RecyclerView.Adapter also enforces the use of ViewHolders which is better for performance. RecyclerView's adapter also allows for better responses to data structure changes via notifyItemInserted, notifyItemRemoved etc.

Currently Created AdapterLayouts

  • AdapterLinearLayout
  • AdapterFlowLayout (separate dependency)

Creating Your Own AdapterLayout

It is simple to create your own ViewGroup backed by a RecyclerView.Adapter. See the AdapterFlowLayout library and AdapterLayoutDelegate in the library for an example of how to create one.

Limitations

  • Within a RecyclerView.Adapter, you can call getAdapterPosition(). This will always return -1 since there is actually never an associated RecyclerView. Instead, you can call AdapterLayout.getAdapterPosition(holder) to get the position of the ViewHolder within the adapter.

License

Copyright 2018 Commit 451

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.
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].