Skip to content

Commit

Permalink
Make certain we only hide system UI when we're fullscreen for real. (…
Browse files Browse the repository at this point in the history
…thanks Rachel!)
  • Loading branch information
slouken committed Jun 18, 2018
1 parent 8b574dc commit f1d8f5f
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -444,6 +444,8 @@ public static void handleNativeExit() {

protected static final int COMMAND_USER = 0x8000;

protected static boolean mFullscreenModeActive;

/**
* This method is called by SDL if SDL did not handle a message itself.
* This happens if a received message contains an unsupported command.
Expand Down Expand Up @@ -495,11 +497,13 @@ public void handleMessage(Message msg) {
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;
}
}
} else {
Expand Down Expand Up @@ -1129,7 +1133,7 @@ public void run() {
};

public void onSystemUiVisibilityChange(int visibility) {
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0 || (visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0) {
if (SDLActivity.mFullscreenModeActive && (visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0 || (visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0) {

Handler handler = getWindow().getDecorView().getHandler();
if (handler != null) {
Expand Down

0 comments on commit f1d8f5f

Please sign in to comment.