mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-24 03:53:12 -04: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) {
|
override fun setOrientation(orientation: ScreenOrientation) {
|
||||||
val mode = when (orientation) {
|
val mode = when (orientation) {
|
||||||
ScreenOrientation.Landscape -> ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE
|
// Automatically adjust landscape based on sensors.
|
||||||
ScreenOrientation.Portrait -> ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
|
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
|
ScreenOrientation.Auto -> ActivityInfo.SCREEN_ORIENTATION_SENSOR
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure ActivityTaskManager.getService().setRequestedOrientation isn't called unless necessary!
|
// Ensure ActivityTaskManager.getService().setRequestedOrientation isn't called unless necessary!
|
||||||
if (activity.requestedOrientation != mode)
|
if (activity.requestedOrientation != mode)
|
||||||
activity.requestedOrientation = mode
|
activity.requestedOrientation = mode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user