Update CommentsAdapter.kt

This commit is contained in:
Bnyro 2022-05-10 06:23:44 +02:00 committed by GitHub
parent 034df8932c
commit 4152f91932
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,8 +14,8 @@ import com.squareup.picasso.Picasso
class CommentsAdapter(private val comments: MutableList<Comment>): RecyclerView.Adapter<ViewHolder>(){ class CommentsAdapter(private val comments: MutableList<Comment>): RecyclerView.Adapter<ViewHolder>(){
fun updateItems(newItems: List<Comment>){ fun updateItems(newItems: List<Comment>){
comments.addAll(newItems)
var commentsSize = comments.size var commentsSize = comments.size
comments.addAll(newItems)
notifyItemRangeInserted(commentsSize, newItems.size) notifyItemRangeInserted(commentsSize, newItems.size)
} }
@ -50,4 +50,4 @@ class CommentsAdapter(private val comments: MutableList<Comment>): RecyclerView
class ViewHolder(val v: View): RecyclerView.ViewHolder(v){ class ViewHolder(val v: View): RecyclerView.ViewHolder(v){
init { init {
} }
} }