mirror of
https://github.com/yairm210/Unciv.git
synced 2025-01-05 13:08:48 +07:00
Optimize screen orientation (#11875)
This commit is contained in:
parent
15d532e287
commit
4db4400105
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user