incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From macdo...@apache.org
Subject [3/3] git commit: Adding com.phonegap.api stubs for legacy user created plugins
Date Mon, 06 Feb 2012 15:16:30 GMT
Adding com.phonegap.api stubs for legacy user created plugins


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/d8d7c29a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/d8d7c29a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/d8d7c29a

Branch: refs/heads/master
Commit: d8d7c29afe78ae4408b7e95a7225515e2813e9f3
Parents: 210cc2b
Author: macdonst <simon.macdonald@gmail.com>
Authored: Fri Feb 3 15:54:27 2012 -0500
Committer: macdonst <simon.macdonald@gmail.com>
Committed: Mon Feb 6 10:04:02 2012 -0500

----------------------------------------------------------------------
 framework/assets/js/cordova.js.base                |    4 +
 framework/src/com/phonegap/api/IPlugin.java        |   27 +++++++
 framework/src/com/phonegap/api/LOG.java            |   28 +++++++
 .../src/com/phonegap/api/PhonegapActivity.java     |   26 ++++++
 framework/src/com/phonegap/api/Plugin.java         |   27 +++++++
 framework/src/com/phonegap/api/PluginManager.java  |   35 ++++++++
 framework/src/com/phonegap/api/PluginResult.java   |   61 +++++++++++++++
 .../src/org/apache/cordova/api/PluginManager.java  |    2 +-
 8 files changed, 209 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/d8d7c29a/framework/assets/js/cordova.js.base
----------------------------------------------------------------------
diff --git a/framework/assets/js/cordova.js.base b/framework/assets/js/cordova.js.base
index bb32580..eaccb4a 100755
--- a/framework/assets/js/cordova.js.base
+++ b/framework/assets/js/cordova.js.base
@@ -917,4 +917,8 @@ Cordova.includeJavascript = function(jsfile, successCallback) {
     id.appendChild(el);
 };
 
+/** 
+ * Legacy variable for old plugins.
+ */
+var PhoneGap = Cordova;
 }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/d8d7c29a/framework/src/com/phonegap/api/IPlugin.java
