|
@@ -37,12 +37,16 @@ import android.content.*;
|
|
import android.content.Intent;
|
|
import android.content.Intent;
|
|
import android.content.pm.ActivityInfo;
|
|
import android.content.pm.ActivityInfo;
|
|
import android.content.res.AssetManager;
|
|
import android.content.res.AssetManager;
|
|
|
|
+import android.graphics.Point;
|
|
import android.media.*;
|
|
import android.media.*;
|
|
import android.net.Uri;
|
|
import android.net.Uri;
|
|
import android.os.*;
|
|
import android.os.*;
|
|
import android.util.DisplayMetrics;
|
|
import android.util.DisplayMetrics;
|
|
import android.util.Log;
|
|
import android.util.Log;
|
|
import android.util.SparseArray;
|
|
import android.util.SparseArray;
|
|
|
|
+import android.view.Display;
|
|
|
|
+import android.view.DisplayCutout;
|
|
|
|
+import android.view.WindowInsets;
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
@@ -461,6 +465,28 @@ public class GodotIO {
|
|
return (int)(metrics.density * 160f);
|
|
return (int)(metrics.density * 160f);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public int[] screenGetUsableRect() {
|
|
|
|
+ DisplayMetrics metrics = activity.getResources().getDisplayMetrics();
|
|
|
|
+ Display display = activity.getWindowManager().getDefaultDisplay();
|
|
|
|
+ Point size = new Point();
|
|
|
|
+ display.getRealSize(size);
|
|
|
|
+
|
|
|
|
+ int result[] = { 0, 0, size.x, size.y };
|
|
|
|
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
|
|
|
+ WindowInsets insets = activity.getWindow().getDecorView().getRootWindowInsets();
|
|
|
|
+ DisplayCutout cutout = insets.getDisplayCutout();
|
|
|
|
+ if (cutout != null) {
|
|
|
|
+ int insetLeft = cutout.getSafeInsetLeft();
|
|
|
|
+ int insetTop = cutout.getSafeInsetTop();
|
|
|
|
+ result[0] = insetLeft;
|
|
|
|
+ result[1] = insetTop;
|
|
|
|
+ result[2] -= insetLeft + cutout.getSafeInsetRight();
|
|
|
|
+ result[3] -= insetTop + cutout.getSafeInsetBottom();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
public void showKeyboard(String p_existing_text, boolean p_multiline, int p_max_input_length, int p_cursor_start, int p_cursor_end) {
|
|
public void showKeyboard(String p_existing_text, boolean p_multiline, int p_max_input_length, int p_cursor_start, int p_cursor_end) {
|
|
if (edit != null)
|
|
if (edit != null)
|
|
edit.showKeyboard(p_existing_text, p_multiline, p_max_input_length, p_cursor_start, p_cursor_end);
|
|
edit.showKeyboard(p_existing_text, p_multiline, p_max_input_length, p_cursor_start, p_cursor_end);
|