From 4db440010599baa1039b1c105260ecdab6721d7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=84=95=E6=99=A8HChen?= <123531821+HChenX@users.noreply.github.com> Date: Sun, 30 Jun 2024 04:57:11 +0800 Subject: [PATCH] Optimize screen orientation (#11875) --- android/src/com/unciv/app/AndroidDisplay.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/android/src/com/unciv/app/AndroidDisplay.kt b/android/src/com/unciv/app/AndroidDisplay.kt index e7f0a58be2..cbf83d9f48 100644 --- a/android/src/com/unciv/app/AndroidDisplay.kt +++ b/android/src/com/unciv/app/AndroidDisplay.kt @@ -122,11 +122,12 @@ class AndroidDisplay(private val activity: AndroidApplication) : PlatformDisplay override fun setOrientation(orientation: ScreenOrientation) { val mode = when (orientation) { - ScreenOrientation.Landscape -> ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE - ScreenOrientation.Portrait -> ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT + // Automatically adjust landscape based on sensors. + ScreenOrientation.Landscape -> ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE + // Automatically adjust the portrait based on the sensor. + ScreenOrientation.Portrait -> ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT ScreenOrientation.Auto -> ActivityInfo.SCREEN_ORIENTATION_SENSOR } - // Ensure ActivityTaskManager.getService().setRequestedOrientation isn't called unless necessary! if (activity.requestedOrientation != mode) activity.requestedOrientation = mode