FlexibleAdapter
Fast and versatile Adapter for RecyclerView which regroups several features into one library to considerably improve the user experience :-)
Install / Use
/learn @davideas/FlexibleAdapterREADME
FlexibleAdapter: A finished chapter (2015–2026)
FlexibleAdapter is now officially a legacy archive. It was built to solve the complexities of RecyclerView, and it did so for a decade. Today, the industry has moved to a different paradigm, and this project has reached a rare milestone in open-source and got its natural conclusion.
The current reality
This library remains 100% stable for projects using the legacy Android View system (XML). The API has been frozen for years because it fulfills its original purpose.
The industry has moved toward Declarative UI
The arrival of Jetpack Compose and Compose Multiplatform has replaced the need for complex Adapters. What used to take hundreds of lines in this library now takes tens of lines of native Kotlin code.
- Jetpack Compose: For new Android-only projects, we recommend migrating to
LazyColumn&LazyRow. - Kotlin Multiplatform (KMP): For projects targeting Android and iOS, use Compose Multiplatform. Since FlexibleAdapter depends on the Android View system, it is not compatible with multiplatform targets.
A final word
No further feature requests or pull requests will be processed, as the library is considered a "finished" product. As last contribution to the community the library has been published to Maven Central Repository.
Thank you to have adopted this library in your project.
FlexibleAdapter
- Last version 5.1.0
- Originally released with AndroidX on September 30, 2018.
- Republished to Maven Central in March 2026.
One Adapter many Apps
:mega: When initially Android:registered: team introduced the RecyclerView widget, we had to implement a custom Adapter in several applications, again and again to provide the items for our views.<br/> We didn't know how to add selection and to combine all the use cases in the same Adapter. Since I created this library, it has become easy to configure multiple views and now, nobody wants to use a ListView anymore.
The idea behind is to regroup multiple features in a unique library, without the need to customize and import several third libraries not compatible among them.
The FlexibleAdapter helps developers to simplify this process without worrying too much about the Adapter anymore. It's easy to use, it has predefined logic for different situations and prevents common mistakes.<br/> This library is configurable and it guides the developers to create a better user experience and now, even more with the new features.
Setup
The original artifacts were hosted on JCenter. Since its shutdown, the old dependency will result in a 404 Not Found error.
As last contribution to the community the library has been published to Maven Central Repository.<br>
I tried to keep the requirements as low as possible.
Minimum Requirements
To use this library in your project, ensure your environment meets at least the following requirements:
- compileSdk 30+ (Android 11)
- Gradle 7.6+
- Android Gradle Plugin (AGP) 7.4+
- JDK 11+
- Kotlin 1.7+
build.gradle
repositories {
mavenCentral()
}
dependencies {
// Core library (required)
implementation 'eu.davidea:flexible-adapter:5.1.0'
// UI extensions (recommended)
implementation 'eu.davidea:flexible-adapter-ui:1.0.0'
// Optional extensions
implementation 'eu.davidea:flexible-adapter-livedata:1.0.0'
implementation 'eu.davidea:flexible-adapter-databinding:1.0.0'
}
Features in main library
- Simple, Single & Multi selection mode.
- Mapping multi-view types with Item interfaces.
- Predefined ViewHolders with (child) click listeners and others callbacks.
- Async Updates with optional DiffUtil for small lists.
- Async Filter with spannable text (:eyeglasses:); Result list is animated; With optional original list; Works with sub items; Multi filter.
- High performance filter and updates for medium and big lists.
- Headers and Sections with sticky behavior fully clickable and collapsible, elevation, transparency and automatic linkage on item move!
- Scrollable Headers and Footers items that lay respectively at the top and at the bottom of the main items.
- Expandable items with Selection Coherence and multi-level expansion.
- Drag&Drop and Swipe-To-Dismiss with Leave-Behind pattern and with Selection Coherence.
- Innovative bottom and top EndlessScroll (No OnScrollListener).
- Customizable FastScroller with several features.
- Customizable Scrolling Animations based on adapter position and beyond.
- Customizable Animations when adding and removing items.
- LayoutUtils for orientation, span count and visible items calculation.
- Support for any thirds LayoutManagers.
- Easy runtime position calculation for adding/moving items in sections.
- Custom Tags for multiple adapter instances that ease our debug.
- Comprehensive Wiki pages and Javadoc documentation.
UI extension library :eyeglasses:
- Faster setup selection with ActionModeHelper.
- Faster setup for item restoration with UndoHelper; Works with expandable and swiped items too!
- Basic empty view handling with EmptyViewHelper.
- Advanced item decoration (customizable dividers, sections gap and item offsets).
- 3 layout managers that support smooth scrolling.
- FlexibleUtils for text highlighting, accent color fetching, API versions.
- DrawableUtils for dynamic backgrounds with ripple effect (No XML).
Others experimental extension libraries
- Live Data.
- Data Binding.
Wiki!
I strongly recommend to read the Wiki pages, where you can find a comprehensive Tutorial.<br/>
History of last active development
The next steps of development: New demoApp > Extensions.
Under the hood
Some simple features have been implemented, thanks to some Blogs (see at the bottom of the page), merged and methods have been improved for speed and scalability.
<p align="center"><img src="./screenshots/wiki_diagram.png"></p>- At lower level there is
SelectableAdapterclass. It provides selection features and it's able to maintain the state after the rotation: you just need to call the onSave/onRestore methods from the Activity! - At middle level, the
AnimatorAdapterclass has been added to give some animation at startup and when user scrolls. - At front level, the core class
FlexibleAdapter. It holds and handles the main list, performs actions on all different types of item paying attention at the adding and removal of the items, as well as the new concept of "selection coherence". - Useful extensions and helpers have been added during the time to simplify the development.
- Item interfaces and predefined ViewHolders complete the whole library giving more actions to the items and configuration options to developers.
Showcase of the demo App
You can download the latest demo App from the latest release page OR run it with the emulator.<br> This Wiki page will give you a short briefing of the demo App.


