[Android] VideoPlayer: fix lock crash API < 28 (P)
Duncan McNamara
git at videolan.org
Thu Oct 17 13:21:26 UTC 2024
vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Tue Oct 15 17:27:27 2024 +0200| [f499b02e3d0d531bf0a051dbbae059506a271c12] | committer: Nicolas Pomepuy
VideoPlayer: fix lock crash API < 28 (P)
> https://code.videolan.org/videolan/vlc-android/commit/f499b02e3d0d531bf0a051dbbae059506a271c12
---
.../videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt
index 5dda6864de..08b3f1eaf6 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerOverlayDelegate.kt
@@ -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
+ }
}
}
More information about the Android
mailing list