diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java
index 58af2a2b80..f6756d30b0 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java
@@ -24,6 +24,7 @@ import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
+import android.view.Surface;
import android.view.View;
import android.widget.SeekBar;
import android.widget.TextView;
@@ -98,7 +99,8 @@ public final class EmulationActivity extends AppCompatActivity
MENU_ACTION_SAVE_SLOT6, MENU_ACTION_LOAD_SLOT1, MENU_ACTION_LOAD_SLOT2,
MENU_ACTION_LOAD_SLOT3, MENU_ACTION_LOAD_SLOT4, MENU_ACTION_LOAD_SLOT5,
MENU_ACTION_LOAD_SLOT6, MENU_ACTION_EXIT, MENU_ACTION_CHANGE_DISC,
- MENU_ACTION_RESET_OVERLAY, MENU_SET_IR_SENSITIVITY, MENU_ACTION_CHOOSE_DOUBLETAP})
+ MENU_ACTION_RESET_OVERLAY, MENU_SET_IR_SENSITIVITY, MENU_ACTION_CHOOSE_DOUBLETAP,
+ MENU_ACTION_SCREEN_ORIENTATION})
public @interface MenuAction
{
}
@@ -132,6 +134,7 @@ public final class EmulationActivity extends AppCompatActivity
public static final int MENU_ACTION_RESET_OVERLAY = 26;
public static final int MENU_SET_IR_SENSITIVITY = 27;
public static final int MENU_ACTION_CHOOSE_DOUBLETAP = 28;
+ public static final int MENU_ACTION_SCREEN_ORIENTATION = 29;
private static SparseIntArray buttonsActionsMap = new SparseIntArray();
@@ -178,6 +181,8 @@ public final class EmulationActivity extends AppCompatActivity
EmulationActivity.MENU_SET_IR_SENSITIVITY);
buttonsActionsMap.append(R.id.menu_emulation_choose_doubletap,
EmulationActivity.MENU_ACTION_CHOOSE_DOUBLETAP);
+ buttonsActionsMap.append(R.id.menu_screen_orientation,
+ EmulationActivity.MENU_ACTION_SCREEN_ORIENTATION);
}
private static String[] scanForSecondDisc(GameFile gameFile)
@@ -253,9 +258,13 @@ public final class EmulationActivity extends AppCompatActivity
restoreState(savedInstanceState);
}
+ mPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+
mSettings = new Settings();
mSettings.loadSettings(null);
+ updateOrientation();
+
// TODO: The accurate way to find out which console we're emulating is to
// first launch emulation and then ask the core which console we're emulating
sIsGameCubeGame = Platform.fromNativeInt(mPlatform) == Platform.GAMECUBE;
@@ -297,17 +306,6 @@ public final class EmulationActivity extends AppCompatActivity
setContentView(R.layout.activity_emulation);
-
- BooleanSetting lockLandscapeSetting =
- (BooleanSetting) mSettings.getSection(Settings.SECTION_INI_CORE)
- .getSetting(SettingsFile.KEY_LOCK_LANDSCAPE);
- boolean lockLandscape = lockLandscapeSetting == null || lockLandscapeSetting.getValue();
- // Force landscape if set
- if (mDeviceHasTouchScreen && lockLandscape)
- {
- setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
- }
-
// Find or create the EmulationFragment
mEmulationFragment = (EmulationFragment) getSupportFragmentManager()
.findFragmentById(R.id.frame_emulation_fragment);
@@ -323,9 +321,6 @@ public final class EmulationActivity extends AppCompatActivity
{
setTitle(mSelectedTitle);
}
-
- mPreferences = PreferenceManager.getDefaultSharedPreferences(this);
-
}
@Override
@@ -431,6 +426,12 @@ public final class EmulationActivity extends AppCompatActivity
View.SYSTEM_UI_FLAG_IMMERSIVE);
}
+ private void updateOrientation()
+ {
+ setRequestedOrientation(mPreferences.getInt("emulationActivityOrientation",
+ ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE));
+ }
+
private void toggleMenu()
{
boolean result = getSupportFragmentManager().popBackStackImmediate(
@@ -646,6 +647,10 @@ public final class EmulationActivity extends AppCompatActivity
chooseDoubleTapButton();
return;
+ case MENU_ACTION_SCREEN_ORIENTATION:
+ chooseOrientation();
+ return;
+
case MENU_ACTION_EXIT:
// ATV menu is built using a fragment, this will pop that fragment before emulation ends.
if (TvUtil.isLeanback(getApplicationContext()))
@@ -883,6 +888,37 @@ public final class EmulationActivity extends AppCompatActivity
alertDialog.show();
}
+ private void chooseOrientation()
+ {
+ final int[] orientationValues = getResources().getIntArray(R.array.orientationValues);
+ int initialChoice = mPreferences.getInt("emulationActivityOrientation",
+ ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
+ int initialIndex = -1;
+ for (int i = 0; i < orientationValues.length; i++)
+ {
+ if (orientationValues[i] == initialChoice)
+ initialIndex = i;
+ }
+
+ final SharedPreferences.Editor editor = mPreferences.edit();
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setTitle(R.string.emulation_screen_orientation);
+ builder.setSingleChoiceItems(R.array.orientationEntries, initialIndex,
+ (dialog, indexSelected) ->
+ {
+ int orientation = orientationValues[indexSelected];
+ editor.putInt("emulationActivityOrientation", orientation);
+ });
+ builder.setPositiveButton(getString(R.string.ok), (dialogInterface, i) ->
+ {
+ editor.apply();
+ updateOrientation();
+ });
+
+ AlertDialog alertDialog = builder.create();
+ alertDialog.show();
+ }
+
private void setIRSensitivity()
{
int ir_pitch = Integer.valueOf(
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java
index 83817cae95..8a47aae890 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java
@@ -224,7 +224,6 @@ public final class SettingsFragmentPresenter
Setting autoDiscChange = null;
Setting analytics = null;
Setting enableSaveState;
- Setting lockToLandscape;
SettingSection coreSection = mSettings.getSection(Settings.SECTION_INI_CORE);
SettingSection analyticsSection = mSettings.getSection(Settings.SECTION_ANALYTICS);
@@ -238,7 +237,6 @@ public final class SettingsFragmentPresenter
autoDiscChange = coreSection.getSetting(SettingsFile.KEY_AUTO_DISC_CHANGE);
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
@@ -283,12 +281,6 @@ public final class SettingsFragmentPresenter
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,
enableSaveState));
- if (!TvUtil.isLeanback(DolphinApplication.getAppContext()))
- {
- sl.add(new CheckBoxSetting(SettingsFile.KEY_LOCK_LANDSCAPE, Settings.SECTION_INI_CORE,
- R.string.lock_emulation_landscape, R.string.lock_emulation_landscape_desc, true,
- lockToLandscape));
- }
sl.add(new CheckBoxSetting(SettingsFile.KEY_ANALYTICS_ENABLED, Settings.SECTION_ANALYTICS,
R.string.analytics, 0, false, analytics));
}
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/utils/SettingsFile.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/utils/SettingsFile.java
index aac139266f..d14992f5f9 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/utils/SettingsFile.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/utils/SettingsFile.java
@@ -52,7 +52,6 @@ public final class SettingsFile
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";
diff --git a/Source/Android/app/src/main/res/menu/menu_emulation.xml b/Source/Android/app/src/main/res/menu/menu_emulation.xml
index cfa126c4c9..6f0abbeae7 100644
--- a/Source/Android/app/src/main/res/menu/menu_emulation.xml
+++ b/Source/Android/app/src/main/res/menu/menu_emulation.xml
@@ -113,6 +113,11 @@
+
+
-
+
+
- Wii Controller Settings
- Clear Game Settings
+
+
+ - Landscape
+ - Portrait
+ - Auto
+
+
+ - 0
+ - 1
+ - -1
+
diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml
index 2ecbb07df7..14b992aea2 100644
--- a/Source/Android/app/src/main/res/values/strings.xml
+++ b/Source/Android/app/src/main/res/values/strings.xml
@@ -313,6 +313,7 @@
Touch IR Pointer
IR Sensitivity
Double tap button
+ Screen Orientation
Enable Vibration