v3.2.2: removed Android landscape setting, now uses system orientation
This commit is contained in:
@@ -31,7 +31,6 @@
|
|||||||
android:backupAgent=".AndroidBackupHandler">
|
android:backupAgent=".AndroidBackupHandler">
|
||||||
<activity
|
<activity
|
||||||
android:name=".AndroidLauncher"
|
android:name=".AndroidLauncher"
|
||||||
android:screenOrientation="nosensor"
|
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ package com.shatteredpixel.shatteredpixeldungeon.android;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.ActivityInfo;
|
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -122,13 +121,6 @@ public class AndroidLauncher extends AndroidApplication {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//set desired orientation (if it exists) before initializing the app.
|
|
||||||
if (SPDSettings.landscape() != null) {
|
|
||||||
instance.setRequestedOrientation( SPDSettings.landscape() ?
|
|
||||||
ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE :
|
|
||||||
ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT );
|
|
||||||
}
|
|
||||||
|
|
||||||
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
|
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
|
||||||
config.depth = 0;
|
config.depth = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ package com.shatteredpixel.shatteredpixeldungeon.android;
|
|||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.ActivityInfo;
|
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -43,11 +42,7 @@ import java.util.regex.Pattern;
|
|||||||
public class AndroidPlatformSupport extends PlatformSupport {
|
public class AndroidPlatformSupport extends PlatformSupport {
|
||||||
|
|
||||||
public void updateDisplaySize(){
|
public void updateDisplaySize(){
|
||||||
if (SPDSettings.landscape() != null) {
|
|
||||||
AndroidLauncher.instance.setRequestedOrientation( SPDSettings.landscape() ?
|
|
||||||
ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE :
|
|
||||||
ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT );
|
|
||||||
}
|
|
||||||
//TODO seem to be existing bugs with handling split screen here, should look into that
|
//TODO seem to be existing bugs with handling split screen here, should look into that
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,21 +67,6 @@ public class SPDSettings extends GameSettings {
|
|||||||
return getBoolean( KEY_FULLSCREEN, DeviceCompat.isDesktop() );
|
return getBoolean( KEY_FULLSCREEN, DeviceCompat.isDesktop() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void landscape( boolean value ){
|
|
||||||
put( KEY_LANDSCAPE, value );
|
|
||||||
((ShatteredPixelDungeon)ShatteredPixelDungeon.instance).updateDisplaySize();
|
|
||||||
}
|
|
||||||
|
|
||||||
//can return null because we need to directly handle the case of landscape not being set
|
|
||||||
// as there are different defaults for different devices
|
|
||||||
public static Boolean landscape(){
|
|
||||||
if (contains(KEY_LANDSCAPE)){
|
|
||||||
return getBoolean(KEY_LANDSCAPE, false);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void zoom( int value ) {
|
public static void zoom( int value ) {
|
||||||
put( KEY_ZOOM, value );
|
put( KEY_ZOOM, value );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,8 +220,6 @@ public class WndSettings extends WndTabbed {
|
|||||||
RenderedTextBlock title;
|
RenderedTextBlock title;
|
||||||
ColorBlock sep1;
|
ColorBlock sep1;
|
||||||
CheckBox chkFullscreen;
|
CheckBox chkFullscreen;
|
||||||
OptionSlider optScale;
|
|
||||||
RedButton btnOrientation;
|
|
||||||
ColorBlock sep2;
|
ColorBlock sep2;
|
||||||
OptionSlider optBrightness;
|
OptionSlider optBrightness;
|
||||||
OptionSlider optVisGrid;
|
OptionSlider optVisGrid;
|
||||||
@@ -252,24 +250,6 @@ public class WndSettings extends WndTabbed {
|
|||||||
}
|
}
|
||||||
add(chkFullscreen);
|
add(chkFullscreen);
|
||||||
|
|
||||||
//TODO change to respect auto-rotation when updating Android SDK?
|
|
||||||
if (DeviceCompat.isAndroid()) {
|
|
||||||
Boolean landscape = SPDSettings.landscape();
|
|
||||||
if (landscape == null){
|
|
||||||
landscape = Game.width > Game.height;
|
|
||||||
}
|
|
||||||
Boolean finalLandscape = landscape;
|
|
||||||
btnOrientation = new RedButton(finalLandscape ?
|
|
||||||
Messages.get(this, "portrait")
|
|
||||||
: Messages.get(this, "landscape")) {
|
|
||||||
@Override
|
|
||||||
protected void onClick() {
|
|
||||||
SPDSettings.landscape(!finalLandscape);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
add(btnOrientation);
|
|
||||||
}
|
|
||||||
|
|
||||||
sep2 = new ColorBlock(1, 1, 0xFF000000);
|
sep2 = new ColorBlock(1, 1, 0xFF000000);
|
||||||
add(sep2);
|
add(sep2);
|
||||||
|
|
||||||
@@ -329,16 +309,6 @@ public class WndSettings extends WndTabbed {
|
|||||||
chkFullscreen.setRect(0, bottom + GAP, width, BTN_HEIGHT);
|
chkFullscreen.setRect(0, bottom + GAP, width, BTN_HEIGHT);
|
||||||
bottom = chkFullscreen.bottom();
|
bottom = chkFullscreen.bottom();
|
||||||
|
|
||||||
if (btnOrientation != null) {
|
|
||||||
btnOrientation.setRect(0, bottom + GAP, width, BTN_HEIGHT);
|
|
||||||
bottom = btnOrientation.bottom();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (optScale != null){
|
|
||||||
optScale.setRect(0, bottom + GAP, width, SLIDER_HEIGHT);
|
|
||||||
bottom = optScale.bottom();
|
|
||||||
}
|
|
||||||
|
|
||||||
sep2.size(width, 1);
|
sep2.size(width, 1);
|
||||||
sep2.y = bottom + GAP;
|
sep2.y = bottom + GAP;
|
||||||
bottom = sep2.y + 1;
|
bottom = sep2.y + 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user