From 1c0de5ad8d59cfae4cb06531817c2a7f36b621f2 Mon Sep 17 00:00:00 2001 From: Bryce Curtis Date: Mon, 13 Sep 2010 11:01:44 -0500 Subject: [PATCH] Change hasReturnValue to isSynch to be more accurate about purpose of method. --- framework/src/com/phonegap/AccelListener.java | 4 ++-- framework/src/com/phonegap/AudioHandler.java | 4 ++-- framework/src/com/phonegap/CameraLauncher.java | 4 ++-- framework/src/com/phonegap/CompassListener.java | 4 ++-- framework/src/com/phonegap/ContactManager.java | 4 ++-- framework/src/com/phonegap/CryptoHandler.java | 4 ++-- framework/src/com/phonegap/GeoBroker.java | 4 ++-- framework/src/com/phonegap/NetworkManager.java | 4 ++-- framework/src/com/phonegap/Storage.java | 4 ++-- framework/src/com/phonegap/TempListener.java | 4 ++-- framework/src/com/phonegap/api/Plugin.java | 4 ++-- framework/src/com/phonegap/api/PluginManager.java | 8 ++++---- 12 files changed, 26 insertions(+), 26 deletions(-) diff --git a/framework/src/com/phonegap/AccelListener.java b/framework/src/com/phonegap/AccelListener.java index 8d26812cb..8896f0181 100755 --- a/framework/src/com/phonegap/AccelListener.java +++ b/framework/src/com/phonegap/AccelListener.java @@ -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; } diff --git a/framework/src/com/phonegap/AudioHandler.java b/framework/src/com/phonegap/AudioHandler.java index 8b66ea1be..e2ca4b83b 100755 --- a/framework/src/com/phonegap/AudioHandler.java +++ b/framework/src/com/phonegap/AudioHandler.java @@ -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; } diff --git a/framework/src/com/phonegap/CameraLauncher.java b/framework/src/com/phonegap/CameraLauncher.java index b22f6e07b..921830008 100755 --- a/framework/src/com/phonegap/CameraLauncher.java +++ b/framework/src/com/phonegap/CameraLauncher.java @@ -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; } diff --git a/framework/src/com/phonegap/CompassListener.java b/framework/src/com/phonegap/CompassListener.java index 6820b322a..2f3bf549f 100755 --- a/framework/src/com/phonegap/CompassListener.java +++ b/framework/src/com/phonegap/CompassListener.java @@ -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; } diff --git a/framework/src/com/phonegap/ContactManager.java b/framework/src/com/phonegap/ContactManager.java index 448995395..82cc56445 100755 --- a/framework/src/com/phonegap/ContactManager.java +++ b/framework/src/com/phonegap/ContactManager.java @@ -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; } diff --git a/framework/src/com/phonegap/CryptoHandler.java b/framework/src/com/phonegap/CryptoHandler.java index 31dbca3da..96ca274aa 100755 --- a/framework/src/com/phonegap/CryptoHandler.java +++ b/framework/src/com/phonegap/CryptoHandler.java @@ -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; } diff --git a/framework/src/com/phonegap/GeoBroker.java b/framework/src/com/phonegap/GeoBroker.java index 0877495b1..0ea4645af 100644 --- a/framework/src/com/phonegap/GeoBroker.java +++ b/framework/src/com/phonegap/GeoBroker.java @@ -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; } diff --git a/framework/src/com/phonegap/NetworkManager.java b/framework/src/com/phonegap/NetworkManager.java index 9967fde96..caf6efbad 100755 --- a/framework/src/com/phonegap/NetworkManager.java +++ b/framework/src/com/phonegap/NetworkManager.java @@ -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; } diff --git a/framework/src/com/phonegap/Storage.java b/framework/src/com/phonegap/Storage.java index f6cbb0a67..46a8c63c4 100644 --- a/framework/src/com/phonegap/Storage.java +++ b/framework/src/com/phonegap/Storage.java @@ -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; } diff --git a/framework/src/com/phonegap/TempListener.java b/framework/src/com/phonegap/TempListener.java index d7e7d69aa..5b79d3ab7 100644 --- a/framework/src/com/phonegap/TempListener.java +++ b/framework/src/com/phonegap/TempListener.java @@ -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; } diff --git a/framework/src/com/phonegap/api/Plugin.java b/framework/src/com/phonegap/api/Plugin.java index 05ee7efd1..78a97ca3d 100755 --- a/framework/src/com/phonegap/api/Plugin.java +++ b/framework/src/com/phonegap/api/Plugin.java @@ -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 diff --git a/framework/src/com/phonegap/api/PluginManager.java b/framework/src/com/phonegap/api/PluginManager.java index ac12ee6f3..00b1358cd 100755 --- a/framework/src/com/phonegap/api/PluginManager.java +++ b/framework/src/com/phonegap/api/PluginManager.java @@ -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) {