Android: Combine reading cutout setting with updateOrientation
This commit is contained in:
parent
7eb02ecfa4
commit
11041e950d
|
@ -109,8 +109,6 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
settings.loadSettings()
|
settings.loadSettings()
|
||||||
|
|
||||||
updateOrientation()
|
|
||||||
|
|
||||||
// Set these options now so that the SurfaceView the game renders into is the right size.
|
// Set these options now so that the SurfaceView the game renders into is the right size.
|
||||||
enableFullscreenImmersive()
|
enableFullscreenImmersive()
|
||||||
|
|
||||||
|
@ -203,21 +201,7 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
|
||||||
|
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
|
||||||
// Only android 9+ support this feature.
|
updateDisplaySettings()
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
|
||||||
val attributes = window.attributes
|
|
||||||
|
|
||||||
attributes.layoutInDisplayCutoutMode =
|
|
||||||
if (BooleanSetting.MAIN_EXPAND_TO_CUTOUT_AREA.boolean) {
|
|
||||||
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
|
|
||||||
} else {
|
|
||||||
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER
|
|
||||||
}
|
|
||||||
|
|
||||||
window.attributes = attributes
|
|
||||||
}
|
|
||||||
|
|
||||||
updateOrientation()
|
|
||||||
|
|
||||||
DolphinSensorEventListener.setDeviceRotation(windowManager.defaultDisplay.rotation)
|
DolphinSensorEventListener.setDeviceRotation(windowManager.defaultDisplay.rotation)
|
||||||
}
|
}
|
||||||
|
@ -338,7 +322,20 @@ class EmulationActivity : AppCompatActivity(), ThemeProvider {
|
||||||
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateOrientation() {
|
private fun updateDisplaySettings() {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||||
|
val attributes = window.attributes
|
||||||
|
|
||||||
|
attributes.layoutInDisplayCutoutMode =
|
||||||
|
if (BooleanSetting.MAIN_EXPAND_TO_CUTOUT_AREA.boolean) {
|
||||||
|
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
|
||||||
|
} else {
|
||||||
|
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER
|
||||||
|
}
|
||||||
|
|
||||||
|
window.attributes = attributes
|
||||||
|
}
|
||||||
|
|
||||||
requestedOrientation = IntSetting.MAIN_EMULATION_ORIENTATION.int
|
requestedOrientation = IntSetting.MAIN_EMULATION_ORIENTATION.int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue