mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
add alternate method
This commit is contained in:
@@ -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)
|
||||
if (Build.VERSION.SDK_INT >= 17) {
|
||||
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());
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user