Browse files

Merge pull request #7508 from zackhow/lock-landscape

Android: lock screen to landscape by default
  • Loading branch information...
lioncash committed Oct 25, 2018
2 parents 74c49c9 + 9e44df1 commit 61821b067f9f5fac85188d8abc0841ce9529d0f1
@@ -4,6 +4,8 @@
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.hardware.usb.UsbManager;
import android.os.Bundle;
import android.os.Handler;
@@ -237,6 +239,17 @@ protected void onCreate(Bundle savedInstanceState)
int themeId;
if (mDeviceHasTouchScreen)
// Force landscape
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT)
BooleanSetting lockLandscape =
(BooleanSetting) mSettings.getSection(Settings.SECTION_INI_CORE)
if (lockLandscape == null || lockLandscape.getValue())
new Handler().postDelayed(
() -> setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE),
themeId =;
// Get a handle to the Window containing the UI.
@@ -212,6 +212,7 @@ private void addGeneralSettings(ArrayList<SettingsItem> sl)
Setting audioStretch = null;
Setting analytics = null;
Setting enableSaveState;
Setting lockToLandscape;
SettingSection coreSection = mSettings.getSection(Settings.SECTION_INI_CORE);
SettingSection analyticsSection = mSettings.getSection(Settings.SECTION_ANALYTICS);
@@ -223,6 +224,7 @@ private void addGeneralSettings(ArrayList<SettingsItem> sl)
audioStretch = coreSection.getSetting(SettingsFile.KEY_AUDIO_STRETCH);
analytics = analyticsSection.getSetting(SettingsFile.KEY_ANALYTICS_ENABLED);
enableSaveState = coreSection.getSetting(SettingsFile.KEY_ENABLE_SAVE_STATES);
lockToLandscape = coreSection.getSetting(SettingsFile.KEY_LOCK_LANDSCAPE);
// TODO: Having different emuCoresEntries/emuCoresValues for each architecture is annoying.
// The proper solution would be to have one emuCoresEntries and one emuCoresValues
@@ -262,6 +264,9 @@ else if (defaultCpuCore == 4) // AArch64
sl.add(new CheckBoxSetting(SettingsFile.KEY_ENABLE_SAVE_STATES, Settings.SECTION_INI_CORE,
R.string.enable_save_states, R.string.enable_save_states_description, false,
sl.add(new CheckBoxSetting(SettingsFile.KEY_LOCK_LANDSCAPE, Settings.SECTION_INI_CORE,
R.string.lock_emulation_landscape, R.string.lock_emulation_landscape_desc, true,
sl.add(new CheckBoxSetting(SettingsFile.KEY_ANALYTICS_ENABLED, Settings.SECTION_ANALYTICS,, 0, false, analytics));
@@ -50,6 +50,7 @@
public static final String KEY_SLOT_A_DEVICE = "SlotA";
public static final String KEY_SLOT_B_DEVICE = "SlotB";
public static final String KEY_ENABLE_SAVE_STATES = "EnableSaveStates";
public static final String KEY_LOCK_LANDSCAPE = "LockLandscape";
public static final String KEY_ANALYTICS_ENABLED = "Enabled";
public static final String KEY_ANALYTICS_PERMISSION_ASKED = "PermissionAsked";
@@ -137,6 +137,8 @@
<string name="audio_stretch_description">Stretches audio to reduce stuttering. Increases latency.</string>
<string name="enable_save_states">Enable Savestates</string>
<string name="enable_save_states_description">WARNING: Savestates may not be compatible with future versions of Dolphin and can make it impossible to create normal saves in some cases. Never use savestates as the only way of saving your progress.</string>
<string name="lock_emulation_landscape">Lock screen to landscape</string>
<string name="lock_emulation_landscape_desc">Some touch controls will require additional tweaking if played in portrait</string>
<string name="analytics">Enable usage statistics reporting</string>
<string name="analytics_desc">If authorized, Dolphin can collect data on its performance, feature usage, and configuration, as well as data on your system\'s hardware and operating system.\n\nNo private data is ever collected. This data helps us understand how people and emulated games use Dolphin and prioritize our efforts. It also helps us identify rare configurations that are causing bugs, performance and stability issues. This authorization can be revoked at any time through Dolphin\'s settings.</string>
<string name="gametdb_thanks">Thanks to for providing GameCube and Wii covers!</string>

0 comments on commit 61821b0

Please sign in to comment.