You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2013/10/05 03:03:24 UTC
[1/2] git commit: Updated keyboard plugin name in plugin.xml
Updated Branches:
refs/heads/plugins 3d26e5d6d -> 86fb3afef
Updated keyboard plugin name in plugin.xml
Project: http://git-wip-us.apache.org/repos/asf/cordova-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-labs/commit/33354696
Tree: http://git-wip-us.apache.org/repos/asf/cordova-labs/tree/33354696
Diff: http://git-wip-us.apache.org/repos/asf/cordova-labs/diff/33354696
Branch: refs/heads/plugins
Commit: 333546962b320aff5407cb49f455d97dbb9080e5
Parents: 3d26e5d
Author: Shazron Abdullah <sh...@apache.org>
Authored: Fri Oct 4 18:00:39 2013 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Fri Oct 4 18:01:05 2013 -0700
----------------------------------------------------------------------
keyboard/plugin.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/33354696/keyboard/plugin.xml
----------------------------------------------------------------------
diff --git a/keyboard/plugin.xml b/keyboard/plugin.xml
index ed0138d..eb8a0f0 100644
--- a/keyboard/plugin.xml
+++ b/keyboard/plugin.xml
@@ -5,7 +5,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
id="org.apache.cordova.keyboard"
version="0.1.0">
- <name>Device</name>
+ <name>Keyboard</name>
<description>Cordova Keyboard Plugin</description>
<license>Apache 2.0</license>
<keywords>cordova,keyboard</keywords>
[2/2] git commit: Added statusbar plugin.
Posted by sh...@apache.org.
Added statusbar plugin.
This controls whether the statusbar overlays the webview in iOS 7, as well as allows changing of the statusbar styles.
Project: http://git-wip-us.apache.org/repos/asf/cordova-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-labs/commit/86fb3afe
Tree: http://git-wip-us.apache.org/repos/asf/cordova-labs/tree/86fb3afe
Diff: http://git-wip-us.apache.org/repos/asf/cordova-labs/diff/86fb3afe
Branch: refs/heads/plugins
Commit: 86fb3afef5aaaba8e82e5bf0719b74b4a07582e0
Parents: 3335469
Author: Shazron Abdullah <sh...@apache.org>
Authored: Fri Oct 4 18:03:18 2013 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Fri Oct 4 18:03:18 2013 -0700
----------------------------------------------------------------------
statusbar/plugin.xml | 38 ++++++++++++
statusbar/src/ios/CDVStatusBar.h | 38 ++++++++++++
statusbar/src/ios/CDVStatusBar.m | 108 ++++++++++++++++++++++++++++++++++
statusbar/www/statusbar.js | 57 ++++++++++++++++++
4 files changed, 241 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/86fb3afe/statusbar/plugin.xml
----------------------------------------------------------------------
diff --git a/statusbar/plugin.xml b/statusbar/plugin.xml
new file mode 100644
index 0000000..ad69b14
--- /dev/null
+++ b/statusbar/plugin.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
+ xmlns:rim="http://www.blackberry.com/ns/widgets"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ id="org.apache.cordova.statusbar"
+ version="0.1.0">
+ <name>StatusBar</name>
+ <description>Cordova StatusBar Plugin</description>
+ <license>Apache 2.0</license>
+ <keywords>cordova,statusbar</keywords>
+
+ <engines>
+ <engine name="cordova" version=">=3.0.0" />
+ </engines>
+
+ <js-module src="www/statusbar.js" name="statusbar">
+ <clobbers target="window.StatusBar" />
+ </js-module>
+
+ <!-- ios -->
+ <platform name="ios">
+ <config-file target="config.xml" parent="/*">
+ <feature name="StatusBar">
+ <param name="ios-package" value="CDVStatusBar" onload="true" />
+ </feature>
+ </config-file>
+
+ <config-file target="*-Info.plist" parent="UIViewControllerBasedStatusBarAppearance" >
+ <key>UIViewControllerBasedStatusBarAppearance</key>
+ <false/>
+ </config-file>
+
+ <header-file src="src/ios/CDVStatusBar.h" />
+ <source-file src="src/ios/CDVStatusBar.m" />
+ </platform>
+
+</plugin>
http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/86fb3afe/statusbar/src/ios/CDVStatusBar.h
----------------------------------------------------------------------
diff --git a/statusbar/src/ios/CDVStatusBar.h b/statusbar/src/ios/CDVStatusBar.h
new file mode 100644
index 0000000..298b3f5
--- /dev/null
+++ b/statusbar/src/ios/CDVStatusBar.h
@@ -0,0 +1,38 @@
+/*
+ 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.
+ */
+
+#import <Cordova/CDVPlugin.h>
+#import <Cordova/CDVInvokedUrlCommand.h>
+
+@interface CDVStatusBar : CDVPlugin {
+ @protected
+ BOOL _statusBarOverlaysWebView;
+}
+
+@property (atomic, assign) BOOL statusBarOverlaysWebView;
+
+- (void) statusBarOverlaysWebView:(CDVInvokedUrlCommand*)command;
+
+- (void) styleDefault:(CDVInvokedUrlCommand*)command;
+- (void) styleLightContent:(CDVInvokedUrlCommand*)command;
+- (void) styleBlackTranslucent:(CDVInvokedUrlCommand*)command;
+- (void) styleBlackOpaque:(CDVInvokedUrlCommand*)command;
+
+
+@end
http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/86fb3afe/statusbar/src/ios/CDVStatusBar.m
----------------------------------------------------------------------
diff --git a/statusbar/src/ios/CDVStatusBar.m b/statusbar/src/ios/CDVStatusBar.m
new file mode 100644
index 0000000..9fe4632
--- /dev/null
+++ b/statusbar/src/ios/CDVStatusBar.m
@@ -0,0 +1,108 @@
+/*
+ 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.
+ */
+
+/*
+ NOTE: plugman/cordova cli should have already installed this,
+ but you need the value UIViewControllerBasedStatusBarAppearance
+ in your Info.plist as well to set the styles in iOS 7
+ */
+
+#import "CDVStatusBar.h"
+
+@implementation CDVStatusBar
+
+- (id)settingForKey:(NSString*)key
+{
+ return [self.commandDelegate.settings objectForKey:[key lowercaseString]];
+}
+
+- (void)pluginInitialize
+{
+ _statusBarOverlaysWebView = YES; // default
+
+ NSString* setting = @"StatusBarOverlaysWebView";
+ if ([self settingForKey:setting]) {
+ self.statusBarOverlaysWebView = [(NSNumber*)[self settingForKey:setting] boolValue];
+ }
+}
+
+- (void) setStatusBarOverlaysWebView:(BOOL)statusBarOverlaysWebView
+{
+ // we only care about the latest iOS version or a change in setting
+ if (!IsAtLeastiOSVersion(@"7.0") || statusBarOverlaysWebView == _statusBarOverlaysWebView) {
+ return;
+ }
+
+ if (statusBarOverlaysWebView) {
+
+ CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
+ CGRect bounds = self.viewController.view.bounds;
+ bounds.origin.y = 0;
+ bounds.size.height += statusBarFrame.size.height;
+
+ self.webView.frame = bounds;
+
+ } else {
+ CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
+ CGRect bounds = self.viewController.view.bounds;
+ bounds.origin.y += statusBarFrame.size.height;
+ bounds.size.height -= statusBarFrame.size.height;
+
+ self.webView.frame = bounds;
+ }
+
+ _statusBarOverlaysWebView = statusBarOverlaysWebView;
+}
+
+- (BOOL) statusBarOverlaysWebView
+{
+ return _statusBarOverlaysWebView;
+}
+
+- (void) statusBarOverlaysWebView:(CDVInvokedUrlCommand*)command
+{
+ id value = [command.arguments objectAtIndex:0];
+ if (!([value isKindOfClass:[NSNumber class]])) {
+ value = [NSNumber numberWithBool:YES];
+ }
+
+ self.statusBarOverlaysWebView = [value boolValue];
+}
+
+- (void) styleDefault:(CDVInvokedUrlCommand*)command
+{
+ [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
+}
+
+- (void) styleLightContent:(CDVInvokedUrlCommand*)command
+{
+ [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
+}
+
+- (void) styleBlackTranslucent:(CDVInvokedUrlCommand*)command
+{
+ [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
+}
+
+- (void) styleBlackOpaque:(CDVInvokedUrlCommand*)command
+{
+ [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];
+}
+
+@end
http://git-wip-us.apache.org/repos/asf/cordova-labs/blob/86fb3afe/statusbar/www/statusbar.js
----------------------------------------------------------------------
diff --git a/statusbar/www/statusbar.js b/statusbar/www/statusbar.js
new file mode 100644
index 0000000..4f1886a
--- /dev/null
+++ b/statusbar/www/statusbar.js
@@ -0,0 +1,57 @@
+/*
+ *
+ * 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 argscheck = require('cordova/argscheck'),
+// utils = require('cordova/utils'),
+// exec = require('cordova/exec');
+
+(function() {
+
+var exec = cordova.require('cordova/exec')
+
+var StatusBar = function() {
+};
+
+StatusBar.statusBarOverlaysWebView = function(doOverlay) {
+ exec(null, null, "StatusBar", "statusBarOverlaysWebView", [doOverlay]);
+};
+
+StatusBar.styleDefault = function() {
+ exec(null, null, "StatusBar", "styleDefault", []);
+};
+
+StatusBar.styleLightContent = function() {
+ exec(null, null, "StatusBar", "styleLightContent", []);
+};
+
+StatusBar.styleBlackTranslucent = function() {
+ exec(null, null, "StatusBar", "styleBlackTranslucent", []);
+};
+
+StatusBar.styleBlackOpaque = function() {
+ exec(null, null, "StatusBar", "styleBlackOpaque", []);
+};
+
+StatusBar.isVisible = true;
+
+window.StatusBar = StatusBar;
+
+})();
\ No newline at end of file