square / cycler

Apache License 2.0
791 stars 27 forks source link

Cycler doesn't permit use of StateRestorationPolicy #55

Open BenTilbrook opened 2 years ago

BenTilbrook commented 2 years ago

The library hides the implementation details of the RecyclerView.Adapter usage, making it impossible to assign the RecyclerView.Adapter.StateRestorationPolicy to the adapter. This means we can't resolve state restoration issues the policy is intended to address.

Part of the problem is the adapter is assigned "just-in-time" in com.squareup.cycler.Recycler.update, and there doesn't appear to be any way to hook into this mechanism to modify the adapter prior to assignment.

Is there anything that can be done about this? Can this hack be removed, now that StateRestorationPolicy is available?