Skip to content

Commit

Permalink
Delete IPlugin interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
agrieve committed Oct 2, 2012
1 parent 5289d56 commit ec3c5b2
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 146 deletions.
2 changes: 1 addition & 1 deletion framework/assets/js/cordova.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -6464,4 +6464,4 @@ window.cordova = require('cordova');
}(window));


})();
})();
10 changes: 5 additions & 5 deletions framework/src/org/apache/cordova/DroidGap.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Licensed to the Apache Software Foundation (ASF) under one
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import org.apache.cordova.api.IPlugin;
import org.apache.cordova.api.Plugin;
import org.apache.cordova.api.LOG;
import org.apache.cordova.api.CordovaInterface;
import org.json.JSONException;
Expand Down Expand Up @@ -162,7 +162,7 @@ public class DroidGap extends Activity implements CordovaInterface {
String baseUrl = null;

// Plugin to call when activity result is received
protected IPlugin activityResultCallback = null;
protected Plugin activityResultCallback = null;
protected boolean activityResultKeepRunning;

// Default background color for activity
Expand Down Expand Up @@ -773,7 +773,7 @@ public void endActivity() {
* @param intent The intent to start
* @param requestCode The request code that is passed to callback to identify the activity
*/
public void startActivityForResult(IPlugin command, Intent intent, int requestCode) {
public void startActivityForResult(Plugin command, Intent intent, int requestCode) {
this.activityResultCallback = command;
this.activityResultKeepRunning = this.keepRunning;

Expand All @@ -798,13 +798,13 @@ public void startActivityForResult(IPlugin command, Intent intent, int requestCo
*/
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
IPlugin callback = this.activityResultCallback;
Plugin callback = this.activityResultCallback;
if (callback != null) {
callback.onActivityResult(requestCode, resultCode, intent);
}
}

public void setActivityResultCallback(IPlugin plugin) {
public void setActivityResultCallback(Plugin plugin) {
this.activityResultCallback = plugin;
}

Expand Down
4 changes: 2 additions & 2 deletions framework/src/org/apache/cordova/api/CordovaInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ public interface CordovaInterface {
* @param intent The intent to start
* @param requestCode The request code that is passed to callback to identify the activity
*/
abstract public void startActivityForResult(IPlugin command, Intent intent, int requestCode);
abstract public void startActivityForResult(Plugin command, Intent intent, int requestCode);

/**
* Set the plugin to be called when a sub-activity exits.
*
* @param plugin The plugin on which onActivityResult is to be called
*/
abstract public void setActivityResultCallback(IPlugin plugin);
abstract public void setActivityResultCallback(Plugin plugin);


/**
Expand Down
126 changes: 0 additions & 126 deletions framework/src/org/apache/cordova/api/IPlugin.java

This file was deleted.

4 changes: 2 additions & 2 deletions framework/src/org/apache/cordova/api/LegacyContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ public Object onMessage(String arg0, Object arg1) {
}

@Deprecated
public void setActivityResultCallback(IPlugin arg0) {
public void setActivityResultCallback(Plugin arg0) {
Log.i(LOG_TAG, "Replace ctx.setActivityResultCallback() with cordova.setActivityResultCallback()");
this.cordova.setActivityResultCallback(arg0);
}

@Deprecated
public void startActivityForResult(IPlugin arg0, Intent arg1, int arg2) {
public void startActivityForResult(Plugin arg0, Intent arg1, int arg2) {
Log.i(LOG_TAG, "Replace ctx.startActivityForResult() with cordova.startActivityForResult()");
this.cordova.startActivityForResult(arg0, arg1, arg2);
}
Expand Down
2 changes: 1 addition & 1 deletion framework/src/org/apache/cordova/api/Plugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Licensed to the Apache Software Foundation (ASF) under one
*
* The execute method is called by the PluginManager.
*/
public abstract class Plugin implements IPlugin {
public abstract class Plugin {

public String id;
public CordovaWebView webView; // WebView object
Expand Down
8 changes: 4 additions & 4 deletions framework/src/org/apache/cordova/api/PluginEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class PluginEntry {
* Plugin objects are only created when they are called from JavaScript. (see PluginManager.exec)
* The exception is if the onload flag is set, then they are created when PluginManager is initialized.
*/
public IPlugin plugin = null;
public Plugin plugin = null;

/**
* Flag that indicates the plugin object should be created when PluginManager is initialized.
Expand All @@ -69,15 +69,15 @@ public PluginEntry(String service, String pluginClass, boolean onload) {
*
* @return The plugin object
*/
public IPlugin createPlugin(CordovaWebView webView, CordovaInterface ctx) {
public Plugin createPlugin(CordovaWebView webView, CordovaInterface ctx) {
if (this.plugin != null) {
return this.plugin;
}
try {
@SuppressWarnings("rawtypes")
Class c = getClassByName(this.pluginClass);
if (isCordovaPlugin(c)) {
this.plugin = (IPlugin) c.newInstance();
this.plugin = (Plugin) c.newInstance();
this.plugin.setContext(ctx);
this.plugin.setView(webView);
return plugin;
Expand Down Expand Up @@ -115,7 +115,7 @@ private Class getClassByName(final String clazz) throws ClassNotFoundException {
@SuppressWarnings("rawtypes")
private boolean isCordovaPlugin(Class c) {
if (c != null) {
return org.apache.cordova.api.Plugin.class.isAssignableFrom(c) || org.apache.cordova.api.IPlugin.class.isAssignableFrom(c);
return org.apache.cordova.api.Plugin.class.isAssignableFrom(c) || org.apache.cordova.api.Plugin.class.isAssignableFrom(c);
}
return false;
}
Expand Down
10 changes: 5 additions & 5 deletions framework/src/org/apache/cordova/api/PluginManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public void startupPlugins() {
*/
public boolean exec(final String service, final String action, final String callbackId, final String jsonArgs) {
PluginResult cr = null;
final IPlugin plugin = this.getPlugin(service);
final Plugin plugin = this.getPlugin(service);
boolean runAsync = !plugin.isSynch(action);
try {
final JSONArray args = new JSONArray(jsonArgs);
Expand Down Expand Up @@ -273,14 +273,14 @@ public boolean exec(String service, String action, String callbackId, String jso
* If the service doesn't exist, then return null.
*
* @param service The name of the service.
* @return IPlugin or null
* @return Plugin or null
*/
private IPlugin getPlugin(String service) {
private Plugin getPlugin(String service) {
PluginEntry entry = this.entries.get(service);
if (entry == null) {
return null;
}
IPlugin plugin = entry.plugin;
Plugin plugin = entry.plugin;
if (plugin == null) {
plugin = entry.createPlugin(this.app, this.ctx);
}
Expand Down Expand Up @@ -403,7 +403,7 @@ public boolean onOverrideUrlLoading(String url) {
public void onReset() {
Iterator<PluginEntry> it = this.entries.values().iterator();
while (it.hasNext()) {
IPlugin plugin = it.next().plugin;
Plugin plugin = it.next().plugin;
if (plugin != null) {
plugin.onReset();
}
Expand Down

0 comments on commit ec3c5b2

Please sign in to comment.