From 7dabe1ec609e3af521b13176a271274a51d2af89 Mon Sep 17 00:00:00 2001 From: skriand Date: Sun, 23 Apr 2023 03:07:28 +0300 Subject: [PATCH] Some fixes after testing This is the only way requestedOrientation works after exiting portrait mode on the folding device. displayHeight must be there for the gameView to be centered; this has become necessary due to changes in emu_activity.xml --- app/src/main/java/emu/skyline/EmulationActivity.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/emu/skyline/EmulationActivity.kt b/app/src/main/java/emu/skyline/EmulationActivity.kt index 0b097487..db034e9e 100644 --- a/app/src/main/java/emu/skyline/EmulationActivity.kt +++ b/app/src/main/java/emu/skyline/EmulationActivity.kt @@ -515,17 +515,15 @@ class EmulationActivity : AppCompatActivity(), SurfaceHolder.Callback, View.OnTo * Updating the layout depending on type and state of device */ private fun updateCurrentLayout(newLayoutInfo: WindowLayoutInfo) { + requestedOrientation = emulationSettings.orientation + binding.onScreenGameView.minimumHeight = displayHeight if (!emulationSettings.supportFoldableScreen) return val foldingFeature = newLayoutInfo.displayFeatures.find { it is FoldingFeature } (foldingFeature as? FoldingFeature)?.let { - binding.onScreenGameView.minimumHeight = displayHeight - requestedOrientation = emulationSettings.orientation if (it.isSeparating) { requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED if (it.orientation == FoldingFeature.Orientation.HORIZONTAL) binding.onScreenGameView.minimumHeight = it.bounds.top - else - requestedOrientation = emulationSettings.orientation } } }