Skip to content

Instantly share code, notes, and snippets.

@DanishAmjad12
Last active July 9, 2024 15:20
Show Gist options
  • Save DanishAmjad12/fc98d215e255c20274e291fc41896391 to your computer and use it in GitHub Desktop.
Save DanishAmjad12/fc98d215e255c20274e291fc41896391 to your computer and use it in GitHub Desktop.
override fun onBindViewHolder(h: RecyclerView.ViewHolder, position: Int, payloads: List<Any>) {
if (payloads.isNotEmpty()) {
val item = data[position]
for (payload in payloads) {
if (payload == payloadName) {
// in this case only like icon will be updated
(h as CardMovie).updateLikeIcon(movie)
}
}
} else {
// in this case regular onBindViewHolder will be called
super.onBindViewHolder(h, position, payloads)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment