Skip to content

3.0.0

Compare
Choose a tag to compare
@gotev gotev released this 20 Mar 10:09
· 57 commits to master since this release

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 plain RecyclerView.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 with recyclerAdapter.adapterItems.indexOf(item)
  • removed getItemAtPosition. It's now achieved with recyclerAdapter.adapterItems.getOrNull(item)
  • removed sort. It's now achieved with recyclerAdapter.modifyItemsAndRender { it.sorted() } and recyclerAdapter.modifyItemsAndRender { it.sortedDescending() }. Check the readme for more details.
  • removed removeAllItemsWithClass, getLastItemWithClass, removeLastItemWithClass methods and RemoveListener. It's now achieved with modifyItemsAndRender extension. Check the demo app for replacement details and examples.

Deprecations

  • AdapterItem's getLayoutId. Use getView(parent: ViewGroup) = parent.inflating(id) instead
  • AdapterItem View Holder's getAdapterItem(). Use withAdapterItem<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 for sort, removeAllItemsWithClass, getLastItemWithClass, removeLastItemWithClass methods
  • RecyclerView.withSharedViewPool and RecyclerView.setupWithPrefetchingLinearLayoutAndSharedViewPool extensions now accepts a RecyclerView.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 write 24.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