Compare commits
65 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad5f7d912c | ||
|
|
dbc7b29680 | ||
|
|
1d1ac928a8 | ||
|
|
554e65e60f | ||
|
|
f2c49454da | ||
|
|
aca5eceaf9 | ||
|
|
86cfafeaf9 | ||
|
|
8159e1b307 | ||
|
|
f8873fd481 | ||
|
|
cfce729912 | ||
|
|
c34e3a02c2 | ||
|
|
16c653747e | ||
|
|
b448166624 | ||
|
|
fc56eb211f | ||
|
|
259cdb65ef | ||
|
|
c3705fe46e | ||
|
|
ef7266874a | ||
|
|
16ff9b449f | ||
|
|
244eb717fd | ||
|
|
15043c1db2 | ||
|
|
1011b2a162 | ||
|
|
f1aa062557 | ||
|
|
7ca3552224 | ||
|
|
bf7869cec7 | ||
|
|
8a3f9edb9d | ||
|
|
47f245462d | ||
|
|
241577c3c8 | ||
|
|
573176e3a7 | ||
|
|
a464526477 | ||
|
|
97f87d36c1 | ||
|
|
e6e8c5be10 | ||
|
|
a4a1065c4f | ||
|
|
d853f828d6 | ||
|
|
3e9ce84a56 | ||
|
|
999ad4f6c2 | ||
|
|
7c27000b3a | ||
|
|
a63282219c | ||
|
|
265fde25a0 | ||
|
|
dc945bdc95 | ||
|
|
60686a944a | ||
|
|
cf1092fe81 | ||
|
|
86b9edba5d | ||
|
|
3795486e33 | ||
|
|
fbfaeaa7ab | ||
|
|
7fa66c0b61 | ||
|
|
1923d4e91e | ||
|
|
baefe6d109 | ||
|
|
1b3fbf3f9a | ||
|
|
986516cf97 | ||
|
|
145fad6764 | ||
|
|
b0b61af61a | ||
|
|
da924e16fe | ||
|
|
a0e5b517e0 | ||
|
|
c4dcdacf6b | ||
|
|
1dfc83d57d | ||
|
|
3e821abfc2 | ||
|
|
07b55b7529 | ||
|
|
2e8164693e | ||
|
|
d07ecff31a | ||
|
|
3f5f727629 | ||
|
|
5ac69e4962 | ||
|
|
e2cea32ab4 | ||
|
|
77ce75d4dd | ||
|
|
e8c448100c | ||
|
|
607e5d66ad |
23
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
23
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<!--
|
||||
Please make sure the checklist boxes are all checked before submitting the PR. The checklist
|
||||
is intended as a quick reference, for complete details please see our Contributor Guidelines:
|
||||
|
||||
http://cordova.apache.org/contribute/contribute_guidelines.html
|
||||
|
||||
Thanks!
|
||||
-->
|
||||
|
||||
### Platforms affected
|
||||
|
||||
|
||||
### What does this PR do?
|
||||
|
||||
|
||||
### What testing has been done on this change?
|
||||
|
||||
|
||||
### Checklist
|
||||
- [ ] [ICLA](http://www.apache.org/licenses/icla.txt) has been signed and submitted to secretary@apache.org.
|
||||
- [ ] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database
|
||||
- [ ] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
|
||||
- [ ] Added automated test coverage as appropriate for this change.
|
||||
24
.gitignore
vendored
Normal file
24
.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
#If ignorance is bliss, then somebody knock the smile off my face
|
||||
|
||||
*.csproj.user
|
||||
*.suo
|
||||
*.cache
|
||||
Thumbs.db
|
||||
*.DS_Store
|
||||
|
||||
*.bak
|
||||
*.cache
|
||||
*.log
|
||||
*.swp
|
||||
*.user
|
||||
|
||||
node_modules
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
16
.jshintrc
Normal file
16
.jshintrc
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"browser": true
|
||||
, "devel": true
|
||||
, "bitwise": true
|
||||
, "undef": true
|
||||
, "trailing": true
|
||||
, "quotmark": false
|
||||
, "indent": 4
|
||||
, "unused": "vars"
|
||||
, "latedef": "nofunc"
|
||||
, "globals": {
|
||||
"module": false,
|
||||
"exports": false,
|
||||
"require": false
|
||||
}
|
||||
}
|
||||
15
.travis.yml
15
.travis.yml
@@ -1,13 +1,4 @@
|
||||
language: objective-c
|
||||
git:
|
||||
depth: 2
|
||||
language: node_js
|
||||
sudo: false
|
||||
node_js:
|
||||
- "0.10"
|
||||
install:
|
||||
- echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
|
||||
- cd ..
|
||||
- npm install -g cordova-paramedic
|
||||
- npm install -g cordova
|
||||
- npm install -g ios-sim
|
||||
script:
|
||||
- cordova-paramedic --platform ios --plugin ${TRAVIS_BUILD_DIR}
|
||||
- "4.2"
|
||||
|
||||
@@ -27,7 +27,7 @@ There are multiple ways to contribute: report bugs, improve the docs, and
|
||||
contribute code.
|
||||
|
||||
For instructions on this, start with the
|
||||
[contribution overview](http://cordova.apache.org/#contribute).
|
||||
[contribution overview](http://cordova.apache.org/contribute/).
|
||||
|
||||
The details are explained there, but the important items are:
|
||||
- Sign and submit an Apache ICLA (Contributor License Agreement).
|
||||
|
||||
25
README.md
25
README.md
@@ -1,3 +1,7 @@
|
||||
---
|
||||
title: Statusbar
|
||||
description: Control the device status bar.
|
||||
---
|
||||
<!---
|
||||
# license: Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
@@ -17,19 +21,32 @@
|
||||
# under the License.
|
||||
-->
|
||||
|
||||
# cordova-plugin-statusbar
|
||||
|Android|iOS| Windows 8.1 Store | Windows 8.1 Phone | Windows 10 Store | Travis CI |
|
||||
|:-:|:-:|:-:|:-:|:-:|:-:|
|
||||
|[](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=android,PLUGIN=cordova-plugin-statusbar/)|[](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=ios,PLUGIN=cordova-plugin-statusbar/)|[](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=windows-8.1-store,PLUGIN=cordova-plugin-statusbar/)|[](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=windows-8.1-phone,PLUGIN=cordova-plugin-statusbar/)|[](http://cordova-ci.cloudapp.net:8080/job/cordova-periodic-build/PLATFORM=windows-10-store,PLUGIN=cordova-plugin-statusbar/)|[](https://travis-ci.org/apache/cordova-plugin-statusbar)|
|
||||
|
||||
[](https://travis-ci.org/apache/cordova-plugin-statusbar)
|
||||
# cordova-plugin-statusbar
|
||||
|
||||
StatusBar
|
||||
======
|
||||
|
||||
> The `StatusBar` object provides some functions to customize the iOS and Android StatusBar.
|
||||
|
||||
:warning: Report issues on the [Apache Cordova issue tracker](https://issues.apache.org/jira/issues/?jql=project%20%3D%20CB%20AND%20status%20in%20%28Open%2C%20%22In%20Progress%22%2C%20Reopened%29%20AND%20resolution%20%3D%20Unresolved%20AND%20component%20%3D%20%22Plugin%20Statusbar%22%20ORDER%20BY%20priority%20DESC%2C%20summary%20ASC%2C%20updatedDate%20DESC)
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
This installation method requires cordova 5.0+
|
||||
|
||||
cordova plugin add cordova-plugin-statusbar
|
||||
Older versions of cordova can still install via the __deprecated__ id
|
||||
|
||||
cordova plugin add org.apache.cordova.statusbar
|
||||
It is also possible to install via repo url directly ( unstable )
|
||||
|
||||
cordova plugin add https://github.com/apache/cordova-plugin-statusbar.git
|
||||
|
||||
|
||||
Preferences
|
||||
-----------
|
||||
@@ -40,7 +57,7 @@ Preferences
|
||||
|
||||
<preference name="StatusBarOverlaysWebView" value="true" />
|
||||
|
||||
- __StatusBarBackgroundColor__ (color hex string, defaults to #000000). On iOS 7 and Android 5, set the background color of the statusbar by a hex string (#RRGGBB) at startup.
|
||||
- __StatusBarBackgroundColor__ (color hex string, no default value). On iOS 7, 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.
|
||||
|
||||
<preference name="StatusBarBackgroundColor" value="#000000" />
|
||||
|
||||
@@ -293,5 +310,3 @@ Supported Platforms
|
||||
- Windows Phone 7
|
||||
- Windows Phone 8
|
||||
- Windows Phone 8.1
|
||||
|
||||
|
||||
|
||||
148
RELEASENOTES.md
148
RELEASENOTES.md
@@ -20,63 +20,113 @@
|
||||
-->
|
||||
# Release Notes
|
||||
|
||||
### 0.1.5 (Apr 17, 2014) (First release as a core Cordova Plugin)
|
||||
* CB-6316: Added README.md which point to the new location for docs
|
||||
* CB-6316: Added license header to the documentation. Added README.md which point to the new location for docs
|
||||
* CB-6316: Moved StatusBar plugin documentation to docs folder
|
||||
* CB-6314: [android] Add StatusBar.isVisible support to Android
|
||||
* CB-6460: Update license headers
|
||||
### 2.2.0 (Sep 08, 2016)
|
||||
* [CB-11795](https://issues.apache.org/jira/browse/CB-11795) Add 'protective' entry to cordovaDependencies
|
||||
* Handle extended status bar on **iOS**
|
||||
* Plugin uses `Android Log class` and not `Cordova LOG class`
|
||||
* [CB-11287](https://issues.apache.org/jira/browse/CB-11287) (**ios**) - fix webview resize after modal on **iPhones**
|
||||
* [CB-11485](https://issues.apache.org/jira/browse/CB-11485) fix resize on rotation with popover
|
||||
* Add badges for paramedic builds on Jenkins
|
||||
* [CB-11197](https://issues.apache.org/jira/browse/CB-11197) Keep status bar hidden when keyboard pops up
|
||||
* Add pull request template.
|
||||
* [CB-10866](https://issues.apache.org/jira/browse/CB-10866) Adding engine info to `package.json`
|
||||
* patched missing `_ready` method, and changed the way the proxy is installed
|
||||
* [CB-10996](https://issues.apache.org/jira/browse/CB-10996) Adding front matter to `README.md`
|
||||
|
||||
### 0.1.6 (Jun 05, 2014)
|
||||
* CB-6783 - added StatusBarStyle config preference, updated docs (closes #9)
|
||||
* CB-6812 Add license
|
||||
* CB-6491 add CONTRIBUTING.md
|
||||
* CB-6264 minor formatting issue
|
||||
* Update docs with recent WP changes, remove 'clear' from the loist of named colors in documentation
|
||||
* CB-6513 - Statusbar plugin for Android is not compiling
|
||||
### 2.1.3 (Apr 15, 2016)
|
||||
* [CB-11018](https://issues.apache.org/jira/browse/CB-11018) Fix statusbar with `inappbrowser` causing incorrect orientation on **iOS8**
|
||||
* [CB-10884](https://issues.apache.org/jira/browse/CB-10884) `Inappbrowser` breaks UI while Screen orientation changes from landscape to portrait on **iOS**
|
||||
|
||||
### 2.1.2 (Mar 09, 2016)
|
||||
* [CB-10752](https://issues.apache.org/jira/browse/CB-10752) for for status bar overlays the webview on **iOS** 6 in some cases
|
||||
* [CB-10683](https://issues.apache.org/jira/browse/CB-10683) Fix wrong StatusBar.isVisible initial value on **Windows**
|
||||
* [CB-10636](https://issues.apache.org/jira/browse/CB-10636) Add JSHint for plugins
|
||||
* [CB-10047](https://issues.apache.org/jira/browse/CB-10047) fix **iOS** 8 deprecated warnings
|
||||
|
||||
### 2.1.1 (Feb 09, 2016)
|
||||
* [CB-10102](https://issues.apache.org/jira/browse/CB-10102) The removeObserver code was wrong and it might crash on plugin deallocation
|
||||
|
||||
### 2.1.0 (Jan 15, 2016)
|
||||
* [CB-9513](https://issues.apache.org/jira/browse/CB-9513) Allow to show/hide status bar in fullscreen mode.
|
||||
* [CB-8720](https://issues.apache.org/jira/browse/CB-8720) Fix status bar position when app started upside down on **iOS 7**.
|
||||
* [CB-10118](https://issues.apache.org/jira/browse/CB-10118) Fixes plugin loading error for **Browser** platform
|
||||
|
||||
### 2.0.0 (Nov 18, 2015)
|
||||
* [CB-10035](https://issues.apache.org/jira/browse/CB-10035) Updated `RELEASENOTES` to be newest to oldest
|
||||
* Added `weakSelf` reference for block use
|
||||
* Fixes [CB-4712](https://issues.apache.org/jira/browse/CB-4712), [CB-5439](https://issues.apache.org/jira/browse/CB-5439) statusbar issues
|
||||
* Fixing contribute link.
|
||||
* [CB-7965](https://issues.apache.org/jira/browse/CB-7965) Add cordova-plugin-statusbar support for **Browser** platform
|
||||
* Don't use `IsAtLeastiOSVersion` macro to determine height
|
||||
* Use correct statusbar height for landscape orientation in iOS >= 8
|
||||
* remove travis-ci
|
||||
* [CB-9202](https://issues.apache.org/jira/browse/CB-9202) updated repo url to github mirror in package.json
|
||||
* Added verbose install text for users on < cordova 5.0
|
||||
* update docs for `StatusBarBackgroundColor`
|
||||
|
||||
### 1.0.1 (Jun 17, 2015)
|
||||
* add auto-tests for basic api
|
||||
* [CB-9180](https://issues.apache.org/jira/browse/CB-9180) Add correct supported check for Windows 8.1 desktop
|
||||
* [CB-9128](https://issues.apache.org/jira/browse/CB-9128) cordova-plugin-statusbar documentation translation: cordova-plugin-statusbar
|
||||
* fix npm md issue
|
||||
|
||||
### 1.0.0 (Apr 15, 2015)
|
||||
* [CB-8746](https://issues.apache.org/jira/browse/CB-8746) gave plugin major version bump
|
||||
* [CB-8683](https://issues.apache.org/jira/browse/CB-8683) changed plugin-id to pacakge-name
|
||||
* [CB-8653](https://issues.apache.org/jira/browse/CB-8653) properly updated translated docs to use new id
|
||||
* [CB-8653](https://issues.apache.org/jira/browse/CB-8653) updated translated docs to use new id
|
||||
* Use TRAVIS_BUILD_DIR, install paramedic by npm
|
||||
* [CB-8653](https://issues.apache.org/jira/browse/CB-8653) Updated Readme
|
||||
* - Use StatusBarBackgroundColor instead of AndroidStatusBarBackgroundColor, and added a quirk to the readme.
|
||||
* - Add support for StatusBar.backgroundColorByHexString (and StatusBar.backgroundColorByName) on Android 5 and up
|
||||
* Allow setting the statusbar backgroundcolor on Android
|
||||
* [CB-8575](https://issues.apache.org/jira/browse/CB-8575) Integrate TravisCI
|
||||
* [CB-8438](https://issues.apache.org/jira/browse/CB-8438) cordova-plugin-statusbar documentation translation: cordova-plugin-statusbar
|
||||
* [CB-8538](https://issues.apache.org/jira/browse/CB-8538) Added package.json file
|
||||
|
||||
### 0.1.10 (Feb 04, 2015)
|
||||
* [CB-8351](https://issues.apache.org/jira/browse/CB-8351) ios: Use argumentForIndex rather than NSArray extension
|
||||
|
||||
### 0.1.9 (Dec 02, 2014)
|
||||
* Fix onload attribute within <feature> to be a <param>
|
||||
* [CB-8010](https://issues.apache.org/jira/browse/CB-8010) - Statusbar colour does not change to orange
|
||||
* added checks for running on windows when StatusBar is NOT available
|
||||
* [CB-7986](https://issues.apache.org/jira/browse/CB-7986) Add cordova-plugin-statusbar support for **Windows Phone 8.1**
|
||||
* [CB-7977](https://issues.apache.org/jira/browse/CB-7977) Mention `deviceready` in plugin docs
|
||||
* [CB-7979](https://issues.apache.org/jira/browse/CB-7979) Each plugin doc should have a ## Installation section
|
||||
* Inserting leading space after # for consistency
|
||||
* [CB-7549](https://issues.apache.org/jira/browse/CB-7549) - (Re-fix) `StatusBar` **iOS 8** Landscape issue (closes #15)
|
||||
* [CB-7700](https://issues.apache.org/jira/browse/CB-7700) cordova-plugin-statusbar documentation translation: cordova-plugin-statusbar
|
||||
* [CB-7571](https://issues.apache.org/jira/browse/CB-7571) Bump version of nested plugin to match parent plugin
|
||||
|
||||
### 0.1.8 (Sep 17, 2014)
|
||||
* [CB-7549](https://issues.apache.org/jira/browse/CB-7549) [StatusBar][iOS 8] Landscape issue
|
||||
* [CB-7486](https://issues.apache.org/jira/browse/CB-7486) Remove StatusBarBackgroundColor intial preference (black background) so background will be initially transparent
|
||||
* Renamed test dir, added nested plugin.xml
|
||||
* added documentation for manual tests, moved background color test below overlay test
|
||||
* [CB-7195](https://issues.apache.org/jira/browse/CB-7195) ported statusbar tests to framework
|
||||
|
||||
### 0.1.7 (Aug 06, 2014)
|
||||
* Add LICENSE and NOTICE
|
||||
* Update statusbar.js
|
||||
* Update backgroundColorByHexString function
|
||||
* ios: Use a persistent callbackId instead of calling sendJs
|
||||
* CB-6626 ios: Add a JS event for tapping on statusbar
|
||||
* [CB-6626](https://issues.apache.org/jira/browse/CB-6626) ios: Add a JS event for tapping on statusbar
|
||||
* ios: Fix hide to adjust webview's frame only when status bar is not overlaying webview
|
||||
* CB-6127 Updated translations for docs
|
||||
* [CB-6127](https://issues.apache.org/jira/browse/CB-6127) Updated translations for docs
|
||||
* android: Fix StatusBar.initialize() not running on UI thread
|
||||
|
||||
### 0.1.8 (Sep 17, 2014)
|
||||
* CB-7549 [StatusBar][iOS 8] Landscape issue
|
||||
* CB-7486 Remove StatusBarBackgroundColor intial preference (black background) so background will be initially transparent
|
||||
* Renamed test dir, added nested plugin.xml
|
||||
* added documentation for manual tests, moved background color test below overlay test
|
||||
* CB-7195 ported statusbar tests to framework
|
||||
### 0.1.6 (Jun 05, 2014)
|
||||
* [CB-6783](https://issues.apache.org/jira/browse/CB-6783) - added StatusBarStyle config preference, updated docs (closes #9)
|
||||
* [CB-6812](https://issues.apache.org/jira/browse/CB-6812) Add license
|
||||
* [CB-6491](https://issues.apache.org/jira/browse/CB-6491) add CONTRIBUTING.md
|
||||
* [CB-6264](https://issues.apache.org/jira/browse/CB-6264) minor formatting issue
|
||||
* Update docs with recent WP changes, remove 'clear' from the loist of named colors in documentation
|
||||
* [CB-6513](https://issues.apache.org/jira/browse/CB-6513) - Statusbar plugin for Android is not compiling
|
||||
|
||||
### 0.1.9 (Dec 02, 2014)
|
||||
* Fix onload attribute within <feature> to be a <param>
|
||||
* CB-8010 - Statusbar colour does not change to orange
|
||||
* added checks for running on windows when StatusBar is NOT available
|
||||
* CB-7986 Add cordova-plugin-statusbar support for **Windows Phone 8.1**
|
||||
* CB-7977 Mention `deviceready` in plugin docs
|
||||
* CB-7979 Each plugin doc should have a ## Installation section
|
||||
* Inserting leading space after # for consistency
|
||||
* CB-7549 - (Re-fix) `StatusBar` **iOS 8** Landscape issue (closes #15)
|
||||
* CB-7700 cordova-plugin-statusbar documentation translation: cordova-plugin-statusbar
|
||||
* CB-7571 Bump version of nested plugin to match parent plugin
|
||||
|
||||
### 0.1.10 (Feb 04, 2015)
|
||||
* CB-8351 ios: Use argumentForIndex rather than NSArray extension
|
||||
|
||||
### 1.0.0 (Apr 15, 2015)
|
||||
* CB-8746 gave plugin major version bump
|
||||
* CB-8683 changed plugin-id to pacakge-name
|
||||
* CB-8653 properly updated translated docs to use new id
|
||||
* CB-8653 updated translated docs to use new id
|
||||
* Use TRAVIS_BUILD_DIR, install paramedic by npm
|
||||
* CB-8653 Updated Readme
|
||||
* - Use StatusBarBackgroundColor instead of AndroidStatusBarBackgroundColor, and added a quirk to the readme.
|
||||
* - Add support for StatusBar.backgroundColorByHexString (and StatusBar.backgroundColorByName) on Android 5 and up
|
||||
* Allow setting the statusbar backgroundcolor on Android
|
||||
* CB-8575 Integrate TravisCI
|
||||
* CB-8438 cordova-plugin-statusbar documentation translation: cordova-plugin-statusbar
|
||||
* CB-8538 Added package.json file
|
||||
### 0.1.5 (Apr 17, 2014) (First release as a core Cordova Plugin)
|
||||
* [CB-6316](https://issues.apache.org/jira/browse/CB-6316): Added README.md which point to the new location for docs
|
||||
* [CB-6316](https://issues.apache.org/jira/browse/CB-6316): Added license header to the documentation. Added README.md which point to the new location for docs
|
||||
* [CB-6316](https://issues.apache.org/jira/browse/CB-6316): Moved StatusBar plugin documentation to docs folder
|
||||
* [CB-6314](https://issues.apache.org/jira/browse/CB-6314): [android] Add StatusBar.isVisible support to Android
|
||||
* [CB-6460](https://issues.apache.org/jira/browse/CB-6460): Update license headers
|
||||
|
||||
27
package.json
27
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cordova-plugin-statusbar",
|
||||
"version": "1.0.1-dev",
|
||||
"version": "2.2.0",
|
||||
"description": "Cordova StatusBar Plugin",
|
||||
"cordova": {
|
||||
"id": "cordova-plugin-statusbar",
|
||||
@@ -14,7 +14,7 @@
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar.git"
|
||||
"url": "https://github.com/apache/cordova-plugin-statusbar"
|
||||
},
|
||||
"keywords": [
|
||||
"cordova",
|
||||
@@ -26,12 +26,23 @@
|
||||
"cordova-wp8",
|
||||
"cordova-windows"
|
||||
],
|
||||
"engines": [
|
||||
{
|
||||
"name": "cordova",
|
||||
"version": ">=3.0.0"
|
||||
"scripts": {
|
||||
"test": "npm run jshint",
|
||||
"jshint": "node node_modules/jshint/bin/jshint www && node node_modules/jshint/bin/jshint src && node node_modules/jshint/bin/jshint tests"
|
||||
},
|
||||
"engines": {
|
||||
"cordovaDependencies": {
|
||||
"0.1.0": {
|
||||
"cordova": ">=3.0.0"
|
||||
},
|
||||
"3.0.0": {
|
||||
"cordova": ">100"
|
||||
}
|
||||
}
|
||||
],
|
||||
},
|
||||
"author": "Apache Software Foundation",
|
||||
"license": "Apache 2.0"
|
||||
"license": "Apache-2.0",
|
||||
"devDependencies": {
|
||||
"jshint": "^2.6.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
xmlns:rim="http://www.blackberry.com/ns/widgets"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
id="cordova-plugin-statusbar"
|
||||
version="1.0.1-dev">
|
||||
version="2.2.0">
|
||||
<name>StatusBar</name>
|
||||
<description>Cordova StatusBar Plugin</description>
|
||||
<license>Apache 2.0</license>
|
||||
@@ -47,6 +47,12 @@
|
||||
</config-file>
|
||||
</platform>
|
||||
|
||||
<platform name="browser">
|
||||
<js-module src="src/browser/StatusBarProxy.js" name="StatusBarProxy">
|
||||
<runs />
|
||||
</js-module>
|
||||
</platform>
|
||||
|
||||
<!-- ios -->
|
||||
<platform name="ios">
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ package org.apache.cordova.statusbar;
|
||||
import android.app.Activity;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.apache.cordova.CordovaArgs;
|
||||
import org.apache.cordova.CordovaInterface;
|
||||
import org.apache.cordova.CordovaPlugin;
|
||||
import org.apache.cordova.CordovaWebView;
|
||||
import org.apache.cordova.LOG;
|
||||
import org.apache.cordova.PluginResult;
|
||||
import org.json.JSONException;
|
||||
|
||||
@@ -46,7 +47,7 @@ public class StatusBar extends CordovaPlugin {
|
||||
*/
|
||||
@Override
|
||||
public void initialize(final CordovaInterface cordova, CordovaWebView webView) {
|
||||
Log.v(TAG, "StatusBar: initialization");
|
||||
LOG.v(TAG, "StatusBar: initialization");
|
||||
super.initialize(cordova, webView);
|
||||
|
||||
this.cordova.getActivity().runOnUiThread(new Runnable() {
|
||||
@@ -73,18 +74,32 @@ public class StatusBar extends CordovaPlugin {
|
||||
*/
|
||||
@Override
|
||||
public boolean execute(final String action, final CordovaArgs args, final CallbackContext callbackContext) throws JSONException {
|
||||
Log.v(TAG, "Executing action: " + action);
|
||||
LOG.v(TAG, "Executing action: " + action);
|
||||
final Activity activity = this.cordova.getActivity();
|
||||
final Window window = activity.getWindow();
|
||||
|
||||
if ("_ready".equals(action)) {
|
||||
boolean statusBarVisible = (window.getAttributes().flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) == 0;
|
||||
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, statusBarVisible));
|
||||
return true;
|
||||
}
|
||||
|
||||
if ("show".equals(action)) {
|
||||
this.cordova.getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// SYSTEM_UI_FLAG_FULLSCREEN is available since JellyBean, but we
|
||||
// use KitKat here to be aligned with "Fullscreen" preference
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
int uiOptions = window.getDecorView().getSystemUiVisibility();
|
||||
uiOptions &= ~View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
|
||||
uiOptions &= ~View.SYSTEM_UI_FLAG_FULLSCREEN;
|
||||
|
||||
window.getDecorView().setSystemUiVisibility(uiOptions);
|
||||
}
|
||||
|
||||
// CB-11197 We still need to update LayoutParams to force status bar
|
||||
// to be hidden when entering e.g. text fields
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
}
|
||||
});
|
||||
@@ -95,6 +110,18 @@ public class StatusBar extends CordovaPlugin {
|
||||
this.cordova.getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// SYSTEM_UI_FLAG_FULLSCREEN is available since JellyBean, but we
|
||||
// use KitKat here to be aligned with "Fullscreen" preference
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
int uiOptions = window.getDecorView().getSystemUiVisibility()
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_FULLSCREEN;
|
||||
|
||||
window.getDecorView().setSystemUiVisibility(uiOptions);
|
||||
}
|
||||
|
||||
// CB-11197 We still need to update LayoutParams to force status bar
|
||||
// to be hidden when entering e.g. text fields
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
}
|
||||
});
|
||||
@@ -108,7 +135,7 @@ public class StatusBar extends CordovaPlugin {
|
||||
try {
|
||||
setStatusBarBackgroundColor(args.getString(0));
|
||||
} catch (JSONException ignore) {
|
||||
Log.e(TAG, "Invalid hexString argument, use f.i. '#777777'");
|
||||
LOG.e(TAG, "Invalid hexString argument, use f.i. '#777777'");
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -129,10 +156,10 @@ public class StatusBar extends CordovaPlugin {
|
||||
// Using reflection makes sure any 5.0+ device will work without having to compile with SDK level 21
|
||||
window.getClass().getDeclaredMethod("setStatusBarColor", int.class).invoke(window, Color.parseColor(colorPref));
|
||||
} catch (IllegalArgumentException ignore) {
|
||||
Log.e(TAG, "Invalid hexString argument, use f.i. '#999999'");
|
||||
LOG.e(TAG, "Invalid hexString argument, use f.i. '#999999'");
|
||||
} catch (Exception ignore) {
|
||||
// this should not happen, only in case Android removes this method in a version > 21
|
||||
Log.w(TAG, "Method window.setStatusBarColor not found for SDK level " + Build.VERSION.SDK_INT);
|
||||
LOG.w(TAG, "Method window.setStatusBarColor not found for SDK level " + Build.VERSION.SDK_INT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
48
src/browser/StatusBarProxy.js
Normal file
48
src/browser/StatusBarProxy.js
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
function notSupported(win,fail) {
|
||||
//
|
||||
console.log('StatusBar is not supported');
|
||||
setTimeout(function(){
|
||||
win();
|
||||
// note that while it is not explicitly supported, it does not fail
|
||||
// this is really just here to allow developers to test their code in the browser
|
||||
// and if we fail, then their app might as well. -jm
|
||||
},0);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isVisible: false,
|
||||
styleBlackTranslucent:notSupported,
|
||||
styleDefault:notSupported,
|
||||
styleLightContent:notSupported,
|
||||
styleBlackOpaque:notSupported,
|
||||
overlaysWebView:notSupported,
|
||||
styleLightContect: notSupported,
|
||||
backgroundColorByName: notSupported,
|
||||
backgroundColorByHexString: notSupported,
|
||||
hide: notSupported,
|
||||
show: notSupported,
|
||||
_ready:notSupported
|
||||
};
|
||||
|
||||
require("cordova/exec/proxy").add("StatusBar", module.exports);
|
||||
|
||||
@@ -90,6 +90,15 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)statusBarDidChangeFrame:(NSNotification*)notification
|
||||
{
|
||||
//add a small delay for iOS 7 ( 0.1 seconds )
|
||||
__weak CDVStatusBar* weakSelf = self;
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
||||
[weakSelf resizeWebView];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)pluginInitialize
|
||||
{
|
||||
BOOL isiOS7 = (IsAtLeastiOSVersion(@"7.0"));
|
||||
@@ -101,6 +110,8 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
||||
// observe the statusBarHidden property
|
||||
[[UIApplication sharedApplication] addObserver:self forKeyPath:@"statusBarHidden" options:NSKeyValueObservingOptionNew context:NULL];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarDidChangeFrame:) name: UIApplicationDidChangeStatusBarFrameNotification object:nil];
|
||||
|
||||
_statusBarOverlaysWebView = YES; // default
|
||||
|
||||
[self initializeStatusBarBackgroundView];
|
||||
@@ -109,11 +120,6 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
||||
|
||||
NSString* setting;
|
||||
|
||||
setting = @"StatusBarOverlaysWebView";
|
||||
if ([self settingForKey:setting]) {
|
||||
self.statusBarOverlaysWebView = [(NSNumber*)[self settingForKey:setting] boolValue];
|
||||
}
|
||||
|
||||
setting = @"StatusBarBackgroundColor";
|
||||
if ([self settingForKey:setting]) {
|
||||
[self _backgroundColorByHexString:[self settingForKey:setting]];
|
||||
@@ -158,17 +164,33 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
||||
[self.commandDelegate sendPluginResult:result callbackId:_eventsCallbackId];
|
||||
}
|
||||
|
||||
|
||||
- (void) _ready:(CDVInvokedUrlCommand*)command
|
||||
{
|
||||
_eventsCallbackId = command.callbackId;
|
||||
[self updateIsVisible:![UIApplication sharedApplication].statusBarHidden];
|
||||
NSString* setting = @"StatusBarOverlaysWebView";
|
||||
if ([self settingForKey:setting]) {
|
||||
self.statusBarOverlaysWebView = [(NSNumber*)[self settingForKey:setting] boolValue];
|
||||
if (self.statusBarOverlaysWebView) {
|
||||
[self resizeWebView];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) initializeStatusBarBackgroundView
|
||||
{
|
||||
CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
|
||||
statusBarFrame = [self invertFrameIfNeeded:statusBarFrame orientation:self.viewController.interfaceOrientation];
|
||||
|
||||
if ([[UIApplication sharedApplication]statusBarOrientation] == UIInterfaceOrientationPortraitUpsideDown &&
|
||||
statusBarFrame.size.height + statusBarFrame.origin.y == [[UIScreen mainScreen] bounds].size.height) {
|
||||
|
||||
// When started in upside-down orientation on iOS 7, status bar will be bound to lower edge of the
|
||||
// screen (statusBarFrame.origin.y will be somewhere around screen height). In this case we need to
|
||||
// correct frame's coordinates
|
||||
statusBarFrame.origin.y = 0;
|
||||
}
|
||||
|
||||
statusBarFrame = [self invertFrameIfNeeded:statusBarFrame];
|
||||
|
||||
_statusBarBackgroundView = [[UIView alloc] initWithFrame:statusBarFrame];
|
||||
_statusBarBackgroundView.backgroundColor = _statusBarBackgroundColor;
|
||||
@@ -176,10 +198,10 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
||||
_statusBarBackgroundView.autoresizesSubviews = YES;
|
||||
}
|
||||
|
||||
- (CGRect) invertFrameIfNeeded:(CGRect)rect orientation:(UIInterfaceOrientation)orientation {
|
||||
- (CGRect) invertFrameIfNeeded:(CGRect)rect {
|
||||
// landscape is where (width > height). On iOS < 8, we need to invert since frames are
|
||||
// always in Portrait context
|
||||
if (UIDeviceOrientationIsLandscape(orientation) && (rect.size.width < rect.size.height) ) {
|
||||
if (UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]) && (rect.size.width < rect.size.height)) {
|
||||
CGFloat temp = rect.size.width;
|
||||
rect.size.width = rect.size.height;
|
||||
rect.size.height = temp;
|
||||
@@ -195,34 +217,22 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
||||
if (!IsAtLeastiOSVersion(@"7.0") || statusBarOverlaysWebView == _statusBarOverlaysWebView) {
|
||||
return;
|
||||
}
|
||||
|
||||
_statusBarOverlaysWebView = statusBarOverlaysWebView;
|
||||
|
||||
CGRect bounds = [[UIScreen mainScreen] bounds];
|
||||
[self resizeWebView];
|
||||
|
||||
if (statusBarOverlaysWebView) {
|
||||
|
||||
[_statusBarBackgroundView removeFromSuperview];
|
||||
if (UIDeviceOrientationIsLandscape(self.viewController.interfaceOrientation)) {
|
||||
self.webView.frame = CGRectMake(0, 0, bounds.size.height, bounds.size.width);
|
||||
} else {
|
||||
self.webView.frame = bounds;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
|
||||
statusBarFrame = [self invertFrameIfNeeded:statusBarFrame orientation:self.viewController.interfaceOrientation];
|
||||
|
||||
[self initializeStatusBarBackgroundView];
|
||||
|
||||
CGRect frame = self.webView.frame;
|
||||
frame.origin.y = statusBarFrame.size.height;
|
||||
frame.size.height -= statusBarFrame.size.height;
|
||||
|
||||
self.webView.frame = frame;
|
||||
[self.webView.superview addSubview:_statusBarBackgroundView];
|
||||
|
||||
}
|
||||
|
||||
_statusBarOverlaysWebView = statusBarOverlaysWebView;
|
||||
}
|
||||
|
||||
- (BOOL) statusBarOverlaysWebView
|
||||
@@ -291,12 +301,22 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
||||
|
||||
- (void) styleBlackTranslucent:(CDVInvokedUrlCommand*)command
|
||||
{
|
||||
[self setStyleForStatusBar:UIStatusBarStyleBlackTranslucent];
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 70000
|
||||
# define TRANSLUCENT_STYLE UIStatusBarStyleBlackTranslucent
|
||||
#else
|
||||
# define TRANSLUCENT_STYLE UIStatusBarStyleLightContent
|
||||
#endif
|
||||
[self setStyleForStatusBar:TRANSLUCENT_STYLE];
|
||||
}
|
||||
|
||||
- (void) styleBlackOpaque:(CDVInvokedUrlCommand*)command
|
||||
{
|
||||
[self setStyleForStatusBar:UIStatusBarStyleBlackOpaque];
|
||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 70000
|
||||
# define OPAQUE_STYLE UIStatusBarStyleBlackOpaque
|
||||
#else
|
||||
# define OPAQUE_STYLE UIStatusBarStyleLightContent
|
||||
#endif
|
||||
[self setStyleForStatusBar:OPAQUE_STYLE];
|
||||
}
|
||||
|
||||
- (void) backgroundColorByName:(CDVInvokedUrlCommand*)command
|
||||
@@ -356,29 +376,14 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
||||
|
||||
if (!app.isStatusBarHidden)
|
||||
{
|
||||
self.viewController.wantsFullScreenLayout = YES;
|
||||
CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
|
||||
|
||||
|
||||
[self hideStatusBar];
|
||||
|
||||
if (IsAtLeastiOSVersion(@"7.0")) {
|
||||
[_statusBarBackgroundView removeFromSuperview];
|
||||
}
|
||||
|
||||
if (!_statusBarOverlaysWebView) {
|
||||
|
||||
CGRect frame = self.webView.frame;
|
||||
frame.origin.y = 0;
|
||||
if (!self.statusBarOverlaysWebView) {
|
||||
if (UIDeviceOrientationIsLandscape(self.viewController.interfaceOrientation)) {
|
||||
frame.size.height += statusBarFrame.size.width;
|
||||
} else {
|
||||
frame.size.height += statusBarFrame.size.height;
|
||||
}
|
||||
}
|
||||
|
||||
self.webView.frame = frame;
|
||||
}
|
||||
[self resizeWebView];
|
||||
|
||||
_statusBarBackgroundView.hidden = YES;
|
||||
}
|
||||
@@ -404,46 +409,84 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
||||
if (app.isStatusBarHidden)
|
||||
{
|
||||
BOOL isIOS7 = (IsAtLeastiOSVersion(@"7.0"));
|
||||
self.viewController.wantsFullScreenLayout = isIOS7;
|
||||
|
||||
[self showStatusBar];
|
||||
[self resizeWebView];
|
||||
|
||||
if (isIOS7) {
|
||||
CGRect frame = self.webView.frame;
|
||||
self.viewController.view.frame = [[UIScreen mainScreen] bounds];
|
||||
|
||||
CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
|
||||
statusBarFrame = [self invertFrameIfNeeded:statusBarFrame orientation:self.viewController.interfaceOrientation];
|
||||
|
||||
if (!self.statusBarOverlaysWebView) {
|
||||
|
||||
// there is a possibility that when the statusbar was hidden, it was in a different orientation
|
||||
// from the current one. Therefore we need to expand the statusBarBackgroundView as well to the
|
||||
// statusBar's current size
|
||||
CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
|
||||
statusBarFrame = [self invertFrameIfNeeded:statusBarFrame];
|
||||
CGRect sbBgFrame = _statusBarBackgroundView.frame;
|
||||
frame.origin.y = statusBarFrame.size.height;
|
||||
frame.size.height -= statusBarFrame.size.height;
|
||||
sbBgFrame.size = statusBarFrame.size;
|
||||
|
||||
_statusBarBackgroundView.frame = sbBgFrame;
|
||||
[self.webView.superview addSubview:_statusBarBackgroundView];
|
||||
|
||||
}
|
||||
|
||||
self.webView.frame = frame;
|
||||
|
||||
} else {
|
||||
|
||||
CGRect bounds = [[UIScreen mainScreen] applicationFrame];
|
||||
self.viewController.view.frame = bounds;
|
||||
}
|
||||
|
||||
_statusBarBackgroundView.hidden = NO;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)resizeWebView
|
||||
{
|
||||
BOOL isIOS7 = (IsAtLeastiOSVersion(@"7.0"));
|
||||
|
||||
if (isIOS7) {
|
||||
CGRect bounds = [[UIScreen mainScreen] bounds];
|
||||
bounds = [self invertFrameIfNeeded:bounds];
|
||||
|
||||
if (UIInterfaceOrientationIsPortrait([[UIApplication sharedApplication] statusBarOrientation])) {
|
||||
self.viewController.view.frame = bounds;
|
||||
} else if (self.viewController.presentedViewController != nil) {
|
||||
// https://issues.apache.org/jira/browse/CB-11018
|
||||
BOOL isIOS8 = (IsAtLeastiOSVersion(@"8.0"));
|
||||
BOOL isIOS9 = (IsAtLeastiOSVersion(@"9.0"));
|
||||
if (isIOS8 && !isIOS9) {
|
||||
// iOS 8
|
||||
bounds = CGRectMake(0, 0, bounds.size.width, bounds.size.height);
|
||||
} else {
|
||||
// iOS7, iOS9+
|
||||
if ([self.viewController.presentedViewController.presentationController isKindOfClass:[UIPopoverPresentationController class]] || UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad) {
|
||||
bounds = CGRectMake(0, 0, bounds.size.width, bounds.size.height);
|
||||
} else {
|
||||
bounds = CGRectMake(0, 0, bounds.size.height, bounds.size.width);
|
||||
}
|
||||
}
|
||||
}
|
||||
self.webView.frame = bounds;
|
||||
|
||||
CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
|
||||
statusBarFrame = [self invertFrameIfNeeded:statusBarFrame];
|
||||
CGRect frame = self.webView.frame;
|
||||
|
||||
if (!self.statusBarOverlaysWebView) {
|
||||
frame.origin.y = statusBarFrame.size.height;
|
||||
frame.size.height -= statusBarFrame.size.height;
|
||||
} else {
|
||||
// even if overlay is used, we want to handle in-call/recording/hotspot larger status bar
|
||||
CGFloat height = statusBarFrame.size.height;
|
||||
frame.origin.y = height >= 20 ? height - 20 : 0;
|
||||
frame.size.height -= frame.origin.y;
|
||||
}
|
||||
self.webView.frame = frame;
|
||||
} else {
|
||||
CGRect bounds = [[UIScreen mainScreen] applicationFrame];
|
||||
self.viewController.view.frame = bounds;
|
||||
}
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[[UIApplication sharedApplication] removeObserver:self forKeyPath:@"statusBarHidden"];
|
||||
[[NSNotificationCenter defaultCenter]removeObserver:self name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -18,16 +18,18 @@
|
||||
*
|
||||
*/
|
||||
|
||||
var _supported = null; // set to null so we can check first time
|
||||
/* global Windows */
|
||||
|
||||
function isSupported() {
|
||||
// if not checked before, run check
|
||||
if (_supported == null) {
|
||||
var _supported = null; // set to null so we can check first time
|
||||
|
||||
function isSupported() {
|
||||
// if not checked before, run check
|
||||
if (_supported === null) {
|
||||
var viewMan = Windows.UI.ViewManagement;
|
||||
_supported = (viewMan.StatusBar && viewMan.StatusBar.getForCurrentView);
|
||||
}
|
||||
return _supported;
|
||||
}
|
||||
}
|
||||
|
||||
function getViewStatusBar() {
|
||||
if (!isSupported()) {
|
||||
@@ -53,9 +55,11 @@ function hexToRgb(hex) {
|
||||
|
||||
module.exports = {
|
||||
_ready: function(win, fail) {
|
||||
win(statusBar.occludedRect.height !== 0);
|
||||
if(isSupported()) {
|
||||
var statusBar = getViewStatusBar();
|
||||
win(statusBar.occludedRect.height !== 0);
|
||||
}
|
||||
},
|
||||
|
||||
overlaysWebView: function () {
|
||||
// not supported
|
||||
},
|
||||
@@ -94,14 +98,14 @@ module.exports = {
|
||||
},
|
||||
|
||||
show: function (win, fail) {
|
||||
// added support check so no error thrown, when calling this method
|
||||
// added support check so no error thrown, when calling this method
|
||||
if (isSupported()) {
|
||||
getViewStatusBar().showAsync().done(win, fail);
|
||||
}
|
||||
},
|
||||
|
||||
hide: function (win, fail) {
|
||||
// added support check so no error thrown, when calling this method
|
||||
// added support check so no error thrown, when calling this method
|
||||
if (isSupported()) {
|
||||
getViewStatusBar().hideAsync().done(win, fail);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
xmlns:rim="http://www.blackberry.com/ns/widgets"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
id="cordova-plugin-statusbar-tests"
|
||||
version="1.0.1-dev">
|
||||
version="2.2.0">
|
||||
<name>Cordova StatusBar Plugin Tests</name>
|
||||
<license>Apache 2.0</license>
|
||||
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/* jshint jasmine: true */
|
||||
/* global StatusBar */
|
||||
|
||||
exports.defineAutoTests = function () {
|
||||
describe("StatusBar", function () {
|
||||
it("statusbar.spec.1 should exist", function() {
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/* global cordova */
|
||||
|
||||
var exec = require('cordova/exec');
|
||||
|
||||
var namedColors = {
|
||||
@@ -95,15 +97,17 @@ var StatusBar = {
|
||||
|
||||
};
|
||||
|
||||
// prime it
|
||||
exec(function (res) {
|
||||
if (typeof res == 'object') {
|
||||
if (res.type == 'tap') {
|
||||
cordova.fireWindowEvent('statusTap');
|
||||
// prime it. setTimeout so that proxy gets time to init
|
||||
window.setTimeout(function () {
|
||||
exec(function (res) {
|
||||
if (typeof res == 'object') {
|
||||
if (res.type == 'tap') {
|
||||
cordova.fireWindowEvent('statusTap');
|
||||
}
|
||||
} else {
|
||||
StatusBar.isVisible = res;
|
||||
}
|
||||
} else {
|
||||
StatusBar.isVisible = res;
|
||||
}
|
||||
}, null, "StatusBar", "_ready", []);
|
||||
}, null, "StatusBar", "_ready", []);
|
||||
}, 0);
|
||||
|
||||
module.exports = StatusBar;
|
||||
|
||||
Reference in New Issue
Block a user