From ea72e777c1d9544bed4eec59db38efd04194dbb9 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Fri, 16 Dec 2022 15:01:06 +0100 Subject: [PATCH] limit the max height of the comments sheet --- .../com/github/libretube/ui/fragments/PlayerFragment.kt | 7 ++++++- .../java/com/github/libretube/ui/sheets/CommentsSheet.kt | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) 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 }