Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
class CustomAdapter : ListAdapter<Item, ItemViewHolder>(DiffUtilCallback) {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SpotViewHolder {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item, parent, false)
return ItemViewHolder(view)
override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {
object DiffUtilCallback : DiffUtil.ItemCallback() {
override fun areItemsTheSame(oldItem: Item, newItem: Item) = ==
override fun areContentsTheSame(oldItem: Item, newItem: Item) = oldItem == newItem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment