3.0.0
All the AdapterItems written for RecyclerAdapter 2.10.x are 100% compatible with 3.0.0 without any change.
Breaking changes
- removed
RecyclerAdapter.createRecycledViewPool
It's better to use plainRecyclerView.RecycledViewPool()
and pass it around to all the shared Recycler Views - removed internal support for selection groups. They can be achieved without that support, which was cumbersome. Updated examples in the demo app.
- moved
lockScrollingWhileInserting
as an external extension - moved
enableDragDrop
as an external extension - removed
getItemPosition
. It's now achieved withrecyclerAdapter.adapterItems.indexOf(item)
- removed
getItemAtPosition
. It's now achieved withrecyclerAdapter.adapterItems.getOrNull(item)
- removed
sort
. It's now achieved withrecyclerAdapter.modifyItemsAndRender { it.sorted() }
andrecyclerAdapter.modifyItemsAndRender { it.sortedDescending() }
. Check the readme for more details. - removed
removeAllItemsWithClass
,getLastItemWithClass
,removeLastItemWithClass
methods andRemoveListener
. It's now achieved withmodifyItemsAndRender
extension. Check the demo app for replacement details and examples.
Deprecations
- AdapterItem's
getLayoutId
. UsegetView(parent: ViewGroup) = parent.inflating(id)
instead - AdapterItem View Holder's
getAdapterItem()
. UsewithAdapterItem<SomeItem> { }
instead
New features and improvements
- You can get a copy of the internal list with
recyclerAdapter.adapterItems
. Modifying that list won't affect the internal one. - added
RecyclerAdapter.modifyItemsAndRender
extension which gives freedom to manipulate the internal list and render it back. It's the replacement forsort
,removeAllItemsWithClass
,getLastItemWithClass
,removeLastItemWithClass
methods RecyclerView.withSharedViewPool
andRecyclerView.setupWithPrefetchingLinearLayoutAndSharedViewPool
extensions now accepts aRecyclerView.RecycledViewPool
as parameter. If not specified, it will continue to use the global shared pool as in 2.x- You can
swap
two items in the RecyclerAdapter - Improved internal handling of the empty item
- added getView(parent: ViewGroup) which allows to both inflate XML views by using
parent.inflating(id)
or to create them completely programmatically - added
Int.dp(context)
to favor programmatic views and be able to write24.dp(context)
- added
withAdapterItem<SomeItem> { }
to replace error prone and cumbersome(getAdapterItem() as? SomeItem)?.apply { }
- enhanced release script, which now build and adds the demo app in the release
- dropped support for Android API < 21
Updates
- Kotlin
1.4.10