|
@@ -107,11 +107,9 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
|
if ((s & tst) == tst) src += " GAMEPAD";
|
|
if ((s & tst) == tst) src += " GAMEPAD";
|
|
s2 &= ~tst;
|
|
s2 &= ~tst;
|
|
|
|
|
|
- if (Build.VERSION.SDK_INT >= 21) {
|
|
|
|
- tst = InputDevice.SOURCE_HDMI;
|
|
|
|
- if ((s & tst) == tst) src += " HDMI";
|
|
|
|
- s2 &= ~tst;
|
|
|
|
- }
|
|
|
|
|
|
+ tst = InputDevice.SOURCE_HDMI;
|
|
|
|
+ if ((s & tst) == tst) src += " HDMI";
|
|
|
|
+ s2 &= ~tst;
|
|
|
|
|
|
tst = InputDevice.SOURCE_JOYSTICK;
|
|
tst = InputDevice.SOURCE_JOYSTICK;
|
|
if ((s & tst) == tst) src += " JOYSTICK";
|
|
if ((s & tst) == tst) src += " JOYSTICK";
|
|
@@ -146,11 +144,9 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
|
if ((s & tst) == tst) src += " TOUCHSCREEN";
|
|
if ((s & tst) == tst) src += " TOUCHSCREEN";
|
|
s2 &= ~tst;
|
|
s2 &= ~tst;
|
|
|
|
|
|
- if (Build.VERSION.SDK_INT >= 18) {
|
|
|
|
- tst = InputDevice.SOURCE_TOUCH_NAVIGATION;
|
|
|
|
- if ((s & tst) == tst) src += " TOUCH_NAVIGATION";
|
|
|
|
- s2 &= ~tst;
|
|
|
|
- }
|
|
|
|
|
|
+ tst = InputDevice.SOURCE_TOUCH_NAVIGATION;
|
|
|
|
+ if ((s & tst) == tst) src += " TOUCH_NAVIGATION";
|
|
|
|
+ s2 &= ~tst;
|
|
|
|
|
|
tst = InputDevice.SOURCE_TRACKBALL;
|
|
tst = InputDevice.SOURCE_TRACKBALL;
|
|
if ((s & tst) == tst) src += " TRACKBALL";
|
|
if ((s & tst) == tst) src += " TRACKBALL";
|
|
@@ -912,39 +908,37 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case COMMAND_CHANGE_WINDOW_STYLE:
|
|
case COMMAND_CHANGE_WINDOW_STYLE:
|
|
- if (Build.VERSION.SDK_INT >= 19 /* Android 4.4 (KITKAT) */) {
|
|
|
|
- if (context instanceof Activity) {
|
|
|
|
- Window window = ((Activity) context).getWindow();
|
|
|
|
- if (window != null) {
|
|
|
|
- if ((msg.obj instanceof Integer) && ((Integer) msg.obj != 0)) {
|
|
|
|
- int flags = View.SYSTEM_UI_FLAG_FULLSCREEN |
|
|
|
|
- View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
|
|
|
- View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
|
|
|
|
- View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
|
|
|
- View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
|
|
|
- View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.INVISIBLE;
|
|
|
|
- window.getDecorView().setSystemUiVisibility(flags);
|
|
|
|
- window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
|
|
|
- window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
|
|
|
|
- SDLActivity.mFullscreenModeActive = true;
|
|
|
|
- } else {
|
|
|
|
- int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_VISIBLE;
|
|
|
|
- window.getDecorView().setSystemUiVisibility(flags);
|
|
|
|
- window.addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
|
|
|
|
- window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
|
|
|
- SDLActivity.mFullscreenModeActive = false;
|
|
|
|
- }
|
|
|
|
- if (Build.VERSION.SDK_INT >= 28 /* Android 9 (Pie) */) {
|
|
|
|
- window.getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
|
|
|
|
- }
|
|
|
|
- if (Build.VERSION.SDK_INT >= 30 /* Android 11 (R) */ &&
|
|
|
|
- Build.VERSION.SDK_INT < 35 /* Android 15 */) {
|
|
|
|
- SDLActivity.onNativeInsetsChanged(0, 0, 0, 0);
|
|
|
|
- }
|
|
|
|
|
|
+ if (context instanceof Activity) {
|
|
|
|
+ Window window = ((Activity) context).getWindow();
|
|
|
|
+ if (window != null) {
|
|
|
|
+ if ((msg.obj instanceof Integer) && ((Integer) msg.obj != 0)) {
|
|
|
|
+ int flags = View.SYSTEM_UI_FLAG_FULLSCREEN |
|
|
|
|
+ View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
|
|
|
+ View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
|
|
|
|
+ View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
|
|
|
+ View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
|
|
|
+ View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.INVISIBLE;
|
|
|
|
+ window.getDecorView().setSystemUiVisibility(flags);
|
|
|
|
+ window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
|
|
|
+ window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
|
|
|
|
+ SDLActivity.mFullscreenModeActive = true;
|
|
|
|
+ } else {
|
|
|
|
+ int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_VISIBLE;
|
|
|
|
+ window.getDecorView().setSystemUiVisibility(flags);
|
|
|
|
+ window.addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
|
|
|
|
+ window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
|
|
|
+ SDLActivity.mFullscreenModeActive = false;
|
|
|
|
+ }
|
|
|
|
+ if (Build.VERSION.SDK_INT >= 28 /* Android 9 (Pie) */) {
|
|
|
|
+ window.getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
|
|
|
|
+ }
|
|
|
|
+ if (Build.VERSION.SDK_INT >= 30 /* Android 11 (R) */ &&
|
|
|
|
+ Build.VERSION.SDK_INT < 35 /* Android 15 */) {
|
|
|
|
+ SDLActivity.onNativeInsetsChanged(0, 0, 0, 0);
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- Log.e(TAG, "error handling message, getContext() returned no Activity");
|
|
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ Log.e(TAG, "error handling message, getContext() returned no Activity");
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
case COMMAND_TEXTEDIT_HIDE:
|
|
case COMMAND_TEXTEDIT_HIDE:
|
|
@@ -994,53 +988,51 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
|
msg.obj = data;
|
|
msg.obj = data;
|
|
boolean result = commandHandler.sendMessage(msg);
|
|
boolean result = commandHandler.sendMessage(msg);
|
|
|
|
|
|
- if (Build.VERSION.SDK_INT >= 19 /* Android 4.4 (KITKAT) */) {
|
|
|
|
- if (command == COMMAND_CHANGE_WINDOW_STYLE) {
|
|
|
|
- // Ensure we don't return until the resize has actually happened,
|
|
|
|
- // or 500ms have passed.
|
|
|
|
-
|
|
|
|
- boolean bShouldWait = false;
|
|
|
|
-
|
|
|
|
- if (data instanceof Integer) {
|
|
|
|
- // Let's figure out if we're already laid out fullscreen or not.
|
|
|
|
- Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
|
|
|
|
- DisplayMetrics realMetrics = new DisplayMetrics();
|
|
|
|
- display.getRealMetrics(realMetrics);
|
|
|
|
-
|
|
|
|
- boolean bFullscreenLayout = ((realMetrics.widthPixels == mSurface.getWidth()) &&
|
|
|
|
- (realMetrics.heightPixels == mSurface.getHeight()));
|
|
|
|
-
|
|
|
|
- if ((Integer) data == 1) {
|
|
|
|
- // If we aren't laid out fullscreen or actively in fullscreen mode already, we're going
|
|
|
|
- // to change size and should wait for surfaceChanged() before we return, so the size
|
|
|
|
- // is right back in native code. If we're already laid out fullscreen, though, we're
|
|
|
|
- // not going to change size even if we change decor modes, so we shouldn't wait for
|
|
|
|
- // surfaceChanged() -- which may not even happen -- and should return immediately.
|
|
|
|
- bShouldWait = !bFullscreenLayout;
|
|
|
|
- } else {
|
|
|
|
- // If we're laid out fullscreen (even if the status bar and nav bar are present),
|
|
|
|
- // or are actively in fullscreen, we're going to change size and should wait for
|
|
|
|
- // surfaceChanged before we return, so the size is right back in native code.
|
|
|
|
- bShouldWait = bFullscreenLayout;
|
|
|
|
- }
|
|
|
|
|
|
+ if (command == COMMAND_CHANGE_WINDOW_STYLE) {
|
|
|
|
+ // Ensure we don't return until the resize has actually happened,
|
|
|
|
+ // or 500ms have passed.
|
|
|
|
+
|
|
|
|
+ boolean bShouldWait = false;
|
|
|
|
+
|
|
|
|
+ if (data instanceof Integer) {
|
|
|
|
+ // Let's figure out if we're already laid out fullscreen or not.
|
|
|
|
+ Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
|
|
|
|
+ DisplayMetrics realMetrics = new DisplayMetrics();
|
|
|
|
+ display.getRealMetrics(realMetrics);
|
|
|
|
+
|
|
|
|
+ boolean bFullscreenLayout = ((realMetrics.widthPixels == mSurface.getWidth()) &&
|
|
|
|
+ (realMetrics.heightPixels == mSurface.getHeight()));
|
|
|
|
+
|
|
|
|
+ if ((Integer) data == 1) {
|
|
|
|
+ // If we aren't laid out fullscreen or actively in fullscreen mode already, we're going
|
|
|
|
+ // to change size and should wait for surfaceChanged() before we return, so the size
|
|
|
|
+ // is right back in native code. If we're already laid out fullscreen, though, we're
|
|
|
|
+ // not going to change size even if we change decor modes, so we shouldn't wait for
|
|
|
|
+ // surfaceChanged() -- which may not even happen -- and should return immediately.
|
|
|
|
+ bShouldWait = !bFullscreenLayout;
|
|
|
|
+ } else {
|
|
|
|
+ // If we're laid out fullscreen (even if the status bar and nav bar are present),
|
|
|
|
+ // or are actively in fullscreen, we're going to change size and should wait for
|
|
|
|
+ // surfaceChanged before we return, so the size is right back in native code.
|
|
|
|
+ bShouldWait = bFullscreenLayout;
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
|
|
- if (bShouldWait && (SDLActivity.getContext() != null)) {
|
|
|
|
- // We'll wait for the surfaceChanged() method, which will notify us
|
|
|
|
- // when called. That way, we know our current size is really the
|
|
|
|
- // size we need, instead of grabbing a size that's still got
|
|
|
|
- // the navigation and/or status bars before they're hidden.
|
|
|
|
- //
|
|
|
|
- // We'll wait for up to half a second, because some devices
|
|
|
|
- // take a surprisingly long time for the surface resize, but
|
|
|
|
- // then we'll just give up and return.
|
|
|
|
- //
|
|
|
|
- synchronized (SDLActivity.getContext()) {
|
|
|
|
- try {
|
|
|
|
- SDLActivity.getContext().wait(500);
|
|
|
|
- } catch (InterruptedException ie) {
|
|
|
|
- ie.printStackTrace();
|
|
|
|
- }
|
|
|
|
|
|
+ if (bShouldWait && (SDLActivity.getContext() != null)) {
|
|
|
|
+ // We'll wait for the surfaceChanged() method, which will notify us
|
|
|
|
+ // when called. That way, we know our current size is really the
|
|
|
|
+ // size we need, instead of grabbing a size that's still got
|
|
|
|
+ // the navigation and/or status bars before they're hidden.
|
|
|
|
+ //
|
|
|
|
+ // We'll wait for up to half a second, because some devices
|
|
|
|
+ // take a surprisingly long time for the surface resize, but
|
|
|
|
+ // then we'll just give up and return.
|
|
|
|
+ //
|
|
|
|
+ synchronized (SDLActivity.getContext()) {
|
|
|
|
+ try {
|
|
|
|
+ SDLActivity.getContext().wait(500);
|
|
|
|
+ } catch (InterruptedException ie) {
|
|
|
|
+ ie.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1774,16 +1766,14 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
|
private final Runnable rehideSystemUi = new Runnable() {
|
|
private final Runnable rehideSystemUi = new Runnable() {
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
- if (Build.VERSION.SDK_INT >= 19 /* Android 4.4 (KITKAT) */) {
|
|
|
|
- int flags = View.SYSTEM_UI_FLAG_FULLSCREEN |
|
|
|
|
- View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
|
|
|
- View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
|
|
|
|
- View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
|
|
|
- View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
|
|
|
- View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.INVISIBLE;
|
|
|
|
-
|
|
|
|
- SDLActivity.this.getWindow().getDecorView().setSystemUiVisibility(flags);
|
|
|
|
- }
|
|
|
|
|
|
+ int flags = View.SYSTEM_UI_FLAG_FULLSCREEN |
|
|
|
|
+ View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
|
|
|
|
+ View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY |
|
|
|
|
+ View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
|
|
|
+ View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
|
|
|
+ View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.INVISIBLE;
|
|
|
|
+
|
|
|
|
+ SDLActivity.this.getWindow().getDecorView().setSystemUiVisibility(flags);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
@@ -1978,12 +1968,9 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
|
Intent i = new Intent(Intent.ACTION_VIEW);
|
|
Intent i = new Intent(Intent.ACTION_VIEW);
|
|
i.setData(Uri.parse(url));
|
|
i.setData(Uri.parse(url));
|
|
|
|
|
|
- int flags = Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
|
|
|
|
- if (Build.VERSION.SDK_INT >= 21 /* Android 5.0 (LOLLIPOP) */) {
|
|
|
|
- flags |= Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
|
|
|
|
- } else {
|
|
|
|
- flags |= Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET;
|
|
|
|
- }
|
|
|
|
|
|
+ int flags = Intent.FLAG_ACTIVITY_NO_HISTORY
|
|
|
|
+ | Intent.FLAG_ACTIVITY_MULTIPLE_TASK
|
|
|
|
+ | Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
|
|
i.addFlags(flags);
|
|
i.addFlags(flags);
|
|
|
|
|
|
mSingleton.startActivity(i);
|
|
mSingleton.startActivity(i);
|