----------------------------------------------------------------------
diff --git a/framework/src/com/phonegap/api/IPlugin.java b/framework/src/com/phonegap/api/IPlugin.java
new file mode 100755
index 0000000..2b8979b
--- /dev/null
+++ b/framework/src/com/phonegap/api/IPlugin.java
@@ -0,0 +1,27 @@
+/*
+       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.
+*/
+package com.phonegap.api;
+
+/**
+ * Plugin interface must be implemented by any plugin classes.
+ *
+ * The execute method is called by the PluginManager.
+ */
+public interface IPlugin extends org.apache.cordova.api.IPlugin {
+}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/d8d7c29a/framework/src/com/phonegap/api/LOG.java
----------------------------------------------------------------------
diff --git a/framework/src/com/phonegap/api/LOG.java b/framework/src/com/phonegap/api/LOG.java
new file mode 100755
index 0000000..3520425
--- /dev/null
+++ b/framework/src/com/phonegap/api/LOG.java
@@ -0,0 +1,28 @@
+/*
+       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.
+*/
+package com.phonegap.api;
+
+/**
+ * Log to Android logging system.
+ * 
+ * Log message can be a string or a printf formatted string with arguments.
+ * See http://developer.android.com/reference/java/util/Formatter.html
+ */
+public class LOG extends org.apache.cordova.api.LOG {
+}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/d8d7c29a/framework/src/com/phonegap/api/PhonegapActivity.java
----------------------------------------------------------------------
diff --git a/framework/src/com/phonegap/api/PhonegapActivity.java b/framework/src/com/phonegap/api/PhonegapActivity.java
new file mode 100755
index 0000000..9e01f56
--- /dev/null
+++ b/framework/src/com/phonegap/api/PhonegapActivity.java
@@ -0,0 +1,26 @@
+/*
+       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.
+*/
+package com.phonegap.api;
+
+/**
+ * The Cordova activity abstract class that is extended by DroidGap.
+ * It is used to isolate plugin development, and remove dependency on entire Cordova library.
+ */
+public abstract class PhonegapActivity extends org.apache.cordova.api.CordovaActivity {
+}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/d8d7c29a/framework/src/com/phonegap/api/Plugin.java
----------------------------------------------------------------------
diff --git a/framework/src/com/phonegap/api/Plugin.java b/framework/src/com/phonegap/api/Plugin.java
new file mode 100755
index 0000000..05f32b7
--- /dev/null
+++ b/framework/src/com/phonegap/api/Plugin.java
@@ -0,0 +1,27 @@
+/*
+       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.
+*/
+package com.phonegap.api;
+
+/**
+ * Plugin interface must be implemented by any plugin classes.
+ *
+ * The execute method is called by the PluginManager.
+ */
+public abstract class Plugin extends org.apache.cordova.api.Plugin {
+}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/d8d7c29a/framework/src/com/phonegap/api/PluginManager.java
----------------------------------------------------------------------
diff --git a/framework/src/com/phonegap/api/PluginManager.java b/framework/src/com/phonegap/api/PluginManager.java
new file mode 100755
index 0000000..190cc77
--- /dev/null
+++ b/framework/src/com/phonegap/api/PluginManager.java
@@ -0,0 +1,35 @@
+/*
+       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.
+*/
+package com.phonegap.api;
+
+import org.apache.cordova.api.CordovaActivity;
+
+import android.webkit.WebView;
+
+/**
+ * PluginManager is exposed to JavaScript in the Cordova WebView.
+ * 
+ * Calling native plugin code can be done by calling PluginManager.exec(...)
+ * from JavaScript.
+ */
+public class PluginManager extends org.apache.cordova.api.PluginManager {
+
+    public PluginManager(WebView app, CordovaActivity ctx) {
+        super(app, ctx);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/d8d7c29a/framework/src/com/phonegap/api/PluginResult.java
----------------------------------------------------------------------
diff --git a/framework/src/com/phonegap/api/PluginResult.java b/framework/src/com/phonegap/api/PluginResult.java
new file mode 100755
index 0000000..378c213
--- /dev/null
+++ b/framework/src/com/phonegap/api/PluginResult.java
@@ -0,0 +1,61 @@
+/*
+       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.
+*/
+package com.phonegap.api;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+public class PluginResult extends org.apache.cordova.api.PluginResult {
+	
+	public PluginResult(Status status) {
+		super(status);
+	}
+	
+	public PluginResult(Status status, String message) {
+		super(status, message);
+	}
+
+	public PluginResult(Status status, JSONArray message, String cast) {
+        super(status, message, cast);
+	}
+
+	public PluginResult(Status status, JSONObject message, String cast) {
+        super(status, message, cast);
+	}
+
+	public PluginResult(Status status, JSONArray message) {
+        super(status, message);
+	}
+
+	public PluginResult(Status status, JSONObject message) {
+        super(status, message);
+	}
+
+	public PluginResult(Status status, int i) {
+        super(status, i);
+	}
+
+	public PluginResult(Status status, float f) {
+        super(status, f);
+	}
+
+	public PluginResult(Status status, boolean b) {
+        super(status, b);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/d8d7c29a/framework/src/org/apache/cordova/api/PluginManager.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/api/PluginManager.java b/framework/src/org/apache/cordova/api/PluginManager.java
index 9f47fea..2ac15d8 100755
--- a/framework/src/org/apache/cordova/api/PluginManager.java
+++ b/framework/src/org/apache/cordova/api/PluginManager.java
@@ -37,7 +37,7 @@ import android.webkit.WebView;
  * Calling native plugin code can be done by calling PluginManager.exec(...)
  * from JavaScript.
  */
-public final class PluginManager {
+public class PluginManager {
 
 	private HashMap<String, IPlugin> plugins = new HashMap<String,IPlugin>();
 	private HashMap<String, String> services = new HashMap<String,String>();


Mime
View raw message