v3.2.3: brought back Android orientation setting as 'force landscape'
This commit is contained in:
@@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.android;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.os.Build;
|
||||
import android.view.DisplayCutout;
|
||||
@@ -45,6 +46,9 @@ import java.util.regex.Pattern;
|
||||
public class AndroidPlatformSupport extends PlatformSupport {
|
||||
|
||||
public void updateDisplaySize(){
|
||||
AndroidLauncher.instance.setRequestedOrientation( SPDSettings.landscape() ?
|
||||
ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE :
|
||||
ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED );
|
||||
|
||||
//TODO seem to be existing bugs with handling split screen here, should look into that
|
||||
|
||||
|
||||
@@ -289,8 +289,7 @@ windows.wndsettings$displaytab.saver=Power Saver
|
||||
windows.wndsettings$displaytab.saver_desc=Power Saver mode draws the game at a reduced size and scales it up to fit your screen.\n\nThis will make graphics less crisp and enlarge the UI slightly, but will also improve performance and battery life.\n\nYou may need to restart the game for changes to take effect.
|
||||
windows.wndsettings$displaytab.okay=Okay
|
||||
windows.wndsettings$displaytab.cancel=Cancel
|
||||
windows.wndsettings$displaytab.portrait=Switch to portrait
|
||||
windows.wndsettings$displaytab.landscape=Switch to landscape
|
||||
windows.wndsettings$displaytab.landscape=Force landscape
|
||||
windows.wndsettings$displaytab.brightness=Brightness
|
||||
windows.wndsettings$displaytab.dark=Dark
|
||||
windows.wndsettings$displaytab.bright=Bright
|
||||
|
||||
@@ -50,7 +50,7 @@ public class SPDSettings extends GameSettings {
|
||||
//Display
|
||||
|
||||
public static final String KEY_FULLSCREEN = "fullscreen";
|
||||
public static final String KEY_LANDSCAPE = "landscape";
|
||||
public static final String KEY_LANDSCAPE = "force_landscape";
|
||||
public static final String KEY_ZOOM = "zoom";
|
||||
public static final String KEY_BRIGHTNESS = "brightness";
|
||||
public static final String KEY_GRID = "visual_grid";
|
||||
@@ -66,6 +66,15 @@ public class SPDSettings extends GameSettings {
|
||||
public static boolean fullscreen() {
|
||||
return getBoolean( KEY_FULLSCREEN, true );
|
||||
}
|
||||
|
||||
public static void landscape( boolean value ){
|
||||
put( KEY_LANDSCAPE, value );
|
||||
((ShatteredPixelDungeon)ShatteredPixelDungeon.instance).updateDisplaySize();
|
||||
}
|
||||
|
||||
public static boolean landscape(){
|
||||
return getBoolean(KEY_LANDSCAPE, false);
|
||||
}
|
||||
|
||||
public static void zoom( int value ) {
|
||||
put( KEY_ZOOM, value );
|
||||
|
||||
@@ -220,6 +220,7 @@ public class WndSettings extends WndTabbed {
|
||||
RenderedTextBlock title;
|
||||
ColorBlock sep1;
|
||||
CheckBox chkFullscreen;
|
||||
CheckBox chkLandscape;
|
||||
ColorBlock sep2;
|
||||
OptionSlider optBrightness;
|
||||
OptionSlider optVisGrid;
|
||||
@@ -250,6 +251,18 @@ public class WndSettings extends WndTabbed {
|
||||
}
|
||||
add(chkFullscreen);
|
||||
|
||||
if (DeviceCompat.isAndroid()) {
|
||||
chkLandscape = new CheckBox(Messages.get(this, "landscape")) {
|
||||
@Override
|
||||
protected void onClick() {
|
||||
super.onClick();
|
||||
SPDSettings.landscape(checked());
|
||||
}
|
||||
};
|
||||
chkLandscape.checked(SPDSettings.landscape());
|
||||
add(chkLandscape);
|
||||
}
|
||||
|
||||
sep2 = new ColorBlock(1, 1, 0xFF000000);
|
||||
add(sep2);
|
||||
|
||||
@@ -309,6 +322,11 @@ public class WndSettings extends WndTabbed {
|
||||
chkFullscreen.setRect(0, bottom + GAP, width, BTN_HEIGHT);
|
||||
bottom = chkFullscreen.bottom();
|
||||
|
||||
if (chkLandscape != null) {
|
||||
chkLandscape.setRect(0, bottom + GAP, width, BTN_HEIGHT);
|
||||
bottom = chkLandscape.bottom();
|
||||
}
|
||||
|
||||
sep2.size(width, 1);
|
||||
sep2.y = bottom + GAP;
|
||||
bottom = sep2.y + 1;
|
||||
|
||||
Reference in New Issue
Block a user