Add screen orientation setting

This commit is contained in:
lynxnb 2022-01-09 17:20:02 +01:00 committed by PixelyIon
parent bc29b23972
commit a9d4e6bb1a
6 changed files with 24 additions and 5 deletions

View File

@ -52,7 +52,7 @@
<activity
android:name="emu.skyline.input.onscreen.OnScreenEditActivity"
android:exported="true"
android:screenOrientation="landscape"
android:screenOrientation="sensorLandscape"
tools:ignore="LockedOrientationActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
@ -63,9 +63,7 @@
android:name="emu.skyline.EmulationActivity"
android:configChanges="orientation|screenSize"
android:exported="true"
android:launchMode="singleTask"
android:screenOrientation="landscape"
tools:ignore="LockedOrientationActivity">
android:launchMode="singleTask">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="emu.skyline.MainActivity" />

View File

@ -225,7 +225,7 @@ class EmulationActivity : AppCompatActivity(), SurfaceHolder.Callback, View.OnTo
@SuppressLint("SetTextI18n", "ClickableViewAccessibility")
override fun onCreate(savedInstanceState : Bundle?) {
super.onCreate(savedInstanceState)
requestedOrientation = settings.orientation
setContentView(binding.root)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {

View File

@ -6,6 +6,7 @@
package emu.skyline.utils
import android.content.Context
import android.content.pm.ActivityInfo
import dagger.hilt.android.qualifiers.ApplicationContext
import javax.inject.Inject
import javax.inject.Singleton
@ -41,4 +42,6 @@ class Settings @Inject constructor(@ApplicationContext private val context : Con
var aspectRatio by sharedPreferences(context, 0)
var systemLanguage by sharedPreferences(context, 1)
var orientation by sharedPreferences(context, ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE)
}

View File

@ -79,4 +79,14 @@
<item>21:9 (Ultrawide Mods)</item>
<item>Device Aspect Ratio (Stretch to fit)</item>
</string-array>
<string-array name="orientation_entries">
<item>Auto</item>
<item>Landscape</item>
<item>Landscape (reverse)</item>
</string-array>
<integer-array name="orientation_values">
<item>6</item>
<item>0</item>
<item>8</item>
</integer-array>
</resources>

View File

@ -52,6 +52,7 @@
<string name="import_keys_failed">Failed to import keys</string>
<!-- Settings - Display -->
<string name="display">Display</string>
<string name="screen_orientation">Screen orientation</string>
<string name="force_triple_buffering">Force Triple Buffering</string>
<string name="triple_buffering_enabled">Utilize at least three swapchain buffers (Higher FPS but more input lag)</string>
<string name="triple_buffering_disabled">Utilize at least two swapchain buffers (Lower FPS but less input lag)</string>

View File

@ -84,6 +84,13 @@
<PreferenceCategory
android:key="category_presentation"
android:title="@string/display">
<emu.skyline.preference.IntegerListPreference
android:defaultValue="6"
android:entries="@array/orientation_entries"
android:entryValues="@array/orientation_values"
app:key="orientation"
app:title="@string/screen_orientation"
app:useSimpleSummaryProvider="true" />
<CheckBoxPreference
android:defaultValue="true"
android:summaryOff="@string/triple_buffering_disabled"