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

GitToTheHub 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 43690590 fix(statusbar): hide status bar correctly (#2000)
43690590 is described below

commit 43690590e88626ba275258410fb3b74d4e30c5ec
Author: Manuel Beck <[email protected]>
AuthorDate: Fri Aug 28 08:27:47 2026 +0200

    fix(statusbar): hide status bar correctly (#2000)
    
    - Hide the Android system status bar through the built-in API and allow it 
to be temporarily revealed by swipe. Respect the system status-bar visibility 
when calculating Cordova's faux status-bar inset, preserving compatibility with 
cordova-plugin-statusbar.
    - Fixes #592
    
    Generated-By: GPT-5.6 Terra
---
 framework/src/org/apache/cordova/CordovaActivity.java |  3 ++-
 framework/src/org/apache/cordova/SystemBarPlugin.java | 11 +++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/framework/src/org/apache/cordova/CordovaActivity.java 
b/framework/src/org/apache/cordova/CordovaActivity.java
index a8d4379e..496a606b 100755
--- a/framework/src/org/apache/cordova/CordovaActivity.java
+++ b/framework/src/org/apache/cordova/CordovaActivity.java
@@ -223,7 +223,8 @@ public class CordovaActivity extends AppCompatActivity {
                     WindowInsetsCompat.Type.systemBars() | 
WindowInsetsCompat.Type.displayCutout()
             );
 
-            boolean isStatusBarVisible = statusBarView.getVisibility() != 
View.GONE;
+            boolean isStatusBarVisible = statusBarView.getVisibility() != 
View.GONE
+                    && insets.isVisible(WindowInsetsCompat.Type.statusBars());
             int top = isStatusBarVisible && !canEdgeToEdge && !isFullScreen ? 
bars.top : 0;
             int left = !canEdgeToEdge && !isFullScreen ? bars.left : 0;
             int right = !canEdgeToEdge && !isFullScreen ? bars.right : 0;
diff --git a/framework/src/org/apache/cordova/SystemBarPlugin.java 
b/framework/src/org/apache/cordova/SystemBarPlugin.java
index ebcc87da..00b0f483 100644
--- a/framework/src/org/apache/cordova/SystemBarPlugin.java
+++ b/framework/src/org/apache/cordova/SystemBarPlugin.java
@@ -34,6 +34,7 @@ import android.widget.FrameLayout;
 import androidx.core.content.ContextCompat;
 import androidx.core.view.ViewCompat;
 import androidx.core.view.WindowCompat;
+import androidx.core.view.WindowInsetsCompat;
 import androidx.core.view.WindowInsetsControllerCompat;
 
 import org.json.JSONArray;
@@ -101,6 +102,16 @@ public class SystemBarPlugin extends CordovaPlugin {
      * @param visible should the status bar be visible?
      */
     private void setStatusBarVisible(final boolean visible) {
+        Window window = cordova.getActivity().getWindow();
+        WindowInsetsControllerCompat controller = 
WindowCompat.getInsetsController(window, window.getDecorView());
+        if (visible) {
+            controller.show(WindowInsetsCompat.Type.statusBars());
+        } else {
+            // Reveal the hidden bar temporarily as an overlay when swiped 
from the top.
+            
controller.setSystemBarsBehavior(WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
+            controller.hide(WindowInsetsCompat.Type.statusBars());
+        }
+
         View statusBar = getStatusBarView(webView);
         if (statusBar != null) {
             statusBar.setVisibility(visible ? View.VISIBLE : View.GONE);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to