mirror of
https://github.com/apache/cordova-android.git
synced 2025-03-16 08:21:04 +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
|
* @param action The action to execute
|
||||||
* @return T=returns value
|
* @return T=returns value
|
||||||
*/
|
*/
|
||||||
public boolean hasReturnValue(String action) {
|
public boolean isSynch(String action) {
|
||||||
if (action.equals("getStatus")) {
|
if (action.equals("getStatus")) {
|
||||||
return true;
|
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
|
* @param action The action to execute
|
||||||
* @return T=returns value
|
* @return T=returns value
|
||||||
*/
|
*/
|
||||||
public boolean hasReturnValue(String action) {
|
public boolean isSynch(String action) {
|
||||||
if (action.equals("getCurrentPositionAudio")) {
|
if (action.equals("getCurrentPositionAudio")) {
|
||||||
return true;
|
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
|
* @param action The action to execute
|
||||||
* @return T=returns value
|
* @return T=returns value
|
||||||
*/
|
*/
|
||||||
public boolean hasReturnValue(String action) {
|
public boolean isSynch(String action) {
|
||||||
return false;
|
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
|
* @param action The action to execute
|
||||||
* @return T=returns value
|
* @return T=returns value
|
||||||
*/
|
*/
|
||||||
public boolean hasReturnValue(String action) {
|
public boolean isSynch(String action) {
|
||||||
if (action.equals("getStatus")) {
|
if (action.equals("getStatus")) {
|
||||||
return true;
|
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
|
* @param action The action to execute
|
||||||
* @return T=returns value
|
* @return T=returns value
|
||||||
*/
|
*/
|
||||||
public boolean hasReturnValue(String action) {
|
public boolean isSynch(String action) {
|
||||||
return false;
|
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
|
* @param action The action to execute
|
||||||
* @return T=returns value
|
* @return T=returns value
|
||||||
*/
|
*/
|
||||||
public boolean hasReturnValue(String action) {
|
public boolean isSynch(String action) {
|
||||||
return false;
|
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
|
* @param action The action to execute
|
||||||
* @return T=returns value
|
* @return T=returns value
|
||||||
*/
|
*/
|
||||||
public boolean hasReturnValue(String action) {
|
public boolean isSynch(String action) {
|
||||||
return false;
|
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
|
* @param action The action to execute
|
||||||
* @return T=returns value
|
* @return T=returns value
|
||||||
*/
|
*/
|
||||||
public boolean hasReturnValue(String action) {
|
public boolean isSynch(String action) {
|
||||||
// All methods take a while, so always use async
|
// All methods take a while, so always use async
|
||||||
return false;
|
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
|
* @param action The action to execute
|
||||||
* @return T=returns value
|
* @return T=returns value
|
||||||
*/
|
*/
|
||||||
public boolean hasReturnValue(String action) {
|
public boolean isSynch(String action) {
|
||||||
return false;
|
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
|
* @param action The action to execute
|
||||||
* @return T=returns value
|
* @return T=returns value
|
||||||
*/
|
*/
|
||||||
public boolean hasReturnValue(String action) {
|
public boolean isSynch(String action) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,12 +24,12 @@ public interface Plugin {
|
|||||||
PluginResult execute(String action, JSONArray args);
|
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
|
* @param action The action to execute
|
||||||
* @return T=returns value
|
* @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
|
* 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) {
|
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+")");
|
System.out.println("PluginManager.exec("+service+", "+action+", "+callbackId+", "+jsonArgs+", "+async+")");
|
||||||
PluginResult cr = null;
|
PluginResult cr = null;
|
||||||
boolean noReturnValue = async;
|
boolean runAsync = async;
|
||||||
try {
|
try {
|
||||||
final JSONArray args = new JSONArray(jsonArgs);
|
final JSONArray args = new JSONArray(jsonArgs);
|
||||||
String clazz = this.services.get(service);
|
String clazz = this.services.get(service);
|
||||||
@ -71,8 +71,8 @@ public final class PluginManager {
|
|||||||
if ((c == null) || isPhoneGapPlugin(c)) {
|
if ((c == null) || isPhoneGapPlugin(c)) {
|
||||||
final Plugin plugin = this.addPlugin(clazz);
|
final Plugin plugin = this.addPlugin(clazz);
|
||||||
final DroidGap ctx = this.ctx;
|
final DroidGap ctx = this.ctx;
|
||||||
noReturnValue = async && !plugin.hasReturnValue(action);
|
runAsync = async && !plugin.isSynch(action);
|
||||||
if (async && !plugin.hasReturnValue(action)) {
|
if (async && !plugin.isSynch(action)) {
|
||||||
// Run this on a different thread so that this one can return back to JS
|
// Run this on a different thread so that this one can return back to JS
|
||||||
Thread thread = new Thread(new Runnable() {
|
Thread thread = new Thread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -100,7 +100,7 @@ public final class PluginManager {
|
|||||||
cr = new PluginResult(PluginResult.Status.JSON_EXCEPTION);
|
cr = new PluginResult(PluginResult.Status.JSON_EXCEPTION);
|
||||||
}
|
}
|
||||||
// if async we have already returned at this point unless there was an error...
|
// if async we have already returned at this point unless there was an error...
|
||||||
if (noReturnValue) {
|
if (runAsync) {
|
||||||
ctx.sendJavascript(cr.toErrorCallbackString(callbackId));
|
ctx.sendJavascript(cr.toErrorCallbackString(callbackId));
|
||||||
}
|
}
|
||||||
if (cr != null) {
|
if (cr != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user