mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-04-18 06:20:19 +00:00
Force landscape mode when using OSC
This commit is contained in:
@@ -199,9 +199,6 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enter landscape unless we're on a square screen
|
|
||||||
setPreferredOrientationForCurrentDisplay();
|
|
||||||
|
|
||||||
// Listen for UI visibility events
|
// Listen for UI visibility events
|
||||||
getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(this);
|
getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(this);
|
||||||
|
|
||||||
@@ -219,6 +216,9 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
prefConfig = PreferenceConfiguration.readPreferences(this);
|
prefConfig = PreferenceConfiguration.readPreferences(this);
|
||||||
tombstonePrefs = Game.this.getSharedPreferences("DecoderTombstone", 0);
|
tombstonePrefs = Game.this.getSharedPreferences("DecoderTombstone", 0);
|
||||||
|
|
||||||
|
// Enter landscape unless we're on a square screen
|
||||||
|
setPreferredOrientationForCurrentDisplay();
|
||||||
|
|
||||||
if (prefConfig.stretchVideo || shouldIgnoreInsetsForResolution(prefConfig.width, prefConfig.height)) {
|
if (prefConfig.stretchVideo || shouldIgnoreInsetsForResolution(prefConfig.width, prefConfig.height)) {
|
||||||
// Allow the activity to layout under notches if the fill-screen option
|
// Allow the activity to layout under notches if the fill-screen option
|
||||||
// was turned on by the user or it's a full-screen native resolution
|
// was turned on by the user or it's a full-screen native resolution
|
||||||
@@ -526,9 +526,10 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setPreferredOrientationForCurrentDisplay() {
|
private void setPreferredOrientationForCurrentDisplay() {
|
||||||
// If the display is somewhat square, allow any orientation. Otherwise, request landscape.
|
// If the display is somewhat square and OSC is disabled, allow any orientation. Otherwise, request landscape.
|
||||||
|
// The OSC code assumes a landscape display, so we force landscape if OSC is enabled.
|
||||||
Display display = getWindowManager().getDefaultDisplay();
|
Display display = getWindowManager().getDefaultDisplay();
|
||||||
if (PreferenceConfiguration.isSquarishScreen(display.getWidth(), display.getHeight())) {
|
if (!prefConfig.onscreenController && PreferenceConfiguration.isSquarishScreen(display.getWidth(), display.getHeight())) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
||||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER);
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_USER);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user