3939public class StatusBar extends CordovaPlugin {
4040 private static final String TAG = "StatusBar" ;
4141
42+ private boolean transparent = false ;
43+
4244 /**
4345 * Sets the context of the Command. This can then be used to do things like
4446 * get file paths associated with the Activity.
@@ -62,6 +64,9 @@ public void run() {
6264 // Read 'StatusBarBackgroundColor' from config.xml, default is #000000.
6365 setStatusBarBackgroundColor (preferences .getString ("StatusBarBackgroundColor" , "#000000" ));
6466
67+ // Read 'StatusBarOverlaysWebView' from config.xml, default is false.
68+ setStatusBarTransparent (preferences .getBoolean ("StatusBarOverlaysWebView" , false ));
69+
6570 // Read 'StatusBarStyle' from config.xml, default is 'lightcontent'.
6671 setStatusBarStyle (preferences .getString ("StatusBarStyle" , "lightcontent" ));
6772 }
@@ -96,7 +101,11 @@ public void run() {
96101 // use KitKat here to be aligned with "Fullscreen" preference
97102 if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .KITKAT ) {
98103 int uiOptions = window .getDecorView ().getSystemUiVisibility ();
99- uiOptions &= ~View .SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN ;
104+ if (transparent ) {
105+ uiOptions |= View .SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN ;
106+ } else {
107+ uiOptions &= ~View .SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN ;
108+ }
100109 uiOptions &= ~View .SYSTEM_UI_FLAG_FULLSCREEN ;
101110
102111 window .getDecorView ().setSystemUiVisibility (uiOptions );
@@ -227,20 +236,22 @@ private void setStatusBarBackgroundColor(final String colorPref) {
227236 }
228237
229238 private void setStatusBarTransparent (final boolean transparent ) {
230- if ( Build . VERSION . SDK_INT >= 21 ) {
239+ this . transparent = transparent ;
231240 final Window window = cordova .getActivity ().getWindow ();
232241 if (transparent ) {
233242 window .getDecorView ().setSystemUiVisibility (
234243 View .SYSTEM_UI_FLAG_LAYOUT_STABLE
235244 | View .SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN );
236- window .setStatusBarColor (Color .TRANSPARENT );
245+
246+ if (Build .VERSION .SDK_INT >= 21 ) {
247+ window .setStatusBarColor (Color .TRANSPARENT );
248+ }
237249 }
238250 else {
239251 window .getDecorView ().setSystemUiVisibility (
240252 View .SYSTEM_UI_FLAG_LAYOUT_STABLE
241253 | View .SYSTEM_UI_FLAG_VISIBLE );
242254 }
243- }
244255 }
245256
246257 private void setStatusBarStyle (final String style ) {
0 commit comments