Skip to content

Instantly share code, notes, and snippets.

@yaseen2591
yaseen2591 / CleanRecyclerViewAdapter.kt
Created November 28, 2019 08:10
Example of Clean RecyclerViewAdapter with DiffUtil
class YourAdapter : ListAdapter<YourData, YourAdapter.ViewHolder>(YourDataDiffCallback()) {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder.from(parent)
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val item = getItem(position)
holder.bind(item)
}