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 f3f5f1d4e..8f8432475 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 @@ -90,6 +90,18 @@ class CommentsSheet : ExpandedBottomSheet() { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { val dialog = super.onCreateDialog(savedInstanceState) + // BottomSheetDialogFragment passthrough user outside touch event + dialog.setOnShowListener { + dialog.findViewById(R.id.touch_outside)?.apply { + setOnTouchListener { v, event -> + event.setLocation(event.rawX - v.x, event.rawY - v.y) + activity?.dispatchTouchEvent(event) + v.performClick() + false + } + } + } + dialog.apply { setOnKeyListener { _, keyCode, _ -> if (keyCode == KeyEvent.KEYCODE_BACK) { diff --git a/app/src/main/java/com/github/libretube/ui/sheets/ExpandedBottomSheet.kt b/app/src/main/java/com/github/libretube/ui/sheets/ExpandedBottomSheet.kt index 94b8959f0..533aef983 100644 --- a/app/src/main/java/com/github/libretube/ui/sheets/ExpandedBottomSheet.kt +++ b/app/src/main/java/com/github/libretube/ui/sheets/ExpandedBottomSheet.kt @@ -29,10 +29,7 @@ open class ExpandedBottomSheet : BottomSheetDialogFragment() { return dialog } - fun show(fragmentManager: FragmentManager) = show( - fragmentManager, - null - ) + fun show(fragmentManager: FragmentManager) = show(fragmentManager, null) override fun onPictureInPictureModeChanged(isInPictureInPictureMode: Boolean) { super.onPictureInPictureModeChanged(isInPictureInPictureMode)