Android Flexible Adapter
- v5.1.0 built on 2018.09.30 with AndroidX
- If you come from previous versions, update your code following the Wiki page Migrations.
- Please read also issues and releases.
- 1 Setup
- 2 Wiki!
- 3 Showcase of the demo App
- 4 Change Log
- 5 Limitations
- 6 Thanks
- 7 Imported libraries
- 8 Apps that use this Adapter
📣 When initially Android®️ 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.
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.
This library is configurable and it guides the developers to create a better user experience and now, even more with the new features.
- 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 (👓); 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 behaviour 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.
- 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).
- Live Data.
- Data Binding.
// Using JCenter
// From 1.0.0-b3, library is compiled with data binding v2
|Flexible Adapter||UI||Live Data||Data Binding|
I strongly recommend to read the Wiki pages, where you can find a comprehensive Tutorial.
Feel free to contribute and ask!
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.
- 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.
v5.1.0 – 2018.09.30
Item half swipe cannot be implemented due to how the
android.support.v7.widget.helper.ItemTouchHelper is done, also clicks on rear view are not possible, same reason. Half swipe can be done with others means, please see issues #98 and #100. See also commits of Apr 25, 2016.
- Martin Guillon (Akylas) to have contributed at the development of the new technique for the Sticky Header.
- Arpinca who added new features for FastScroller like autoHide and ignoreTouchesOutsideHandle and more.
This library is currently free to use and modify, if you would like to say Thank You by donating any amount, you’re very welcome! Here the link to PayPal.me:
- The library LollipopContactsRecyclerViewFastScroller has been imported, heavily improved and adapted to work in conjunction with
- The library sticky-headers-recyclerview was initially imported, then it was removed in favor of the new technique able to manage a real View and so to handle the click events properly.
- The item spacing technique comes from the library CommonItemDecoration and it has been improved with new features.
It will be a pleasure to add your App here, once it is published.
52 total views, 1 views today