mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 15:12:51 +08:00
Change hasReturnValue to isSynch to be more accurate about purpose of method.
This commit is contained in:
parent
e4d1087b72
commit
1c0de5ad8d
@ -145,12 +145,12 @@ public class AccelListener implements SensorEventListener, Plugin{
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifies if action to be executed returns a value.
|
||||
* Identifies if action to be executed returns a value and should be run synchronously.
|
||||
*
|
||||
* @param action The action to execute
|
||||
* @return T=returns value
|
||||
*/
|
||||
public boolean hasReturnValue(String action) {
|
||||
public boolean isSynch(String action) {
|
||||
if (action.equals("getStatus")) {
|
||||
return true;
|
||||
}
|
||||
|
@ -103,12 +103,12 @@ public class AudioHandler implements Plugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifies if action to be executed returns a value.
|
||||
* Identifies if action to be executed returns a value and should be run synchronously.
|
||||
*
|
||||
* @param action The action to execute
|
||||
* @return T=returns value
|
||||
*/
|
||||
public boolean hasReturnValue(String action) {
|
||||
public boolean isSynch(String action) {
|
||||
if (action.equals("getCurrentPositionAudio")) {
|
||||
return true;
|
||||
}
|
||||
|
@ -84,12 +84,12 @@ public class CameraLauncher implements Plugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifies if action to be executed returns a value.
|
||||
* Identifies if action to be executed returns a value and should be run synchronously.
|
||||
*
|
||||
* @param action The action to execute
|
||||
* @return T=returns value
|
||||
*/
|
||||
public boolean hasReturnValue(String action) {
|
||||
public boolean isSynch(String action) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -124,12 +124,12 @@ public class CompassListener implements SensorEventListener, Plugin{
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifies if action to be executed returns a value.
|
||||
* Identifies if action to be executed returns a value and should be run synchronously.
|
||||
*
|
||||
* @param action The action to execute
|
||||
* @return T=returns value
|
||||
*/
|
||||
public boolean hasReturnValue(String action) {
|
||||
public boolean isSynch(String action) {
|
||||
if (action.equals("getStatus")) {
|
||||
return true;
|
||||
}
|
||||
|
@ -84,12 +84,12 @@ public class ContactManager implements Plugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifies if action to be executed returns a value.
|
||||
* Identifies if action to be executed returns a value and should be run synchronously.
|
||||
*
|
||||
* @param action The action to execute
|
||||
* @return T=returns value
|
||||
*/
|
||||
public boolean hasReturnValue(String action) {
|
||||
public boolean isSynch(String action) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -65,12 +65,12 @@ public class CryptoHandler implements Plugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifies if action to be executed returns a value.
|
||||
* Identifies if action to be executed returns a value and should be run synchronously.
|
||||
*
|
||||
* @param action The action to execute
|
||||
* @return T=returns value
|
||||
*/
|
||||
public boolean hasReturnValue(String action) {
|
||||
public boolean isSynch(String action) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -81,12 +81,12 @@ public class GeoBroker implements Plugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifies if action to be executed returns a value.
|
||||
* Identifies if action to be executed returns a value and should be run synchronously.
|
||||
*
|
||||
* @param action The action to execute
|
||||
* @return T=returns value
|
||||
*/
|
||||
public boolean hasReturnValue(String action) {
|
||||
public boolean isSynch(String action) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -77,12 +77,12 @@ public class NetworkManager implements Plugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifies if action to be executed returns a value.
|
||||
* Identifies if action to be executed returns a value and should be run synchronously.
|
||||
*
|
||||
* @param action The action to execute
|
||||
* @return T=returns value
|
||||
*/
|
||||
public boolean hasReturnValue(String action) {
|
||||
public boolean isSynch(String action) {
|
||||
// All methods take a while, so always use async
|
||||
return false;
|
||||
}
|
||||
|
@ -83,12 +83,12 @@ public class Storage implements Plugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifies if action to be executed returns a value.
|
||||
* Identifies if action to be executed returns a value and should be run synchronously.
|
||||
*
|
||||
* @param action The action to execute
|
||||
* @return T=returns value
|
||||
*/
|
||||
public boolean hasReturnValue(String action) {
|
||||
public boolean isSynch(String action) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -71,12 +71,12 @@ public class TempListener implements SensorEventListener, Plugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifies if action to be executed returns a value.
|
||||
* Identifies if action to be executed returns a value and should be run synchronously.
|
||||
*
|
||||
* @param action The action to execute
|
||||
* @return T=returns value
|
||||
*/
|
||||
public boolean hasReturnValue(String action) {
|
||||
public boolean isSynch(String action) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -24,12 +24,12 @@ public interface Plugin {
|
||||
PluginResult execute(String action, JSONArray args);
|
||||
|
||||
/**
|
||||
* Identifies if action to be executed returns a value.
|
||||
* Identifies if action to be executed returns a value and should be run synchronously.
|
||||
*
|
||||
* @param action The action to execute
|
||||
* @return T=returns value
|
||||
*/
|
||||
public boolean hasReturnValue(String action);
|
||||
public boolean isSynch(String action);
|
||||
|
||||
/**
|
||||
* Sets the context of the Plugin. This can then be used to do things like
|
||||
|
@ -60,7 +60,7 @@ public final class PluginManager {
|
||||
public String exec(final String service, final String action, final String callbackId, final String jsonArgs, final boolean async) {
|
||||
System.out.println("PluginManager.exec("+service+", "+action+", "+callbackId+", "+jsonArgs+", "+async+")");
|
||||
PluginResult cr = null;
|
||||
boolean noReturnValue = async;
|
||||
boolean runAsync = async;
|
||||
try {
|
||||
final JSONArray args = new JSONArray(jsonArgs);
|
||||
String clazz = this.services.get(service);
|
||||
@ -71,8 +71,8 @@ public final class PluginManager {
|
||||
if ((c == null) || isPhoneGapPlugin(c)) {
|
||||
final Plugin plugin = this.addPlugin(clazz);
|
||||
final DroidGap ctx = this.ctx;
|
||||
noReturnValue = async && !plugin.hasReturnValue(action);
|
||||
if (async && !plugin.hasReturnValue(action)) {
|
||||
runAsync = async && !plugin.isSynch(action);
|
||||
if (async && !plugin.isSynch(action)) {
|
||||
// Run this on a different thread so that this one can return back to JS
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
@ -100,7 +100,7 @@ public final class PluginManager {
|
||||
cr = new PluginResult(PluginResult.Status.JSON_EXCEPTION);
|
||||
}
|
||||
// if async we have already returned at this point unless there was an error...
|
||||
if (noReturnValue) {
|
||||
if (runAsync) {
|
||||
ctx.sendJavascript(cr.toErrorCallbackString(callbackId));
|
||||
}
|
||||
if (cr != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user