Skip to content

Instantly share code, notes, and snippets.

@pavlospt
Created March 29, 2020 18:05
Show Gist options
  • Select an option

  • Save pavlospt/45c9957f9c95023e7b4f6d1c4329a1cf to your computer and use it in GitHub Desktop.

Select an option

Save pavlospt/45c9957f9c95023e7b4f6d1c4329a1cf to your computer and use it in GitHub Desktop.
import androidx.recyclerview.widget.RecyclerView
import androidx.viewbinding.ViewBinding
abstract class ViewBindingViewHolder<Item : ViewBindingAdapterItem, out VB : ViewBinding>(
protected val binding: VB
) : RecyclerView.ViewHolder(binding.root) {
abstract fun bind(item: Item)
open fun bind(item: Item, payloads: List<Any>) {
if (payloads.isEmpty()) {
bind(item = item)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment