Skip to content

Instantly share code, notes, and snippets.

@baggednismo
Created May 1, 2020 12:54
Show Gist options
  • Save baggednismo/45d52ec5b0741fe5f0608c9905b86ddb to your computer and use it in GitHub Desktop.
Save baggednismo/45d52ec5b0741fe5f0608c9905b86ddb to your computer and use it in GitHub Desktop.
class ParentItemsAdapter(private val data: List<ParentItemModel>,
private var itemListener: ItemListener
) : RecyclerView.Adapter<ParentItemsViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ParentItemsViewHolder {
val inflater = LayoutInflater.from(parent.context)
return ParentItemsViewHolder(
inflater,
parent,
itemListener
)
}
override fun onBindViewHolder(holder: ParentItemsViewHolder, position: Int) {
val card: ParentItemModel = data[position]
holder.bind(card)
}
override fun getItemCount() = data.size
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment