fix: auto rotation stops working after having entered the fullscreen player

This commit is contained in:
Bnyro 2024-03-19 21:07:14 +01:00
parent 33e2b87bbc
commit 3346c7c774

View File

@ -705,22 +705,14 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
} }
viewModel.isFullscreen.value = false viewModel.isFullscreen.value = false
if (
!PlayerHelper.autoFullscreenEnabled &&
mainActivity.screenOrientationPref == ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
) {
mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
}
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
openOrCloseFullscreenDialog(false)
updateResolutionOnFullscreenChange(false) updateResolutionOnFullscreenChange(false)
openOrCloseFullscreenDialog(false) restartActivityIfNeeded()
checkForNecessaryOrientationRestart()
binding.player.updateMarginsByFullscreenMode() binding.player.updateMarginsByFullscreenMode()
} }
@ -1657,7 +1649,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
* Check if the activity needs to be recreated due to an orientation change * Check if the activity needs to be recreated due to an orientation change
* If true, the activity will be automatically restarted * If true, the activity will be automatically restarted
*/ */
private fun checkForNecessaryOrientationRestart() { private fun restartActivityIfNeeded() {
val lockedOrientations = val lockedOrientations =
listOf( listOf(
ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT, ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT,
@ -1696,7 +1688,7 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
else -> unsetFullscreen() else -> unsetFullscreen()
} }
} else { } else {
checkForNecessaryOrientationRestart() restartActivityIfNeeded()
} }
} }