diff --git a/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt index 82605b15a..d5975edd7 100644 --- a/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/ui/fragments/PlayerFragment.kt @@ -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) diff --git a/app/src/main/java/com/github/libretube/ui/sheets/CommentsSheet.kt b/app/src/main/java/com/github/libretube/ui/sheets/CommentsSheet.kt index 53922e5c7..9ec7e3611 100644 --- a/app/src/main/java/com/github/libretube/ui/sheets/CommentsSheet.kt +++ b/app/src/main/java/com/github/libretube/ui/sheets/CommentsSheet.kt @@ -20,6 +20,7 @@ class CommentsSheet( private val videoId: String, private val comments: List, private var nextPage: String?, + private val maxHeight: Int, private val onMoreComments: (comments: List, 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 }