Skip to content

Commit 3d1f8d1

Browse files
authored
fix(system-bars): use separate current styles (#8409)
1 parent acb64ab commit 3d1f8d1

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

android/capacitor/src/main/java/com/getcapacitor/plugin/SystemBars.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ function capacitorSystemBarsCheckMetaViewport() {
5656
private boolean insetHandlingEnabled = true;
5757
private boolean hasViewportCover = false;
5858

59-
private String currentStyle = STYLE_DEFAULT;
59+
private String currentStatusBarStyle = STYLE_DEFAULT;
60+
private String currentGestureBarStyle = STYLE_DEFAULT;
6061

6162
@Override
6263
public void load() {
@@ -85,7 +86,8 @@ public void onPageCommitVisible(WebView view, String url) {
8586
protected void handleOnConfigurationChanged(Configuration newConfig) {
8687
super.handleOnConfigurationChanged(newConfig);
8788

88-
setStyle(currentStyle, "");
89+
setStyle(currentGestureBarStyle, BAR_GESTURE_BAR);
90+
setStyle(currentStatusBarStyle, BAR_STATUS_BAR);
8991
}
9092

9193
private void initSystemBars() {
@@ -259,19 +261,19 @@ private void injectSafeAreaCSS(int top, int right, int bottom, int left) {
259261
}
260262

261263
private void setStyle(String style, String bar) {
262-
currentStyle = style;
263-
264264
if (style.equals(STYLE_DEFAULT)) {
265265
style = getStyleForTheme();
266266
}
267267

268268
Window window = getActivity().getWindow();
269269
WindowInsetsControllerCompat windowInsetsControllerCompat = WindowCompat.getInsetsController(window, window.getDecorView());
270270
if (bar.isEmpty() || bar.equals(BAR_STATUS_BAR)) {
271+
currentStatusBarStyle = style;
271272
windowInsetsControllerCompat.setAppearanceLightStatusBars(!style.equals(STYLE_DARK));
272273
}
273274

274275
if (bar.isEmpty() || bar.equals(BAR_GESTURE_BAR)) {
276+
currentGestureBarStyle = style;
275277
windowInsetsControllerCompat.setAppearanceLightNavigationBars(!style.equals(STYLE_DARK));
276278
}
277279

0 commit comments

Comments
 (0)