DpadScrollState

Holds the scroll state of nested DpadRecyclerView. Use it to save and restore the scroll state of all RecyclerViews in a single screen.

Functions

Link copied to clipboard
fun clear()

Clears all scroll states to prevent them from being restored later

fun clear(key: String)
Link copied to clipboard
fun restore(recyclerView: DpadRecyclerView, key: String, adapter: RecyclerView.Adapter<*>)

Call this when the ViewHolder is bound and after adapter contents are updated in RecyclerView.Adapter.onBindViewHolder.

Link copied to clipboard
fun save(recyclerView: DpadRecyclerView, key: String, detachAdapter: Boolean = true)

Call this when the ViewHolder is recycled in RecyclerView.Adapter.onViewRecycled. This will clear the adapter by default to ensure that children are removed from the layout. To disable this, pass false in detachAdapter