Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore the orientation before entering PiP #3094

Merged
merged 1 commit into from
Feb 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)

Expand Down