remove assumptions about rotation preference

This commit is contained in:
Kai 2024-12-13 10:00:43 -06:00
parent ab360ed6f6
commit ed926c4e37
No known key found for this signature in database

View File

@ -183,12 +183,15 @@ class VideoDetailFragment() : MainFragment() {
} }
// For small windows if the device isn't in a portrait orientation and we're in the maximized state then we should force portrait // For small windows if the device isn't in a portrait orientation and we're in the maximized state then we should force portrait
// only do this if auto-rotate is on portrait is forced when leaving full screen for autorotate off // only do this if auto-rotate is on portrait is forced when leaving full screen for autorotate off
else if (isSmallWindow && !isMinimizingFromFullScreen && !isFullscreen && state == State.MAXIMIZED && resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE && autoRotateEnabled) { else if (isSmallWindow && !isMinimizingFromFullScreen && !isFullscreen && state == State.MAXIMIZED && resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) {
@SuppressLint("SourceLockedOrientationActivity")
a.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT
if (autoRotateEnabled
) {
// start listening for the device to rotate to portrait // start listening for the device to rotate to portrait
// at which point we'll be able to set requestedOrientation to back to UNSPECIFIED // at which point we'll be able to set requestedOrientation to back to UNSPECIFIED
_portraitOrientationListener?.enableListener() _portraitOrientationListener?.enableListener()
a.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT }
} else if (rotationLock) { } else if (rotationLock) {
_portraitOrientationListener?.disableListener() _portraitOrientationListener?.disableListener()
_landscapeOrientationListener?.disableListener() _landscapeOrientationListener?.disableListener()
@ -566,10 +569,10 @@ class VideoDetailFragment() : MainFragment() {
} }
// temporarily force the device to portrait if auto-rotate is disabled to prevent landscape when exiting full screen on a small device // temporarily force the device to portrait if auto-rotate is disabled to prevent landscape when exiting full screen on a small device
@SuppressLint("SourceLockedOrientationActivity") // @SuppressLint("SourceLockedOrientationActivity")
if (!isFullscreen && isSmallWindow() && !isAutoRotateEnabled() && !isMinimizingFromFullScreen) { // if (!isFullscreen && isSmallWindow() && !isAutoRotateEnabled() && !isMinimizingFromFullScreen) {
activity?.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT // activity?.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT
} // }
updateOrientation(); updateOrientation();
_view?.allowMotion = !fullscreen; _view?.allowMotion = !fullscreen;
} }