From 35a56abe8b9518e53eaaf3c0dff8923fffcfb178 Mon Sep 17 00:00:00 2001 From: Manuel Beck Date: Fri, 7 Aug 2026 14:18:49 +0200 Subject: [PATCH] fix(statusbar): restore `StatusBarOverlaysWebView` support in non-edge-to-edge mode - When using cordova-plugin-statusbar in cordova-android 14.0.1, the status bar overlays the web view by default and a translucent color can be set. Also the setting can be controlled by the preference `StatusBarOverlaysWebView` in `config.xml`. This was restored for cordova-android 15 --- framework/src/org/apache/cordova/CordovaActivity.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java index a8d4379e..203021aa 100755 --- a/framework/src/org/apache/cordova/CordovaActivity.java +++ b/framework/src/org/apache/cordova/CordovaActivity.java @@ -107,6 +107,7 @@ public class CordovaActivity extends AppCompatActivity { private boolean canEdgeToEdge = false; private boolean isFullScreen = false; + private boolean statusBarOverlaysWebView = false; /** * Called when the activity is first created. @@ -122,6 +123,7 @@ public class CordovaActivity extends AppCompatActivity { loadConfig(); canEdgeToEdge = preferences.getBoolean("AndroidEdgeToEdge", false); + statusBarOverlaysWebView = preferences.getBoolean("StatusBarOverlaysWebView", true); String logLevel = preferences.getString("loglevel", "ERROR"); LOG.setLogLevel(logLevel); @@ -224,7 +226,8 @@ public class CordovaActivity extends AppCompatActivity { ); boolean isStatusBarVisible = statusBarView.getVisibility() != View.GONE; - int top = isStatusBarVisible && !canEdgeToEdge && !isFullScreen ? bars.top : 0; + int statusBarHeight = isStatusBarVisible && !canEdgeToEdge && !isFullScreen ? bars.top : 0; + int top = statusBarOverlaysWebView ? 0 : statusBarHeight; int left = !canEdgeToEdge && !isFullScreen ? bars.left : 0; int right = !canEdgeToEdge && !isFullScreen ? bars.right : 0; @@ -244,7 +247,7 @@ public class CordovaActivity extends AppCompatActivity { FrameLayout.LayoutParams statusBarParams = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, - top, + statusBarHeight, Gravity.TOP ); statusBarView.setLayoutParams(statusBarParams);