Skip to content

Instantly share code, notes, and snippets.

@sergei-lapin
Created August 5, 2021 06:57
Show Gist options
  • Select an option

  • Save sergei-lapin/0620ea36a80ef6925cc4ee969bafc26c to your computer and use it in GitHub Desktop.

Select an option

Save sergei-lapin/0620ea36a80ef6925cc4ee969bafc26c to your computer and use it in GitHub Desktop.
lifecycle
init {
attachToPreventFromClearing()
viewHolderSupplier.viewHolderConsumer = ::putViewFromSupplier
viewHolderSupplier.start()
}
private fun putViewFromSupplier(scrap: RecyclerView.ViewHolder, creationTimeNanos: Long) {
factorInCreateTime(scrap.itemViewType, creationTimeNanos)
putRecycledView(scrap)
}
override fun clear() {
super.clear()
viewHolderSupplier.stop()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment