All Projects → ajalt → Flexadapter

ajalt / Flexadapter

Licence: apache-2.0
The easiest way to use a RecyclerView on Android

Programming Languages

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

Projects that are alternatives of or similar to Flexadapter

Groupedrecyclerviewadapter
GroupedRecyclerViewAdapter可以很方便的实现RecyclerView的分组显示,并且每个组都可以包含组头、组尾和子项;可以方便实现多种Type类型的列表,可以实现如QQ联系人的列表一样的列表展开收起功能,还可以实现头部悬浮吸顶功能等。
Stars: ✭ 1,163 (+1353.75%)
Mutual labels:  recyclerview, recyclerview-adapter
Recyclerviewtest
RecyclerView 实践学习的demo,其中有基本的列表,表格,瀑布流,进阶的,等等
Stars: ✭ 23 (-71.25%)
Mutual labels:  recyclerview, recyclerview-adapter
Lastadapter
Don't write a RecyclerView adapter again. Not even a ViewHolder!
Stars: ✭ 777 (+871.25%)
Mutual labels:  recyclerview, recyclerview-adapter
Zoomrecylerlayout
🎢 Zoom Recycler Layout Manager For Android Kotlin
Stars: ✭ 618 (+672.5%)
Mutual labels:  recyclerview, recyclerview-adapter
Autorecycleradapter
Automated configuration RecyclerView.Adapter for Android
Stars: ✭ 67 (-16.25%)
Mutual labels:  recyclerview, recyclerview-adapter
Codeview Android
Display code with syntax highlighting ✨ in native way.
Stars: ✭ 748 (+835%)
Mutual labels:  recyclerview, recyclerview-adapter
Expandablerecyclerview
A very simple example of how the expandable RecyclerView can be implemented
Stars: ✭ 16 (-80%)
Mutual labels:  recyclerview, recyclerview-adapter
Recyclerviewtemplate
One Template which solves all frequently used RecyclerViews Code Snippets
Stars: ✭ 404 (+405%)
Mutual labels:  recyclerview, recyclerview-adapter
Retrofit Recyclervew
An implementation of a RecyclerView using Retrofit and Glide to create a movie list
Stars: ✭ 40 (-50%)
Mutual labels:  recyclerview, recyclerview-adapter
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 (-51.25%)
Mutual labels:  recyclerview, recyclerview-adapter
Easyxrecyclerview
主要提供了简单易用强大的RecyclerView库,包括自定义刷新加载效果、极简通用的万能适配器Adapter、万能分割线、多种分组效果、常见状态页面、item动画效果、添加多个header和footer、侧滑、拖拽、Sticky(黏性)效果、多item布局等,各模块之间灵活、解耦、通用、又能相互组合使用。
Stars: ✭ 607 (+658.75%)
Mutual labels:  recyclerview, recyclerview-adapter
Recyclerview Concatadapter
Sample to practice RecyclerView ConcatAdapter
Stars: ✭ 47 (-41.25%)
Mutual labels:  recyclerview, recyclerview-adapter
Baserecyclerviewadapterhelper
BRVAH:Powerful and flexible RecyclerAdapter
Stars: ✭ 22,524 (+28055%)
Mutual labels:  recyclerview, recyclerview-adapter
Elements
⚒ Modular components for RecyclerView development enforcing clean, reusable and testable code, with built-in support for paging and complex hierarchies of data.
Stars: ✭ 75 (-6.25%)
Mutual labels:  recyclerview, recyclerview-adapter
Recycler Fast Scroll
Provides fast scroll and section idexer for recycler view
Stars: ✭ 445 (+456.25%)
Mutual labels:  recyclerview, recyclerview-adapter
Multiviewadapter
Easily create complex recyclerview adapters in android
Stars: ✭ 801 (+901.25%)
Mutual labels:  recyclerview, recyclerview-adapter
Klaster
Declare RecyclerView adapters in a functional way, without boilerplate and subclassing. No compromises on flexibility. If it's possible to do something by subclassing, it's possible to do it with this library.
Stars: ✭ 373 (+366.25%)
Mutual labels:  recyclerview, recyclerview-adapter
Brvah kotlin
This is kotlin BRVAH Demo
Stars: ✭ 402 (+402.5%)
Mutual labels:  recyclerview, recyclerview-adapter
Candyview
Implement any RecyclerView in just 1 Line. CandyView handles everything for you.
Stars: ✭ 15 (-81.25%)
Mutual labels:  recyclerview, recyclerview-adapter
Firestorerecycleradaptersample
Sample Android project using FirestoreRecyclerAdapter
Stars: ✭ 43 (-46.25%)
Mutual labels:  recyclerview, recyclerview-adapter

