Make certain we only hide system UI when we're fullscreen for real. (thanks Rachel!)
authorSam Lantinga <slouken@libsdl.org>
Mon, 18 Jun 2018 13:14:00 -0700
changeset 12023842dd960769e
parent 12022 b1de5ecf0c99
child 12024 3688283680b1
Make certain we only hide system UI when we're fullscreen for real. (thanks Rachel!)
android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
     1.1 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java	Mon Jun 18 13:13:58 2018 -0700
     1.2 +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java	Mon Jun 18 13:14:00 2018 -0700
     1.3 @@ -444,6 +444,8 @@
     1.4  
     1.5      protected static final int COMMAND_USER = 0x8000;
     1.6  
     1.7 +    protected static boolean mFullscreenModeActive;
     1.8 +
     1.9      /**
    1.10       * This method is called by SDL if SDL did not handle a message itself.
    1.11       * This happens if a received message contains an unsupported command.
    1.12 @@ -495,11 +497,13 @@
    1.13                              window.getDecorView().setSystemUiVisibility(flags);        
    1.14                              window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    1.15                              window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    1.16 +                            SDLActivity.mFullscreenModeActive = true;
    1.17                          } else {
    1.18                              int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_VISIBLE;
    1.19                              window.getDecorView().setSystemUiVisibility(flags);
    1.20                              window.addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    1.21                              window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    1.22 +                            SDLActivity.mFullscreenModeActive = false;
    1.23                          }
    1.24                      }
    1.25                  } else {
    1.26 @@ -1129,7 +1133,7 @@
    1.27      };
    1.28  
    1.29      public void onSystemUiVisibilityChange(int visibility) {
    1.30 -        if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0 || (visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0) {
    1.31 +        if (SDLActivity.mFullscreenModeActive && (visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0 || (visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0) {
    1.32  
    1.33              Handler handler = getWindow().getDecorView().getHandler();
    1.34              if (handler != null) {