saket / InboxRecyclerView

Build expandable descendant navigation, inspired by Google Inbox

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: Add an option to disable stable IDs requirement

ZacSweers opened this issue · comments

In cases like androidx.paging, it uses ConcatAdapter under the hood and can't enable it. In that header/footer case though, it may not be an issue and would be nice to have a sort of "I know what I'm doing" opt out

In case you're blocked on this, you could temporarily enable stable IDs when setting the adapter on your IRV and disable saving of its state.

Okay, I've introduced a way for apps to help identify the expanding list item with c6eba5c. If your list adapter uses unique IDs without setting setHasStableIds(true), you should be able to do this:

recyclerView.expandedItemFinder = DefaultExpandedItemFinder(requireStableIds = false)

If you don't want to or can't use long based adapter IDs, you can set a custom expandedItemFinder and use recyclerView.expandItem(Parcelable).

You'll have to pull SNAPSHOT. I will make a release sometime soon.

I'm not very happy that I wasn't able to make ExpandedItemFinder type safe. Suggestions are welcome!

I managed to make the solution type-safe (if you wanna use anything other than adapter IDs). Here's the new syntax:

recyclerView.itemExpander = AdapterIdBasedItemExpander(requireStableIds = false)