limit the max height of the comments sheet

This commit is contained in:
Bnyro 2022-12-16 15:01:06 +01:00
parent 03973bcc14
commit ea72e777c1
2 changed files with 9 additions and 1 deletions

View File

@ -327,7 +327,12 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
}
binding.commentsToggle.setOnClickListener {
CommentsSheet(videoId!!, comments, commentsNextPage) { comments, nextPage ->
CommentsSheet(
videoId!!,
comments,
commentsNextPage,
binding.root.height - binding.player.height
) { comments, nextPage ->
this.comments.addAll(comments)
this.commentsNextPage = nextPage
}.show(childFragmentManager)

View File

@ -20,6 +20,7 @@ class CommentsSheet(
private val videoId: String,
private val comments: List<Comment>,
private var nextPage: String?,
private val maxHeight: Int,
private val onMoreComments: (comments: List<Comment>, nextPage: String?) -> Unit
) : ExpandedBottomSheet() {
private lateinit var binding: CommentsSheetBinding
@ -29,6 +30,8 @@ class CommentsSheet(
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
binding = CommentsSheetBinding.inflate(layoutInflater)
// set a fixed maximum height
binding.root.maxHeight = maxHeight
return binding.root
}