Define and coordinate multiple layouts in a RecyclerView without boilerplate.

  • Multiple item layouts in a single adapter with no typecasting.
  • Per-item span, swipe, and drag behavior in a RecyclerView in just a few lines of code.
  • Define all your view bindings without inheritance or custom ViewHolders

Usage

Create the adapter:

// Create the adapter
val adapter = FlexAdapter<Any>()
recyclerView.adapter = adapter
val layoutManager = GridLayoutManager(this, 3)
// Add this line to enable per-item spans on GridLayoutManagers
layoutManager.spanSizeLookup = adapter.spanSizeLookup
recyclerView.layoutManager = layoutManager

Register your view bindings:

// This item will be a text header with a span of three that can be swiped horizontally to dismiss.
adapter.register<String>(R.layout.text_item, span = 3, swipeDirs = HORIZONTAL) {
    // View lookup is cached. You could also Android data binding or Kotlin Android Extensions instead. 
    view<TextView>(R.id.text_view).text = it
}

// This will be a picture loaded from a resource the can be reordered by dragging in any direction.
data class Picture(val resId: Int, var caption: Text)
adapter.register<Picture>(R.layout.picture_item, dragDirs = ALL_DIRS) {
    view<ImageView>(R.id.image_view).setImageResource(it.resId)
    view<TextView>(R.id.caption).setImageResource(it.caption)
}

Each type of item you want is registered before you add it to the to add to the adapter.

Then add some items:

adapter.items.addAll(listOf(
    "Look at these pictures",
    Picture(R.drawable.picture_1, "First Picture"),
    Picture(R.drawable.picture_2, "Second Picture")
))

All structural changes to the items list automatically update the RecyclerView. No need to call noifyItemRangeAdded.

Update an existing item:

// If we added this Picture earlier
picture.text = "Look at this new text"
adapter.notifyItemChanged(picture)

When you want to update an item, just change its data and notify the adapter that it changed.

Per-item spans and drag directions

If you want different items of the same class to have different spans or drag directions, you can have your item classes inherit from AdapterItem or CachedAdapterItem. Implementations of those classes don't need to be registered, and can each instance can have difference dragDirs and spans.

Stable item ids

You can optionally tun on stable ids with adapter.setHasStableIds(true). By default, AdapterItem subclasses will each get a unique id per-instance, and item hash codes will be used for other types. You can customize the stable ids in subclasses of AdapterItem.

Item selection

FlexAdapter can manage a set of selected items and keep it in sync with changes to the adapter items.

val adapter = FlexAdapter<String>()
val selection = adapter.selectionTracker()
adapter.register<String>(R.layout.text_item) {
    view<TextView>(R.id.text_view).text = it
    view<Switch>(R.id.switch).selected = selection.isSelected(it)
}

adapter.add("Example")
selection.selectItem("Example")

API Documentation

API documentation is hosted online here.

Sample project

To see more of the features of FlexAdapter in use, check out the Kotlin sample app here, or the Java sample app here

Download

FlexAdapter is distributed with JitPack

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

dependencies {
   compile 'com.github.ajalt:flexadapter:2.2.0'
}

License

Copyright 2018 AJ Alt

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