diff --git a/framework/assets/js/cordova.js.base b/framework/assets/js/cordova.js.base index bb325804..eaccb4ac 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; } diff --git a/framework/src/com/phonegap/api/IPlugin.java b/framework/src/com/phonegap/api/IPlugin.java new file mode 100755 index 00000000..2b8979bc --- /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 { +} diff --git a/framework/src/com/phonegap/api/LOG.java b/framework/src/com/phonegap/api/LOG.java new file mode 100755 index 00000000..35204250 --- /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 { +} diff --git a/framework/src/com/phonegap/api/PhonegapActivity.java b/framework/src/com/phonegap/api/PhonegapActivity.java new file mode 100755 index 00000000..9e01f562 --- /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 { +} diff --git a/framework/src/com/phonegap/api/Plugin.java b/framework/src/com/phonegap/api/Plugin.java new file mode 100755 index 00000000..05f32b7c --- /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 { +} diff --git a/framework/src/com/phonegap/api/PluginManager.java b/framework/src/com/phonegap/api/PluginManager.java new file mode 100755 index 00000000..190cc777 --- /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); + } +} diff --git a/framework/src/com/phonegap/api/PluginResult.java b/framework/src/com/phonegap/api/PluginResult.java new file mode 100755 index 00000000..378c2138 --- /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); + } +} diff --git a/framework/src/org/apache/cordova/api/PluginManager.java b/framework/src/org/apache/cordova/api/PluginManager.java index 9f47fea0..2ac15d81 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 plugins = new HashMap(); private HashMap services = new HashMap();