From e39691fa1773b3f7f72d2b833947691f49611b67 Mon Sep 17 00:00:00 2001 From: Raunak Raj <71929976+bajrangCoder@users.noreply.github.com> Date: Tue, 31 Mar 2026 20:47:42 +0530 Subject: [PATCH 1/2] fix(android): sync status and navigation bars with app theme --- .../android/com/foxdebug/system/System.java | 47 ++++++++++++++++--- 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/src/plugins/system/android/com/foxdebug/system/System.java b/src/plugins/system/android/com/foxdebug/system/System.java index 55fb27062..d166e4166 100644 --- a/src/plugins/system/android/com/foxdebug/system/System.java +++ b/src/plugins/system/android/com/foxdebug/system/System.java @@ -1710,17 +1710,50 @@ private void setUiTheme( try { this.systemBarColor = Color.parseColor(systemBarColor); this.theme = new Theme(scheme); - - preferences.set("BackgroundColor", this.systemBarColor); + preferences.set("BackgroundColor", this.systemBarColor); webView.getPluginManager().postMessage("updateSystemBars", null); + applySystemBarTheme(); callback.success(); } catch (IllegalArgumentException e) { callback.error("Invalid color: " + systemBarColor); + } catch (Exception e) { + callback.error(e.toString()); } } + private void applySystemBarTheme() { + final Window window = activity.getWindow(); + final View decorView = window.getDecorView(); + + // Keep Cordova's BackgroundColor flow for API 36+, but also apply the + // window colors directly so OEM variants do not leave stale system-bar + // colors behind after a theme switch. + window.clearFlags(0x04000000); // FLAG_TRANSLUCENT_STATUS + window.addFlags(0x80000000); // FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + window.setNavigationBarContrastEnforced(false); + window.setStatusBarContrastEnforced(false); + } + + decorView.setBackgroundColor(this.systemBarColor); + + View rootView = activity.findViewById(android.R.id.content); + if (rootView != null) { + rootView.setBackgroundColor(this.systemBarColor); + } + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + window.setStatusBarColor(this.systemBarColor); + window.setNavigationBarColor(this.systemBarColor); + } + + setStatusBarStyle(window); + setNavigationBarStyle(window); + } + private void setStatusBarStyle(final Window window) { String themeType = theme.getType(); View decorView = window.getDecorView(); @@ -1754,22 +1787,22 @@ private void setNavigationBarStyle(final Window window) { String themeType = theme.getType(); View decorView = window.getDecorView(); int uiOptions; + int lightNavigationBar; if (SDK_INT <= 30) { uiOptions = getDeprecatedSystemUiVisibility(decorView); - // 0x80000000 FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS - // 0x00000010 SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR + lightNavigationBar = View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; if (themeType.equals("light")) { - setDeprecatedSystemUiVisibility(decorView, uiOptions | 0x80000000 | 0x00000010); + setDeprecatedSystemUiVisibility(decorView, uiOptions | lightNavigationBar); return; } - setDeprecatedSystemUiVisibility(decorView, uiOptions | (0x80000000 & ~0x00000010)); + setDeprecatedSystemUiVisibility(decorView, uiOptions & ~lightNavigationBar); return; } uiOptions = Objects.requireNonNull(decorView.getWindowInsetsController()).getSystemBarsAppearance(); - int lightNavigationBar = WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS; + lightNavigationBar = WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS; if (themeType.equals("light")) { decorView.getWindowInsetsController().setSystemBarsAppearance(uiOptions | lightNavigationBar, lightNavigationBar); From 8d348dbc986e6cae7e586d52b5dc876df21be8d0 Mon Sep 17 00:00:00 2001 From: Raunak Raj <71929976+bajrangCoder@users.noreply.github.com> Date: Wed, 1 Apr 2026 08:04:41 +0530 Subject: [PATCH 2/2] Update src/plugins/system/android/com/foxdebug/system/System.java Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- src/plugins/system/android/com/foxdebug/system/System.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/system/android/com/foxdebug/system/System.java b/src/plugins/system/android/com/foxdebug/system/System.java index d166e4166..492dee90a 100644 --- a/src/plugins/system/android/com/foxdebug/system/System.java +++ b/src/plugins/system/android/com/foxdebug/system/System.java @@ -1730,7 +1730,7 @@ private void applySystemBarTheme() { // Keep Cordova's BackgroundColor flow for API 36+, but also apply the // window colors directly so OEM variants do not leave stale system-bar // colors behind after a theme switch. - window.clearFlags(0x04000000); // FLAG_TRANSLUCENT_STATUS + window.clearFlags(0x04000000 | 0x08000000); // FLAG_TRANSLUCENT_STATUS | FLAG_TRANSLUCENT_NAVIGATION window.addFlags(0x80000000); // FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {