VideoPlayer: fix lock crash API < 28 (P)

This commit is contained in:
Duncan McNamara 2024-10-15 17:27:27 +02:00 committed by Nicolas Pomepuy
parent 704df40ad6
commit f499b02e3d

View File

@ -956,11 +956,16 @@ class VideoPlayerOverlayDelegate (private val player: VideoPlayerActivity) {
hudBinding.swipeToUnlock.setVisible()
//make sure the title and unlock views are not conflicting with the cutout / gestures
(playerUiContainer.layoutParams as? FrameLayout.LayoutParams)?.let {
it.topMargin =
player.window.decorView.rootWindowInsets.displayCutout?.safeInsetTop ?: 0
it.bottomMargin =
(player.window.decorView.rootWindowInsets.displayCutout?.safeInsetBottom
?: 0) + 24.dp
if (AndroidUtil.isPOrLater) {
it.topMargin =
player.window.decorView.rootWindowInsets.displayCutout?.safeInsetTop ?: 0
it.bottomMargin =
(player.window.decorView.rootWindowInsets.displayCutout?.safeInsetBottom
?: 0) + 24.dp
} else {
it.topMargin = 0
it.bottomMargin = 24.dp
}
}
}