You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by er...@apache.org on 2021/03/30 05:55:23 UTC

[cordova-android] branch master updated: fix(splashscreen): nav & title bar showing in fullscreen mode (#733)

This is an automated email from the ASF dual-hosted git repository.

erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-android.git


The following commit(s) were added to refs/heads/master by this push:
     new cb1cf4d  fix(splashscreen): nav & title bar showing in fullscreen mode (#733)
cb1cf4d is described below

commit cb1cf4dc8ee2e92bbeef76fa449deafbcc1dabc2
Author: Daniel Stone <fr...@gmail.com>
AuthorDate: Tue Mar 30 01:55:16 2021 -0400

    fix(splashscreen): nav & title bar showing in fullscreen mode (#733)
    
    Co-authored-by: Daniel Stone <da...@powerdms.com>
    Co-authored-by: distinctdan <di...@users.noreply.github.com>
---
 .../src/org/apache/cordova/CordovaActivity.java    | 25 ++++++++++++++--------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java
index f2f5619..9b15e33 100755
--- a/framework/src/org/apache/cordova/CordovaActivity.java
+++ b/framework/src/org/apache/cordova/CordovaActivity.java
@@ -125,6 +125,9 @@ public class CordovaActivity extends Activity {
             // (as was the case in previous cordova versions)
             if (!preferences.getBoolean("FullscreenNotImmersive", false)) {
                 immersiveMode = true;
+                // The splashscreen plugin needs the flags set before we're focused to prevent
+                // the nav and title bars from flashing in.
+                setImmersiveUiVisibility();
             } else {
                 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                         WindowManager.LayoutParams.FLAG_FULLSCREEN);
@@ -321,22 +324,26 @@ public class CordovaActivity extends Activity {
     /**
      * Called when view focus is changed
      */
-    @SuppressLint("InlinedApi")
     @Override
     public void onWindowFocusChanged(boolean hasFocus) {
         super.onWindowFocusChanged(hasFocus);
         if (hasFocus && immersiveMode) {
-            final int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
-                    | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
-                    | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
-                    | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
-                    | View.SYSTEM_UI_FLAG_FULLSCREEN
-                    | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
-
-            getWindow().getDecorView().setSystemUiVisibility(uiOptions);
+            setImmersiveUiVisibility();
         }
     }
 
+    @SuppressLint("InlinedApi")
+    protected void setImmersiveUiVisibility() {
+        final int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
+                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+                | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
+                | View.SYSTEM_UI_FLAG_FULLSCREEN
+                | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
+
+        getWindow().getDecorView().setSystemUiVisibility(uiOptions);
+    }
+
     @SuppressLint("NewApi")
     @Override
     public void startActivityForResult(Intent intent, int requestCode, Bundle options) {

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org