Added var for commentSize

This commit is contained in:
Bnyro 2022-05-09 15:32:40 +02:00
parent 2d4e70bd69
commit 48a0fd0724

View File

@ -9,18 +9,18 @@ import androidx.recyclerview.widget.RecyclerView
import com.github.libretube.R
import com.github.libretube.formatShort
import com.github.libretube.obj.Comment
import com.github.libretube.obj.StreamItem
import com.squareup.picasso.Picasso
class CommentsAdapter(private val comments: MutableList<Comment>): RecyclerView.Adapter<ViewHolder>(){
fun updateItems(newItems: List<Comment>){
comments.addAll(newItems)
notifyItemRangeInserted(comments.size, newItems.size)
var commentsSize = comments.size
notifyItemRangeInserted(commentsSize, newItems.size)
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
var commentsView = LayoutInflater.from(parent.context).inflate(R.layout.comments_row, parent, false)
var commentsView = LayoutInflater.from(parent.context).inflate(R.layout.comments_row, parent, false)
return ViewHolder(commentsView)
}