mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-01-06 01:20:29 +05:30
fix: autofullscreen stops working after orientation change
This commit is contained in:
parent
881e1bae3b
commit
24f0c1322e
@ -696,6 +696,8 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
|||||||
openOrCloseFullscreenDialog(true)
|
openOrCloseFullscreenDialog(true)
|
||||||
|
|
||||||
binding.player.updateMarginsByFullscreenMode()
|
binding.player.updateMarginsByFullscreenMode()
|
||||||
|
|
||||||
|
updateFullscreenButtonVisibility()
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SourceLockedOrientationActivity")
|
@SuppressLint("SourceLockedOrientationActivity")
|
||||||
@ -712,31 +714,36 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
|||||||
playerBinding.fullscreen.setImageResource(R.drawable.ic_fullscreen)
|
playerBinding.fullscreen.setImageResource(R.drawable.ic_fullscreen)
|
||||||
playerBinding.exoTitle.isInvisible = true
|
playerBinding.exoTitle.isInvisible = true
|
||||||
|
|
||||||
mainActivity.requestedOrientation = mainActivity.screenOrientationPref
|
if (!PlayerHelper.autoFullscreenEnabled) {
|
||||||
|
mainActivity.requestedOrientation = mainActivity.screenOrientationPref
|
||||||
|
}
|
||||||
|
|
||||||
openOrCloseFullscreenDialog(false)
|
openOrCloseFullscreenDialog(false)
|
||||||
updateResolutionOnFullscreenChange(false)
|
updateResolutionOnFullscreenChange(false)
|
||||||
|
|
||||||
restartActivityIfNeeded()
|
restartActivityIfNeeded()
|
||||||
|
|
||||||
binding.player.updateMarginsByFullscreenMode()
|
binding.player.updateMarginsByFullscreenMode()
|
||||||
|
|
||||||
|
updateFullscreenButtonVisibility()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateFullscreenButtonVisibility() {
|
||||||
|
playerBinding.fullscreen.isInvisible = PlayerHelper.autoFullscreenEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable or disable fullscreen depending on the current state
|
* Enable or disable fullscreen depending on the current state
|
||||||
*/
|
*/
|
||||||
fun toggleFullscreen() {
|
fun toggleFullscreen() {
|
||||||
// hide player controller
|
|
||||||
binding.player.hideController()
|
binding.player.hideController()
|
||||||
|
|
||||||
if (viewModel.isFullscreen.value == false) {
|
if (viewModel.isFullscreen.value == false) {
|
||||||
// go to fullscreen mode
|
// go to fullscreen mode
|
||||||
setFullscreen()
|
setFullscreen()
|
||||||
} else {
|
} else {
|
||||||
// exit fullscreen mode
|
// exit fullscreen mode
|
||||||
unsetFullscreen()
|
unsetFullscreen()
|
||||||
|
|
||||||
// disable the fullscreen button for auto fullscreen
|
|
||||||
// this is necessary to hide the button after an auto fullscreen for shorts
|
|
||||||
playerBinding.fullscreen.isVisible = !PlayerHelper.autoFullscreenEnabled
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -936,11 +943,8 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
|
|||||||
isShort && binding.playerMotionLayout.progress == 0f
|
isShort && binding.playerMotionLayout.progress == 0f
|
||||||
) {
|
) {
|
||||||
setFullscreen()
|
setFullscreen()
|
||||||
playerBinding.fullscreen.isVisible = true
|
|
||||||
} else {
|
|
||||||
// disable the fullscreen button for auto fullscreen
|
|
||||||
playerBinding.fullscreen.isVisible = !PlayerHelper.autoFullscreenEnabled
|
|
||||||
}
|
}
|
||||||
|
updateFullscreenButtonVisibility()
|
||||||
|
|
||||||
binding.player.apply {
|
binding.player.apply {
|
||||||
useController = false
|
useController = false
|
||||||
|
Loading…
Reference in New Issue
Block a user