diff --git a/app/src/main/java/com/futo/platformplayer/Settings.kt b/app/src/main/java/com/futo/platformplayer/Settings.kt index d05ccd16..e9b247ff 100644 --- a/app/src/main/java/com/futo/platformplayer/Settings.kt +++ b/app/src/main/java/com/futo/platformplayer/Settings.kt @@ -412,15 +412,13 @@ class Settings : FragmentedStorageFileJson() { var preferredPreviewQuality: Int = 5; fun getPreferredPreviewQualityPixelCount(): Int = preferedQualityToPixels(preferredPreviewQuality); - @FormField(R.string.simplify_sources, FieldForm.TOGGLE, R.string.simplify_sources_description, 4) var simplifySources: Boolean = true; - @FormField(R.string.auto_rotate, FieldForm.DROPDOWN, -1, 5) - @DropdownFieldOptionsId(R.array.system_enabled_disabled_array) - var autoRotate: Int = 2; + @FormField(R.string.force_allow_full_screen_rotation, FieldForm.TOGGLE, R.string.force_allow_full_screen_rotation_description, 5) + var forceAllowFullScreenRotation: Boolean = false - @FormField(R.string.background_behavior, FieldForm.DROPDOWN, -1, 7) + @FormField(R.string.background_behavior, FieldForm.DROPDOWN, -1, 6) @DropdownFieldOptionsId(R.array.player_background_behavior) var backgroundPlay: Int = 2; diff --git a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailFragment.kt b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailFragment.kt index 52463a7d..f7fb1daf 100644 --- a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailFragment.kt +++ b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailFragment.kt @@ -143,7 +143,6 @@ class VideoDetailFragment : MainFragment { } } - @SuppressLint("SourceLockedOrientationActivity") fun updateOrientation() { val a = activity ?: return val isFullScreenPortraitAllowed = Settings.instance.playback.fullscreenPortrait @@ -156,7 +155,11 @@ class VideoDetailFragment : MainFragment { // For small windows if the device isn't landscape right now and full screen portrait isn't allowed then we should force landscape if (isSmallWindow && isFullscreen && !isFullScreenPortraitAllowed && resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT && !rotationLock && isLandscapeVideo) { - a.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE + if(Settings.instance.playback.forceAllowFullScreenRotation){ + a.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE + }else{ + a.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE + } } // For small windows if the device isn't in a portrait orientation and we're in the maximized state then we should force portrait else if (isSmallWindow && !isMinimizingFromFullScreen && !isFullscreen && state == State.MAXIMIZED && resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) { @@ -164,26 +167,10 @@ class VideoDetailFragment : MainFragment { } else if (rotationLock) { a.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LOCKED } else { - when (Settings.instance.playback.autoRotate) { - 0 -> { - a.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LOCKED - } - - 1 -> { - a.requestedOrientation = if (isReversePortraitAllowed) { - ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR - } else { - ActivityInfo.SCREEN_ORIENTATION_SENSOR - } - } - - 2 -> { - a.requestedOrientation = if (isReversePortraitAllowed) { - ActivityInfo.SCREEN_ORIENTATION_FULL_USER - } else { - ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED - } - } + a.requestedOrientation = if (isReversePortraitAllowed) { + ActivityInfo.SCREEN_ORIENTATION_FULL_USER + } else { + ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED } } } diff --git a/app/src/main/java/com/futo/platformplayer/states/StateApp.kt b/app/src/main/java/com/futo/platformplayer/states/StateApp.kt index 171b7390..3adbe9c8 100644 --- a/app/src/main/java/com/futo/platformplayer/states/StateApp.kt +++ b/app/src/main/java/com/futo/platformplayer/states/StateApp.kt @@ -160,10 +160,6 @@ class StateApp { private var _cacheDirectory: File? = null; private var _persistentDirectory: File? = null; - - //AutoRotate - var systemAutoRotate: Boolean = false; - //Network private var _lastMeteredState: Boolean = false; private var _connectivityManager: ConnectivityManager? = null; @@ -201,17 +197,6 @@ class StateApp { return File(_persistentDirectory, name); } - fun getCurrentSystemAutoRotate(): Boolean { - _context?.let { - systemAutoRotate = android.provider.Settings.System.getInt( - it.contentResolver, - android.provider.Settings.System.ACCELEROMETER_ROTATION, 0 - ) == 1; - }; - return systemAutoRotate; - } - - fun isCurrentMetered(): Boolean { ensureConnectivityManager(); return _connectivityManager?.isActiveNetworkMetered ?: throw IllegalStateException("Connectivity manager not available"); @@ -312,9 +297,6 @@ class StateApp { fun setGlobalContext(context: Context, coroutineScope: CoroutineScope? = null) { _context = context; _scope = coroutineScope - - //System checks - systemAutoRotate = getCurrentSystemAutoRotate(); } fun initializeFiles(force: Boolean = false) { diff --git a/app/src/main/java/com/futo/platformplayer/views/video/FutoVideoPlayer.kt b/app/src/main/java/com/futo/platformplayer/views/video/FutoVideoPlayer.kt index 740740fa..79da5ba6 100644 --- a/app/src/main/java/com/futo/platformplayer/views/video/FutoVideoPlayer.kt +++ b/app/src/main/java/com/futo/platformplayer/views/video/FutoVideoPlayer.kt @@ -813,17 +813,12 @@ class FutoVideoPlayer : FutoVideoPlayerBase { } fun updateRotateLock() { - if(Settings.instance.playback.autoRotate == 0) { - _control_rotate_lock.visibility = View.GONE; - _control_rotate_lock_fullscreen.visibility = View.GONE; - } - else { - _control_rotate_lock.visibility = View.VISIBLE; - _control_rotate_lock_fullscreen.visibility = View.VISIBLE; - } + _control_rotate_lock.visibility = View.VISIBLE; + _control_rotate_lock_fullscreen.visibility = View.VISIBLE; + if(StatePlayer.instance.rotationLock) { - _control_rotate_lock_fullscreen.setImageResource(R.drawable.ic_screen_rotation); - _control_rotate_lock.setImageResource(R.drawable.ic_screen_rotation); + _control_rotate_lock_fullscreen.setImageResource(R.drawable.ic_screen_lock_rotation_active); + _control_rotate_lock.setImageResource(R.drawable.ic_screen_lock_rotation_active); } else { _control_rotate_lock_fullscreen.setImageResource(R.drawable.ic_screen_lock_rotation); diff --git a/app/src/main/res/drawable/ic_screen_lock_rotation_active.xml b/app/src/main/res/drawable/ic_screen_lock_rotation_active.xml new file mode 100644 index 00000000..4808cf0d --- /dev/null +++ b/app/src/main/res/drawable/ic_screen_lock_rotation_active.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 33ca1593..5394a597 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -287,10 +287,10 @@ Schedules discovered planned content as notifications, resulting in more accurate notifications for this content. Attempt to utilize byte ranges Auto Update - Auto-Rotate + Force Allow Full Screen Rotation + Allow auto-rotation between the two landscape orientations even when you disable auto-rotate at the system level. Simplify sources Deduplicate sources by resolution so that only more relevant sources are visible. - Auto-Rotate Dead Zone Automatic Backup Background Behavior Background Update @@ -928,17 +928,6 @@ On Startup Never - - Disabled - Enabled - Same as System - - - 0 - 5 - 10 - 20 - Disabled Enabled