v0.7.0a: fixed various issues with screen layout and power saver mode
This commit is contained in:
parent
02e0de6273
commit
06a6116852
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user