Merge pull request #3094 from Bnyro/master

Restore the orientation before entering PiP
This commit is contained in:
Bnyro 2023-02-16 19:59:16 +01:00 committed by GitHub
commit 6c35e0649a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
}
@ -1390,9 +1390,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
@ -1404,8 +1401,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
@ -1415,11 +1410,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)