From 4c7fd0447d7333d815d2d9e8343e5f97ae9a24d1 Mon Sep 17 00:00:00 2001 From: skriand Date: Sat, 22 Apr 2023 13:53:05 +0300 Subject: [PATCH] Fix ignore user orientation setting The default Auto entry is now called Landscape (Auto), which better describes the SCREEN_ORIENTATION_SENSOR_LANDSCAPE property. For devices like the Surface Duo, Oppo Find X, and Flip, to use the folding feature, the user must select the new Auto entry in the settings. --- .../main/java/emu/skyline/EmulationActivity.kt | 15 +++++++++++---- app/src/main/res/values/array.xml | 2 ++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/emu/skyline/EmulationActivity.kt b/app/src/main/java/emu/skyline/EmulationActivity.kt index bd98001e..0adc35ae 100644 --- a/app/src/main/java/emu/skyline/EmulationActivity.kt +++ b/app/src/main/java/emu/skyline/EmulationActivity.kt @@ -507,14 +507,21 @@ class EmulationActivity : AppCompatActivity(), SurfaceHolder.Callback, View.OnTo val displayMetrics = DisplayMetrics() windowManager.defaultDisplay.getMetrics(displayMetrics) binding.onScreenGameView.minimumHeight = displayMetrics.heightPixels - requestedOrientation = emulationSettings.orientation + requestedOrientation = + if (emulationSettings.orientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) { + emulationSettings.orientation + } else { + ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE + } for (displayFeature in newLayoutInfo.displayFeatures) { val foldFeature = displayFeature as? FoldingFeature foldFeature?.let { + //Folding feature separates the display area into two distinct sections if (it.isSeparating) { - //Folding feature separates the display area into two distinct sections - requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED - if (foldFeature.orientation == FoldingFeature.Orientation.HORIZONTAL) { + if (emulationSettings.orientation == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED){ + requestedOrientation = emulationSettings.orientation + } + if (it.orientation == FoldingFeature.Orientation.HORIZONTAL) { binding.onScreenGameView.minimumHeight = displayFeature.bounds.top } } diff --git a/app/src/main/res/values/array.xml b/app/src/main/res/values/array.xml index 88ad6132..b7ee68ea 100644 --- a/app/src/main/res/values/array.xml +++ b/app/src/main/res/values/array.xml @@ -85,12 +85,14 @@ Device Aspect Ratio (Stretch to fit) + Landscape (auto) Auto Landscape Landscape (reverse) 6 + -1 0 8