You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2014/11/13 03:05:18 UTC
[1/5] cordova-plugin-statusbar git commit: CB-7986 Add
cordova-plugin-statusbar support for Windows Phone 8.1
Repository: cordova-plugin-statusbar
Updated Branches:
refs/heads/master 8685564ec -> c89fdd461
CB-7986 Add cordova-plugin-statusbar support for Windows Phone 8.1
Added Windows Phone 8.1 support
Updated the documentation
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/commit/a6344f14
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/tree/a6344f14
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/diff/a6344f14
Branch: refs/heads/master
Commit: a6344f14f99c19d60a783d92a742285fa3c62fca
Parents: 5658e75
Author: daserge <da...@yandex.ru>
Authored: Mon Nov 10 22:20:42 2014 +0300
Committer: daserge <da...@yandex.ru>
Committed: Mon Nov 10 22:20:42 2014 +0300
----------------------------------------------------------------------
doc/index.md | 9 +++++
plugin.xml | 6 +++
src/windows/StatusBar.js | 90 +++++++++++++++++++++++++++++++++++++++++++
www/statusbar.js | 3 ++
4 files changed, 108 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/blob/a6344f14/doc/index.md
----------------------------------------------------------------------
diff --git a/doc/index.md b/doc/index.md
index aa773f4..23739ed 100644
--- a/doc/index.md
+++ b/doc/index.md
@@ -120,6 +120,7 @@ Supported Platforms
- iOS
- Windows Phone 7
- Windows Phone 8
+- Windows Phone 8.1
StatusBar.styleLightContent
=================
@@ -135,6 +136,7 @@ Supported Platforms
- iOS
- Windows Phone 7
- Windows Phone 8
+- Windows Phone 8.1
StatusBar.styleBlackTranslucent
=================
@@ -150,6 +152,7 @@ Supported Platforms
- iOS
- Windows Phone 7
- Windows Phone 8
+- Windows Phone 8.1
StatusBar.styleBlackOpaque
=================
@@ -165,6 +168,7 @@ Supported Platforms
- iOS
- Windows Phone 7
- Windows Phone 8
+- Windows Phone 8.1
StatusBar.backgroundColorByName
@@ -185,6 +189,7 @@ Supported Platforms
- iOS
- Windows Phone 7
- Windows Phone 8
+- Windows Phone 8.1
StatusBar.backgroundColorByHexString
=================
@@ -208,6 +213,7 @@ Supported Platforms
- iOS
- Windows Phone 7
- Windows Phone 8
+- Windows Phone 8.1
StatusBar.hide
=================
@@ -224,6 +230,7 @@ Supported Platforms
- Android
- Windows Phone 7
- Windows Phone 8
+- Windows Phone 8.1
StatusBar.show
=================
@@ -240,6 +247,7 @@ Supported Platforms
- Android
- Windows Phone 7
- Windows Phone 8
+- Windows Phone 8.1
StatusBar.isVisible
@@ -259,5 +267,6 @@ Supported Platforms
- Android
- Windows Phone 7
- Windows Phone 8
+- Windows Phone 8.1
http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/blob/a6344f14/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index ce2e689..29f1e16 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -82,4 +82,10 @@
<source-file src="src/wp/StatusBar.cs" />
</platform>
+ <!-- windows -->
+ <platform name="windows">
+ <js-module src="src/windows/StatusBar.js" name="StatusBar">
+ <runs />
+ </js-module>
+ </platform>
</plugin>
http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/blob/a6344f14/src/windows/StatusBar.js
----------------------------------------------------------------------
diff --git a/src/windows/StatusBar.js b/src/windows/StatusBar.js
new file mode 100644
index 0000000..1d5a60a
--- /dev/null
+++ b/src/windows/StatusBar.js
@@ -0,0 +1,90 @@
+/*
+ *
+ * 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.
+ *
+ */
+var statusBar = Windows.UI.ViewManagement.StatusBar.getForCurrentView();
+
+function darkForeground () {
+ // dark text ( to be used on a light background )
+ statusBar.foregroundColor = { a: 0, r: 0, g: 0, b: 0 };
+}
+
+function lightForeground() {
+ // light text ( to be used on a dark background )
+ statusBar.foregroundColor = { a: 0, r: 255, g: 255, b: 255 };
+}
+
+function hexToRgb(hex) {
+ // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
+ var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
+ hex = hex.replace(shorthandRegex, function (m, r, g, b) {
+ return r + r + g + g + b + b;
+ });
+
+ var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
+ return result ? {
+ r: parseInt(result[1], 16),
+ g: parseInt(result[2], 16),
+ b: parseInt(result[3], 16)
+ } : null;
+}
+
+var StatusBar = {
+ _ready: function(win, fail) {
+ win(statusBar.occludedRect.height !== 0);
+ },
+
+ overlaysWebView: function () {
+ // not supported
+ },
+
+ styleDefault: function () {
+ darkForeground();
+ },
+
+ styleLightContent: function () {
+ lightForeground();
+ },
+
+ styleBlackTranslucent: function () {
+ // #88000000 ? Apple says to use lightContent instead
+ lightForeground();
+ },
+
+ styleBlackOpaque: function () {
+ // #FF000000 ? Apple says to use lightContent instead
+ lightForeground();
+ },
+
+ backgroundColorByHexString: function (win, fail, args) {
+ var rgb = hexToRgb(args[0]);
+ statusBar.backgroundColor = { a: 0, r: rgb.r, g: rgb.g, b: rgb.b };
+ statusBar.backgroundOpacity = 1;
+ },
+
+ show: function (win, fail) {
+ statusBar.showAsync().done(win, fail);
+ },
+
+ hide: function (win, fail) {
+ statusBar.hideAsync().done(win, fail);
+ }
+};
+
+require("cordova/exec/proxy").add("StatusBar", StatusBar);
http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/blob/a6344f14/www/statusbar.js
----------------------------------------------------------------------
diff --git a/www/statusbar.js b/www/statusbar.js
index d6f68ac..5327452 100644
--- a/www/statusbar.js
+++ b/www/statusbar.js
@@ -21,6 +21,9 @@
var exec = require('cordova/exec');
+// Needed for Windows Phone 8.1 as it is initialized after this module
+var StatusBar = StatusBar || require('org.apache.cordova.statusbar.StatusBar');
+
var namedColors = {
"black": "#000000",
"darkGray": "#A9A9A9",
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[4/5] cordova-plugin-statusbar git commit: rejiggered some stuff
around
Posted by pu...@apache.org.
rejiggered some stuff around
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/commit/251e9044
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/tree/251e9044
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/diff/251e9044
Branch: refs/heads/master
Commit: 251e904492fe6fc2a0a2880cc52655d7e88cd0ba
Parents: 7bc7c32
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Nov 12 14:53:44 2014 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Nov 12 14:53:44 2014 -0800
----------------------------------------------------------------------
plugin.xml | 2 +-
www/statusbar.js | 3 ---
2 files changed, 1 insertion(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/blob/251e9044/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 29f1e16..d3c5f10 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -84,7 +84,7 @@
<!-- windows -->
<platform name="windows">
- <js-module src="src/windows/StatusBar.js" name="StatusBar">
+ <js-module src="src/windows/StatusBarProxy.js" name="StatusBarProxy">
<runs />
</js-module>
</platform>
http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/blob/251e9044/www/statusbar.js
----------------------------------------------------------------------
diff --git a/www/statusbar.js b/www/statusbar.js
index 5327452..d6f68ac 100644
--- a/www/statusbar.js
+++ b/www/statusbar.js
@@ -21,9 +21,6 @@
var exec = require('cordova/exec');
-// Needed for Windows Phone 8.1 as it is initialized after this module
-var StatusBar = StatusBar || require('org.apache.cordova.statusbar.StatusBar');
-
var namedColors = {
"black": "#000000",
"darkGray": "#A9A9A9",
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[5/5] cordova-plugin-statusbar git commit: added checks for running
on windows when StatusBar is NOT available
Posted by pu...@apache.org.
added checks for running on windows when StatusBar is NOT available
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/commit/c89fdd46
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/tree/c89fdd46
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/diff/c89fdd46
Branch: refs/heads/master
Commit: c89fdd46174975fe22b4faccffe624c3ac765a22
Parents: 251e904
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Nov 12 18:04:38 2014 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Nov 12 18:04:38 2014 -0800
----------------------------------------------------------------------
src/windows/StatusBarProxy.js | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/blob/c89fdd46/src/windows/StatusBarProxy.js
----------------------------------------------------------------------
diff --git a/src/windows/StatusBarProxy.js b/src/windows/StatusBarProxy.js
index 086c0ac..5770099 100644
--- a/src/windows/StatusBarProxy.js
+++ b/src/windows/StatusBarProxy.js
@@ -19,16 +19,20 @@
*
*/
-function getViewStatusBar() {
- return Windows.UI.ViewManagement.StatusBar.getForCurrentView();
-}
-
-function darkForeground () {
-
-}
+ var isSupported = true; // we assume
-function lightForeground() {
-
+function getViewStatusBar() {
+ if(isSupported) {
+ var ViewMan = Windows.UI.ViewManagement; // quick alias to save char
+ if( ViewMan.StatusBar &&
+ ViewMan.StatusBar.getForCurrentView ) {
+ return ViewMan.StatusBar.getForCurrentView();
+ }
+ else {
+ isSupported = false; // so we won't check again
+ }
+ }
+ return null;
}
function hexToRgb(hex) {
@@ -78,8 +82,10 @@ module.exports = {
backgroundColorByHexString: function (win, fail, args) {
var rgb = hexToRgb(args[0]);
var statusBar = getViewStatusBar();
- statusBar.backgroundColor = { a: 0, r: rgb.r, g: rgb.g, b: rgb.b };
- statusBar.backgroundOpacity = 1;
+ if(statusBar) {
+ statusBar.backgroundColor = { a: 0, r: rgb.r, g: rgb.g, b: rgb.b };
+ statusBar.backgroundOpacity = 1;
+ }
},
show: function (win, fail) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[3/5] cordova-plugin-statusbar git commit: Renamed to proxy
Posted by pu...@apache.org.
Renamed to proxy
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/commit/7bc7c326
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/tree/7bc7c326
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/diff/7bc7c326
Branch: refs/heads/master
Commit: 7bc7c326c8a3ed7f2ec03e5dd099233cf90bf98a
Parents: 8397851
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Nov 12 14:53:06 2014 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Nov 12 14:53:06 2014 -0800
----------------------------------------------------------------------
src/windows/StatusBar.js | 90 ------------------------------------
src/windows/StatusBarProxy.js | 94 ++++++++++++++++++++++++++++++++++++++
2 files changed, 94 insertions(+), 90 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/blob/7bc7c326/src/windows/StatusBar.js
----------------------------------------------------------------------
diff --git a/src/windows/StatusBar.js b/src/windows/StatusBar.js
deleted file mode 100644
index 1d5a60a..0000000
--- a/src/windows/StatusBar.js
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- *
- * 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.
- *
- */
-var statusBar = Windows.UI.ViewManagement.StatusBar.getForCurrentView();
-
-function darkForeground () {
- // dark text ( to be used on a light background )
- statusBar.foregroundColor = { a: 0, r: 0, g: 0, b: 0 };
-}
-
-function lightForeground() {
- // light text ( to be used on a dark background )
- statusBar.foregroundColor = { a: 0, r: 255, g: 255, b: 255 };
-}
-
-function hexToRgb(hex) {
- // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
- var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
- hex = hex.replace(shorthandRegex, function (m, r, g, b) {
- return r + r + g + g + b + b;
- });
-
- var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
- return result ? {
- r: parseInt(result[1], 16),
- g: parseInt(result[2], 16),
- b: parseInt(result[3], 16)
- } : null;
-}
-
-var StatusBar = {
- _ready: function(win, fail) {
- win(statusBar.occludedRect.height !== 0);
- },
-
- overlaysWebView: function () {
- // not supported
- },
-
- styleDefault: function () {
- darkForeground();
- },
-
- styleLightContent: function () {
- lightForeground();
- },
-
- styleBlackTranslucent: function () {
- // #88000000 ? Apple says to use lightContent instead
- lightForeground();
- },
-
- styleBlackOpaque: function () {
- // #FF000000 ? Apple says to use lightContent instead
- lightForeground();
- },
-
- backgroundColorByHexString: function (win, fail, args) {
- var rgb = hexToRgb(args[0]);
- statusBar.backgroundColor = { a: 0, r: rgb.r, g: rgb.g, b: rgb.b };
- statusBar.backgroundOpacity = 1;
- },
-
- show: function (win, fail) {
- statusBar.showAsync().done(win, fail);
- },
-
- hide: function (win, fail) {
- statusBar.hideAsync().done(win, fail);
- }
-};
-
-require("cordova/exec/proxy").add("StatusBar", StatusBar);
http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/blob/7bc7c326/src/windows/StatusBarProxy.js
----------------------------------------------------------------------
diff --git a/src/windows/StatusBarProxy.js b/src/windows/StatusBarProxy.js
new file mode 100644
index 0000000..086c0ac
--- /dev/null
+++ b/src/windows/StatusBarProxy.js
@@ -0,0 +1,94 @@
+/*
+ *
+ * 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 getViewStatusBar() {
+ return Windows.UI.ViewManagement.StatusBar.getForCurrentView();
+}
+
+function darkForeground () {
+
+}
+
+function lightForeground() {
+
+}
+
+function hexToRgb(hex) {
+ // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
+ var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
+ hex = hex.replace(shorthandRegex, function (m, r, g, b) {
+ return r + r + g + g + b + b;
+ });
+
+ var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
+ return result ? {
+ r: parseInt(result[1], 16),
+ g: parseInt(result[2], 16),
+ b: parseInt(result[3], 16)
+ } : null;
+}
+
+module.exports = {
+ _ready: function(win, fail) {
+ win(statusBar.occludedRect.height !== 0);
+ },
+
+ overlaysWebView: function () {
+ // not supported
+ },
+
+ styleDefault: function () {
+ // dark text ( to be used on a light background )
+ getViewStatusBar().foregroundColor = { a: 0, r: 0, g: 0, b: 0 };
+ },
+
+ styleLightContent: function () {
+ // light text ( to be used on a dark background )
+ getViewStatusBar().foregroundColor = { a: 0, r: 255, g: 255, b: 255 };
+ },
+
+ styleBlackTranslucent: function () {
+ // #88000000 ? Apple says to use lightContent instead
+ return this.styleLightContent();
+ },
+
+ styleBlackOpaque: function () {
+ // #FF000000 ? Apple says to use lightContent instead
+ return this.styleLightContent();
+ },
+
+ backgroundColorByHexString: function (win, fail, args) {
+ var rgb = hexToRgb(args[0]);
+ var statusBar = getViewStatusBar();
+ statusBar.backgroundColor = { a: 0, r: rgb.r, g: rgb.g, b: rgb.b };
+ statusBar.backgroundOpacity = 1;
+ },
+
+ show: function (win, fail) {
+ getViewStatusBar().showAsync().done(win, fail);
+ },
+
+ hide: function (win, fail) {
+ getViewStatusBar().hideAsync().done(win, fail);
+ }
+};
+
+require("cordova/exec/proxy").add("StatusBar", module.exports);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[2/5] cordova-plugin-statusbar git commit: Merge branch 'CB-7986' of
https://github.com/MSOpenTech/cordova-plugin-statusbar
Posted by pu...@apache.org.
Merge branch 'CB-7986' of https://github.com/MSOpenTech/cordova-plugin-statusbar
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/commit/83978519
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/tree/83978519
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/diff/83978519
Branch: refs/heads/master
Commit: 83978519ad5467cc7faace8d367cba5410da4434
Parents: 8685564 a6344f1
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Nov 12 14:27:13 2014 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Nov 12 14:27:13 2014 -0800
----------------------------------------------------------------------
doc/index.md | 9 +++++
plugin.xml | 6 +++
src/windows/StatusBar.js | 90 +++++++++++++++++++++++++++++++++++++++++++
www/statusbar.js | 3 ++
4 files changed, 108 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-statusbar/blob/83978519/doc/index.md
----------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org