From f8676682bfb99d5f09fdc629e5e4f50a6a853dc5 Mon Sep 17 00:00:00 2001 From: Krunal Patel Date: Tue, 29 Nov 2022 20:02:42 +0530 Subject: [PATCH] Fix `setFullScree()` call when in PiP mode When activity is in PiP mode it gives orientation as landscape, which leads to unwanted `setFullscreen()`. --- .../java/com/github/libretube/ui/fragments/PlayerFragment.kt | 4 ++++ 1 file changed, 4 insertions(+) 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 8004da35c..462c20b5a 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 @@ -1411,6 +1411,10 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions { super.onConfigurationChanged(newConfig) if (!PlayerHelper.autoRotationEnabled) return + + // If in PiP mode, orientation is given as landscape. + if (SDK_INT >= Build.VERSION_CODES.N && activity?.isInPictureInPictureMode == true) return + when (newConfig.orientation) { // go to fullscreen mode Configuration.ORIENTATION_LANDSCAPE -> setFullscreen()