dismiss the comments sheet when clicking a channel avatar

This commit is contained in:
Bnyro 2022-11-26 18:28:54 +01:00
parent ee4581f2e3
commit 998cf38e6b
2 changed files with 7 additions and 7 deletions

View File

@ -29,7 +29,8 @@ import kotlinx.coroutines.withContext
class CommentsAdapter(
private val videoId: String,
private val comments: MutableList<Comment>,
private val isRepliesAdapter: Boolean = false
private val isRepliesAdapter: Boolean = false,
private val dismiss: () -> Unit
) : RecyclerView.Adapter<CommentsViewHolder>() {
private var isLoading = false
@ -80,14 +81,11 @@ class CommentsAdapter(
commentorImage.setOnClickListener {
NavigationHelper.navigateChannel(root.context, comment.commentorUrl)
dismiss.invoke()
}
repliesRecView.layoutManager = LinearLayoutManager(root.context)
val repliesAdapter = CommentsAdapter(
videoId,
mutableListOf(),
true
)
val repliesAdapter = CommentsAdapter(videoId, mutableListOf(), true, dismiss)
repliesRecView.adapter = repliesAdapter
if (!isRepliesAdapter && comment.repliesPage != null) {
root.setOnClickListener {

View File

@ -50,7 +50,9 @@ class CommentsSheet(
}
private fun setCommentsAdapter(comments: MutableList<Comment>) {
commentsAdapter = CommentsAdapter(videoId, comments)
commentsAdapter = CommentsAdapter(videoId, comments) {
dialog?.dismiss()
}
binding.optionsRecycler.adapter = commentsAdapter
isLoading = false
}