diff --git a/forge-gui-android/src/forge/app/Main.java b/forge-gui-android/src/forge/app/Main.java index 0a956eea17b..360c337a20a 100644 --- a/forge-gui-android/src/forge/app/Main.java +++ b/forge-gui-android/src/forge/app/Main.java @@ -449,13 +449,24 @@ public class Main extends AndroidApplication { WindowManager windowManager = (WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE); Display display = windowManager.getDefaultDisplay(); Point size = new Point(); - /*if (real) - display.getRealSize(size); - else - display.getSize(size); - //real size - return Pair.of(size.x, size.y);*/ //method works only on Build.VERSION.SDK_INT >= 17 (4.2), need to update android dependency from 4.1.1.4 to at least 8.0 - return Pair.of(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); + if (Build.VERSION.SDK_INT >= 17) { + if (real) + display.getRealSize(size); + else + display.getSize(size); + } else if (Build.VERSION.SDK_INT >= 14) { + try { + size.x = (Integer) Display.class.getMethod("getRawWidth").invoke(display); + size.y = (Integer) Display.class.getMethod("getRawHeight").invoke(display); + } catch (Exception e) { + size.x = Gdx.graphics.getWidth(); + size.y = Gdx.graphics.getHeight(); + } + } else { + size.x = Gdx.graphics.getWidth(); + size.y = Gdx.graphics.getHeight(); + } + return Pair.of(size.x, size.y); } }