fix(android): sync status and navigation bars with app theme#2002
Conversation
Greptile SummaryThis PR correctly fixes Android system bar (status bar and navigation bar) theming so that bar colors and icon tints follow the app theme after a theme switch, including on OEM devices that leave stale colors behind. Key changes:
Minor gap: Confidence Score: 4/5Safe to merge with a minor OEM edge-case gap; the core bug fix is correct and well-guarded. All findings are P2. The main bug fix (dark-theme navigation bar style on SDK ≤ 30) is correct. Threading is handled properly. The only gap is that FLAG_TRANSLUCENT_NAVIGATION is not cleared, which is a narrow OEM edge case and not a regression. Scoring 4 to nudge the author to consider the one-liner improvement before merge. Only System.java is changed; the applySystemBarTheme() method warrants a second look for the missing FLAG_TRANSLUCENT_NAVIGATION clear. Important Files Changed
Sequence DiagramsequenceDiagram
participant JS as JavaScript
participant Cordova as Cordova Plugin Manager
participant Plugin as System.java
participant UI as UI Thread
participant Window as Android Window
JS->>Cordova: set-ui-theme(color, scheme)
Cordova->>UI: runOnUiThread()
UI->>Plugin: setUiTheme(color, scheme)
Plugin->>Plugin: Color.parseColor(color)
Plugin->>Plugin: new Theme(scheme)
Plugin->>Cordova: preferences.set("BackgroundColor", color)
Plugin->>Cordova: postMessage("updateSystemBars")
Plugin->>Plugin: applySystemBarTheme()
Plugin->>Window: clearFlags(FLAG_TRANSLUCENT_STATUS)
Plugin->>Window: addFlags(FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
Plugin->>Window: setNavigationBarContrastEnforced(false) [API 29+]
Plugin->>Window: setStatusBarContrastEnforced(false) [API 29+]
Plugin->>Window: decorView.setBackgroundColor(color)
Plugin->>Window: rootView.setBackgroundColor(color)
Plugin->>Window: setStatusBarColor(color) [API 21+]
Plugin->>Window: setNavigationBarColor(color) [API 21+]
Plugin->>Plugin: setStatusBarStyle(window)
Plugin->>Plugin: setNavigationBarStyle(window)
Plugin->>JS: callback.success()
Reviews (1): Last reviewed commit: "fix(android): sync status and navigation..." | Re-trigger Greptile |
This comment has been minimized.
This comment has been minimized.
|
Preview Release for this, has been built. |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
No description provided.