v0.7.4b: fixed errors with immersive mode not sticking in all cases

This commit is contained in:
Evan Debenham 2019-08-04 15:04:56 -04:00
parent 785726f4f8
commit 489ea63752
2 changed files with 13 additions and 8 deletions
android/src/main/java/com/shatteredpixel/shatteredpixeldungeon/android

View File

@ -40,6 +40,8 @@ public class AndroidLauncher extends AndroidApplication {
public static AndroidApplication instance;
protected static GLSurfaceView view;
private AndroidPlatformSupport support;
@Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -68,11 +70,10 @@ public class AndroidLauncher extends AndroidApplication {
config.useCompass = false;
config.useAccelerometer = false;
//TODO consider the following additional options, might be better than setting manually
//config.hideStatusBar
//config.useImmersiveMode
initialize(new ShatteredPixelDungeon( new AndroidPlatformSupport() ), config);
support = new AndroidPlatformSupport();
initialize(new ShatteredPixelDungeon(support), config);
view = (GLSurfaceView)graphics.getView();
@ -99,4 +100,9 @@ public class AndroidLauncher extends AndroidApplication {
}
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
support.updateSystemUI();
}
}

View File

@ -118,10 +118,9 @@ public class AndroidPlatformSupport extends PlatformSupport {
if (DeviceCompat.supportsFullScreen()){
if (SPDSettings.fullscreen()) {
AndroidLauncher.instance.getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
View.SYSTEM_UI_FLAG_HIDE_NAVIGATION );
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY );
} else {
AndroidLauncher.instance.getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE );