From dc16223b9ac05ecced4f89f069db1a01697c4284 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Thu, 16 Feb 2023 19:59:01 +0100 Subject: [PATCH] Restore the orientation before entering PiP --- .../libretube/ui/fragments/PlayerFragment.kt | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) 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 a4c970a4c..7b8e0a7a2 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 @@ -262,8 +262,8 @@ class PlayerFragment : Fragment(R.layout.fragment_player), OnlinePlayerOptions { * somehow the bottom bar is invisible on low screen resolutions, this fixes it */ private fun showBottomBar() { - if (isAdded && binding.player.isPlayerLocked) { - binding.player.binding.bottomBar.isVisible = true + if (isAdded && !binding.player.isPlayerLocked) { + playerBinding.bottomBar.isVisible = true } handler.postDelayed(this::showBottomBar, 100) } @@ -1387,9 +1387,6 @@ class PlayerFragment : Fragment(R.layout.fragment_player), OnlinePlayerOptions { binding.player.hideController() binding.player.useController = false - // set portrait mode - unsetFullscreen() - if (viewModel.isMiniPlayerVisible.value == true) { binding.playerMotionLayout.transitionToStart() viewModel.isMiniPlayerVisible.value = false @@ -1401,8 +1398,6 @@ class PlayerFragment : Fragment(R.layout.fragment_player), OnlinePlayerOptions { } binding.linLayout.visibility = View.GONE - viewModel.isFullscreen.value = false - updateCaptionsLanguage(null) } else { // close button got clicked in PiP mode @@ -1412,11 +1407,14 @@ class PlayerFragment : Fragment(R.layout.fragment_player), OnlinePlayerOptions { // enable exoPlayer controls again binding.player.useController = true - with(binding.playerMotionLayout) { - getConstraintSet(R.id.start).constrainHeight(R.id.player, 0) - enableTransition(R.id.yt_transition, true) + // set back to protrait mode + if (viewModel.isFullscreen.value != true) { + with(binding.playerMotionLayout) { + getConstraintSet(R.id.start).constrainHeight(R.id.player, 0) + enableTransition(R.id.yt_transition, true) + } + binding.linLayout.visibility = View.VISIBLE } - binding.linLayout.visibility = View.VISIBLE updateCaptionsLanguage(captionLanguage)