diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDSettings.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDSettings.java index 5c6f21415..d1c8ceca6 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDSettings.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDSettings.java @@ -75,6 +75,8 @@ public class SPDSettings extends GameSettings { ((ShatteredPixelDungeon)ShatteredPixelDungeon.instance).updateDisplaySize(); } + //FIXME in certain multi-window cases this can disagree with the actual screen size + //there should be an option to check for landscape the setting, and actual screen size public static boolean landscape() { return getBoolean(KEY_LANDSCAPE, Game.dispWidth > Game.dispHeight); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java index e0da595d2..ad4f6c2bc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java @@ -22,6 +22,7 @@ package com.shatteredpixel.shatteredpixeldungeon; import android.content.pm.ActivityInfo; +import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; import android.view.View; @@ -251,6 +252,13 @@ public class ShatteredPixelDungeon extends Game { updateDisplaySize(); } + + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + + updateDisplaySize(); + } public void updateDisplaySize(){ boolean landscape = SPDSettings.landscape(); @@ -267,11 +275,8 @@ public class ShatteredPixelDungeon extends Game { } } - if (view.getMeasuredWidth() == 0 || view.getMeasuredHeight() == 0) - return; - - dispWidth = view.getMeasuredWidth(); - dispHeight = view.getMeasuredHeight(); + dispHeight = getWindow().getWindowManager().getDefaultDisplay().getHeight(); + dispWidth = getWindow().getWindowManager().getDefaultDisplay().getWidth(); float dispRatio = dispWidth / (float)dispHeight;