BREAKING CHANGE!: (android) Read config.xml for statusbar overlay preference (#171)

* (android) Read config.xml for statusbar overlay preference

* Added information on the ability to use #AARRGGBB hex string format if StatusBarOverlaysWebView is true

* Added `<preference name="StatusBarOverlaysWebView" value="true" />` to the default android block for consistentency for iOS.
This commit is contained in:
Norman Breau 2020-04-11 21:12:47 -03:00 committed by GitHub
parent 7f48d65100
commit 5332e3b667
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 1 deletions

View File

@ -53,7 +53,7 @@ Preferences
Only supported on Android 5 or later. Earlier versions will ignore this preference. Only supported on Android 5 or later. Earlier versions will ignore this preference.
- __StatusBarBackgroundColor__ (color hex string, no default value). Set the background color of the statusbar by a hex string (#RRGGBB) at startup. If this value is not set, the background color will be transparent. - __StatusBarBackgroundColor__ (color hex string, no default value). Set the background color of the statusbar by a hex string (#RRGGBB) at startup. If this value is not set, the background color will be transparent. If `StatusBarOverlaysWebView` is set to true, then a 8 digit hex (#AARRGGBB) string can optionally be used to define the transparency.
<preference name="StatusBarBackgroundColor" value="#000000" /> <preference name="StatusBarBackgroundColor" value="#000000" />

View File

@ -43,6 +43,7 @@
<param name="android-package" value="org.apache.cordova.statusbar.StatusBar" /> <param name="android-package" value="org.apache.cordova.statusbar.StatusBar" />
<param name="onload" value="true" /> <param name="onload" value="true" />
</feature> </feature>
<preference name="StatusBarOverlaysWebView" value="true" />
</config-file> </config-file>
</platform> </platform>

View File

@ -59,6 +59,9 @@ public class StatusBar extends CordovaPlugin {
Window window = cordova.getActivity().getWindow(); Window window = cordova.getActivity().getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
// Read 'StatusBarOverlaysWebView' from config.xml, default is true.
setStatusBarTransparent(preferences.getBoolean("StatusBarOverlaysWebView", true));
// Read 'StatusBarBackgroundColor' from config.xml, default is #000000. // Read 'StatusBarBackgroundColor' from config.xml, default is #000000.
setStatusBarBackgroundColor(preferences.getString("StatusBarBackgroundColor", "#000000")); setStatusBarBackgroundColor(preferences.getString("StatusBarBackgroundColor", "#000000"));