Fix 'get_window_safe_area' on Android
This commit is contained in:
parent
13a0d6e9b2
commit
d7c6ad2020
@ -178,12 +178,10 @@ public class GodotIO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int[] getDisplaySafeArea() {
|
public int[] getDisplaySafeArea() {
|
||||||
DisplayMetrics metrics = activity.getResources().getDisplayMetrics();
|
Rect rect = new Rect();
|
||||||
Display display = activity.getWindowManager().getDefaultDisplay();
|
activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(rect);
|
||||||
Point size = new Point();
|
|
||||||
display.getRealSize(size);
|
|
||||||
|
|
||||||
int[] result = { 0, 0, size.x, size.y };
|
int[] result = { rect.left, rect.top, rect.right, rect.bottom };
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||||
WindowInsets insets = activity.getWindow().getDecorView().getRootWindowInsets();
|
WindowInsets insets = activity.getWindow().getDecorView().getRootWindowInsets();
|
||||||
DisplayCutout cutout = insets.getDisplayCutout();
|
DisplayCutout cutout = insets.getDisplayCutout();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user