diff --git a/framework/src/com/phonegap/AccelListener.java b/framework/src/com/phonegap/AccelListener.java index b24261d0..2b3eb0ba 100755 --- a/framework/src/com/phonegap/AccelListener.java +++ b/framework/src/com/phonegap/AccelListener.java @@ -14,14 +14,12 @@ import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.content.Context; -import android.content.Intent; -import android.webkit.WebView; /** * This class listens to the accelerometer sensor and stores the latest * acceleration values x,y,z. */ -public class AccelListener implements SensorEventListener, Plugin { +public class AccelListener extends Plugin implements SensorEventListener { public static int STOPPED = 0; public static int STARTING = 1; @@ -29,9 +27,6 @@ public class AccelListener implements SensorEventListener, Plugin { public static int ERROR_FAILED_TO_START = 3; public float TIMEOUT = 30000; // Timeout in msec to shut off listener - - WebView webView; // WebView object - DroidGap ctx; // DroidGap object float x,y,z; // most recent acceleration values long timestamp; // time of most recent value @@ -59,20 +54,10 @@ public class AccelListener implements SensorEventListener, Plugin { * @param ctx The context of the main Activity. */ public void setContext(DroidGap ctx) { - this.ctx = ctx; + super.setContext(ctx); this.sensorManager = (SensorManager) ctx.getSystemService(Context.SENSOR_SERVICE); } - /** - * Sets the main View of the application, this is the WebView within which - * a PhoneGap app runs. - * - * @param webView The PhoneGap WebView - */ - public void setView(WebView webView) { - this.webView = webView; - } - /** * Executes the request and returns CommandResult. * @@ -171,18 +156,6 @@ public class AccelListener implements SensorEventListener, Plugin { } return false; } - - /** - * Called when the system is about to start resuming a previous activity. - */ - public void onPause() { - } - - /** - * Called when the activity will start interacting with the user. - */ - public void onResume() { - } /** * Called by AccelBroker when listener is to be shut down. @@ -192,18 +165,6 @@ public class AccelListener implements SensorEventListener, Plugin { this.stop(); } - /** - * Called when an activity you launched exits, giving you the requestCode you started it with, - * the resultCode it returned, and any additional data from it. - * - * @param requestCode The request code originally supplied to startActivityForResult(), - * allowing you to identify who this result came from. - * @param resultCode The integer result code returned by the child activity through its setResult(). - * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). - */ - public void onActivityResult(int requestCode, int resultCode, Intent intent) { - } - //-------------------------------------------------------------------------- // LOCAL METHODS //-------------------------------------------------------------------------- diff --git a/framework/src/com/phonegap/AudioHandler.java b/framework/src/com/phonegap/AudioHandler.java index e2ca4b83..1d0717cc 100755 --- a/framework/src/com/phonegap/AudioHandler.java +++ b/framework/src/com/phonegap/AudioHandler.java @@ -7,13 +7,10 @@ import org.json.JSONArray; import org.json.JSONException; import com.phonegap.api.Plugin; -import com.phonegap.api.PluginManager; import com.phonegap.api.PluginResult; import android.content.Context; -import android.content.Intent; import android.media.AudioManager; -import android.webkit.WebView; /** * This class called by DroidGap to play and record audio. @@ -26,10 +23,7 @@ import android.webkit.WebView; * android_asset: file name must start with /android_asset/sound.mp3 * sdcard: file name is just sound.mp3 */ -public class AudioHandler implements Plugin { - - WebView webView; // WebView object - DroidGap ctx; // DroidGap object +public class AudioHandler extends Plugin { HashMap players; // Audio player object @@ -40,26 +34,6 @@ public class AudioHandler implements Plugin { this.players = new HashMap(); } - /** - * Sets the context of the Command. This can then be used to do things like - * get file paths associated with the Activity. - * - * @param ctx The context of the main Activity. - */ - public void setContext(DroidGap ctx) { - this.ctx = ctx; - } - - /** - * Sets the main View of the application, this is the WebView within which - * a PhoneGap app runs. - * - * @param webView The PhoneGap WebView - */ - public void setView(WebView webView) { - this.webView = webView; - } - /** * Executes the request and returns CommandResult. * @@ -118,18 +92,6 @@ public class AudioHandler implements Plugin { return false; } - /** - * Called when the system is about to start resuming a previous activity. - */ - public void onPause() { - } - - /** - * Called when the activity will start interacting with the user. - */ - public void onResume() { - } - /** * Stop all audio players and recorders. */ @@ -144,18 +106,6 @@ public class AudioHandler implements Plugin { this.players.clear(); } - /** - * Called when an activity you launched exits, giving you the requestCode you started it with, - * the resultCode it returned, and any additional data from it. - * - * @param requestCode The request code originally supplied to startActivityForResult(), - * allowing you to identify who this result came from. - * @param resultCode The integer result code returned by the child activity through its setResult(). - * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). - */ - public void onActivityResult(int requestCode, int resultCode, Intent intent) { - } - //-------------------------------------------------------------------------- // LOCAL METHODS //-------------------------------------------------------------------------- diff --git a/framework/src/com/phonegap/AudioPlayer.java b/framework/src/com/phonegap/AudioPlayer.java index 36aa62f9..48a58004 100755 --- a/framework/src/com/phonegap/AudioPlayer.java +++ b/framework/src/com/phonegap/AudioPlayer.java @@ -95,7 +95,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On public void startRecording(String file) { if (this.mPlayer != null) { System.out.println("AudioPlayer Error: Can't record in play mode."); - this.handler.ctx.sendJavascript("PhoneGap.Media.onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERROR_PLAY_MODE_SET+");"); + this.handler.sendJavascript("PhoneGap.Media.onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERROR_PLAY_MODE_SET+");"); } // Make sure we're not already recording @@ -116,11 +116,11 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On } catch (IOException e) { e.printStackTrace(); } - this.handler.ctx.sendJavascript("PhoneGap.Media.onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERROR_STARTING_RECORDING+");"); + this.handler.sendJavascript("PhoneGap.Media.onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERROR_STARTING_RECORDING+");"); } else { System.out.println("AudioPlayer Error: Already recording."); - this.handler.ctx.sendJavascript("PhoneGap.Media.onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERROR_ALREADY_RECORDING+");"); + this.handler.sendJavascript("PhoneGap.Media.onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERROR_ALREADY_RECORDING+");"); } } @@ -162,7 +162,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On public void startPlaying(String file) { if (this.recorder != null) { System.out.println("AudioPlayer Error: Can't play in record mode."); - this.handler.ctx.sendJavascript("PhoneGap.Media.onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERROR_RECORD_MODE_SET+");"); + this.handler.sendJavascript("PhoneGap.Media.onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERROR_RECORD_MODE_SET+");"); } // If this is a new request to play audio, or stopped @@ -205,7 +205,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On } catch (Exception e) { e.printStackTrace(); - this.handler.ctx.sendJavascript("PhoneGap.Media.onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERROR_STARTING_PLAYBACK+");"); + this.handler.sendJavascript("PhoneGap.Media.onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERROR_STARTING_PLAYBACK+");"); } } @@ -219,7 +219,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On } else { System.out.println("AudioPlayer Error: startPlaying() called during invalid state: "+this.state); - this.handler.ctx.sendJavascript("PhoneGap.Media.onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERROR_RESUME_STATE+");"); + this.handler.sendJavascript("PhoneGap.Media.onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERROR_RESUME_STATE+");"); } } } @@ -236,7 +236,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On } else { System.out.println("AudioPlayer Error: pausePlaying() called during invalid state: "+this.state); - this.handler.ctx.sendJavascript("PhoneGap.Media.onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERROR_PAUSE_STATE+");"); + this.handler.sendJavascript("PhoneGap.Media.onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERROR_PAUSE_STATE+");"); } } @@ -250,7 +250,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On } else { System.out.println("AudioPlayer Error: stopPlaying() called during invalid state: "+this.state); - this.handler.ctx.sendJavascript("PhoneGap.Media.onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERROR_STOP_STATE+");"); + this.handler.sendJavascript("PhoneGap.Media.onStatus('" + this.id + "', "+MEDIA_ERROR+", "+MEDIA_ERROR_STOP_STATE+");"); } } @@ -348,7 +348,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On this.prepareOnly = false; // Send status notification to JavaScript - this.handler.ctx.sendJavascript("PhoneGap.Media.onStatus('" + this.id + "', "+MEDIA_DURATION+","+this.duration+");"); + this.handler.sendJavascript("PhoneGap.Media.onStatus('" + this.id + "', "+MEDIA_DURATION+","+this.duration+");"); } @@ -368,7 +368,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On this.mPlayer.release(); // Send error notification to JavaScript - this.handler.ctx.sendJavascript("PhoneGap.Media.onStatus('" + this.id + "', "+MEDIA_ERROR+", "+arg1+");"); + this.handler.sendJavascript("PhoneGap.Media.onStatus('" + this.id + "', "+MEDIA_ERROR+", "+arg1+");"); return false; } @@ -379,7 +379,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On */ private void setState(int state) { if (this.state != state) { - this.handler.ctx.sendJavascript("PhoneGap.Media.onStatus('" + this.id + "', "+MEDIA_STATE+", "+this.state+");"); + this.handler.sendJavascript("PhoneGap.Media.onStatus('" + this.id + "', "+MEDIA_STATE+", "+state+");"); } this.state = state; diff --git a/framework/src/com/phonegap/CameraLauncher.java b/framework/src/com/phonegap/CameraLauncher.java index cb05721b..8f885f10 100755 --- a/framework/src/com/phonegap/CameraLauncher.java +++ b/framework/src/com/phonegap/CameraLauncher.java @@ -20,7 +20,6 @@ import android.graphics.Bitmap; import android.graphics.Bitmap.CompressFormat; import android.net.Uri; import android.os.Environment; -import android.webkit.WebView; import android.provider.MediaStore; /** @@ -28,7 +27,7 @@ import android.provider.MediaStore; * and returns the captured image. When the camera view is closed, the screen displayed before * the camera view was shown is redisplayed. */ -public class CameraLauncher implements Plugin { +public class CameraLauncher extends Plugin { private static final int DATA_URL = 0; // Return base64 encoded string private static final int FILE_URI = 1; // Return file uri (content://media/external/images/media/2 for Android) @@ -37,9 +36,6 @@ public class CameraLauncher implements Plugin { private static final int CAMERA = 1; // Take picture from camera private static final int SAVEDPHOTOALBUM = 2; // Choose image from picture library (same as PHOTOLIBRARY for Android) - WebView webView; // WebView object - DroidGap ctx; // DroidGap object - private int mQuality; // Compression quality hint (0-100: 0=low quality & high compression, 100=compress of max quality) private Uri imageUri; // Uri of captured image @@ -49,26 +45,6 @@ public class CameraLauncher implements Plugin { public CameraLauncher() { } - /** - * Sets the context of the Command. This can then be used to do things like - * get file paths associated with the Activity. - * - * @param ctx The context of the main Activity. - */ - public void setContext(DroidGap ctx) { - this.ctx = ctx; - } - - /** - * Sets the main View of the application, this is the WebView within which - * a PhoneGap app runs. - * - * @param webView The PhoneGap WebView - */ - public void setView(WebView webView) { - this.webView = webView; - } - /** * Executes the request and returns CommandResult. * @@ -103,35 +79,6 @@ public class CameraLauncher implements Plugin { return new PluginResult(PluginResult.Status.JSON_EXCEPTION); } } - - /** - * 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 isSynch(String action) { - return false; - } - - /** - * Called when the system is about to start resuming a previous activity. - */ - public void onPause() { - } - - /** - * Called when the activity will start interacting with the user. - */ - public void onResume() { - } - - /** - * Called by AccelBroker when listener is to be shut down. - * Stop listener. - */ - public void onDestroy() { - } //-------------------------------------------------------------------------- // LOCAL METHODS @@ -235,7 +182,7 @@ public class CameraLauncher implements Plugin { os.close(); // Send Uri back to JavaScript for viewing image - this.ctx.sendJavascript("navigator.camera.success('" + uri.toString() + "');"); + this.sendJavascript("navigator.camera.success('" + uri.toString() + "');"); } } catch (IOException e) { e.printStackTrace(); @@ -272,7 +219,7 @@ public class CameraLauncher implements Plugin { // If sending filename back else if (destType == FILE_URI) { - this.ctx.sendJavascript("navigator.camera.success('" + uri + "');"); + this.sendJavascript("navigator.camera.success('" + uri + "');"); } } else if (resultCode == Activity.RESULT_CANCELED) { @@ -296,7 +243,7 @@ public class CameraLauncher implements Plugin { byte[] code = jpeg_data.toByteArray(); byte[] output = Base64.encodeBase64(code); String js_out = new String(output); - this.ctx.sendJavascript("navigator.camera.success('" + js_out + "');"); + this.sendJavascript("navigator.camera.success('" + js_out + "');"); } } catch(Exception e) { @@ -310,6 +257,6 @@ public class CameraLauncher implements Plugin { * @param err */ public void failPicture(String err) { - this.ctx.sendJavascript("navigator.camera.error('" + err + "');"); + this.sendJavascript("navigator.camera.error('" + err + "');"); } } diff --git a/framework/src/com/phonegap/CompassListener.java b/framework/src/com/phonegap/CompassListener.java index 6ff6efe1..90f5ca3d 100755 --- a/framework/src/com/phonegap/CompassListener.java +++ b/framework/src/com/phonegap/CompassListener.java @@ -13,13 +13,11 @@ import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.content.Context; -import android.content.Intent; -import android.webkit.WebView; /** * This class listens to the compass sensor and stores the latest heading value. */ -public class CompassListener implements SensorEventListener, Plugin{ +public class CompassListener extends Plugin implements SensorEventListener { public static int STOPPED = 0; public static int STARTING = 1; @@ -28,9 +26,6 @@ public class CompassListener implements SensorEventListener, Plugin{ public long TIMEOUT = 30000; // Timeout in msec to shut off listener - WebView webView; // WebView object - DroidGap ctx; // DroidGap object - int status; // status of listener float heading; // most recent heading value long timeStamp; // time of most recent value @@ -54,20 +49,10 @@ public class CompassListener implements SensorEventListener, Plugin{ * @param ctx The context of the main Activity. */ public void setContext(DroidGap ctx) { - this.ctx = ctx; + super.setContext(ctx); this.sensorManager = (SensorManager) ctx.getSystemService(Context.SENSOR_SERVICE); } - /** - * Sets the main View of the application, this is the WebView within which - * a PhoneGap app runs. - * - * @param webView The PhoneGap WebView - */ - public void setView(WebView webView) { - this.webView = webView; - } - /** * Executes the request and returns CommandResult. * @@ -149,18 +134,6 @@ public class CompassListener implements SensorEventListener, Plugin{ } return false; } - - /** - * Called when the system is about to start resuming a previous activity. - */ - public void onPause() { - } - - /** - * Called when the activity will start interacting with the user. - */ - public void onResume() { - } /** * Called when listener is to be shut down and object is being destroyed. @@ -169,18 +142,6 @@ public class CompassListener implements SensorEventListener, Plugin{ this.stop(); } - /** - * Called when an activity you launched exits, giving you the requestCode you started it with, - * the resultCode it returned, and any additional data from it. - * - * @param requestCode The request code originally supplied to startActivityForResult(), - * allowing you to identify who this result came from. - * @param resultCode The integer result code returned by the child activity through its setResult(). - * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). - */ - public void onActivityResult(int requestCode, int resultCode, Intent intent) { - } - //-------------------------------------------------------------------------- // LOCAL METHODS //-------------------------------------------------------------------------- diff --git a/framework/src/com/phonegap/ContactManager.java b/framework/src/com/phonegap/ContactManager.java index 3d3bb7e4..921c3bc2 100755 --- a/framework/src/com/phonegap/ContactManager.java +++ b/framework/src/com/phonegap/ContactManager.java @@ -3,20 +3,13 @@ package com.phonegap; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; - import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; - import android.util.Log; -import android.webkit.WebView; -import android.content.Intent; -public class ContactManager implements Plugin { +public class ContactManager extends Plugin { private static ContactAccessor contactAccessor; - WebView webView; // WebView object - DroidGap ctx; // DroidGap object - private static final String LOG_TAG = "Contact Query"; /** @@ -25,26 +18,6 @@ public class ContactManager implements Plugin { public ContactManager() { } - /** - * Sets the context of the Command. This can then be used to do things like - * get file paths associated with the Activity. - * - * @param ctx The context of the main Activity. - */ - public void setContext(DroidGap ctx) { - this.ctx = ctx; - } - - /** - * Sets the main View of the application, this is the WebView within which - * a PhoneGap app runs. - * - * @param webView The PhoneGap WebView - */ - public void setView(WebView webView) { - this.webView = webView; - } - /** * Executes the request and returns CommandResult. * @@ -83,45 +56,4 @@ public class ContactManager implements Plugin { return new PluginResult(PluginResult.Status.JSON_EXCEPTION); } } - - /** - * 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 isSynch(String action) { - return false; - } - - /** - * Called when the system is about to start resuming a previous activity. - */ - public void onPause() { - } - - /** - * Called when the activity will start interacting with the user. - */ - public void onResume() { - } - - /** - * Called by AccelBroker when listener is to be shut down. - * Stop listener. - */ - public void onDestroy() { - } - - /** - * Called when an activity you launched exits, giving you the requestCode you started it with, - * the resultCode it returned, and any additional data from it. - * - * @param requestCode The request code originally supplied to startActivityForResult(), - * allowing you to identify who this result came from. - * @param resultCode The integer result code returned by the child activity through its setResult(). - * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). - */ - public void onActivityResult(int requestCode, int resultCode, Intent intent) { - } } diff --git a/framework/src/com/phonegap/CryptoHandler.java b/framework/src/com/phonegap/CryptoHandler.java index 96ca274a..bb8061ec 100755 --- a/framework/src/com/phonegap/CryptoHandler.java +++ b/framework/src/com/phonegap/CryptoHandler.java @@ -6,40 +6,14 @@ import org.json.JSONException; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; -import android.content.Intent; -import android.webkit.WebView; - -public class CryptoHandler implements Plugin { - - WebView webView; // WebView object - DroidGap ctx; // DroidGap object - +public class CryptoHandler extends Plugin { + /** * Constructor. */ public CryptoHandler() { } - /** - * Sets the context of the Command. This can then be used to do things like - * get file paths associated with the Activity. - * - * @param ctx The context of the main Activity. - */ - public void setContext(DroidGap ctx) { - this.ctx = ctx; - } - - /** - * Sets the main View of the application, this is the WebView within which - * a PhoneGap app runs. - * - * @param webView The PhoneGap WebView - */ - public void setView(WebView webView) { - this.webView = webView; - } - /** * Executes the request and returns CommandResult. * @@ -64,47 +38,6 @@ public class CryptoHandler implements Plugin { } } - /** - * 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 isSynch(String action) { - return false; - } - - /** - * Called when the system is about to start resuming a previous activity. - */ - public void onPause() { - } - - /** - * Called when the activity will start interacting with the user. - */ - public void onResume() { - } - - /** - * Called by AccelBroker when listener is to be shut down. - * Stop listener. - */ - public void onDestroy() { - } - - /** - * Called when an activity you launched exits, giving you the requestCode you started it with, - * the resultCode it returned, and any additional data from it. - * - * @param requestCode The request code originally supplied to startActivityForResult(), - * allowing you to identify who this result came from. - * @param resultCode The integer result code returned by the child activity through its setResult(). - * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). - */ - public void onActivityResult(int requestCode, int resultCode, Intent intent) { - } - //-------------------------------------------------------------------------- // LOCAL METHODS //-------------------------------------------------------------------------- @@ -113,7 +46,7 @@ public class CryptoHandler implements Plugin { try { String encrypted = SimpleCrypto.encrypt(pass,text); // TODO: Why not just return text now? - this.ctx.sendJavascript("Crypto.gotCryptedString('" + text + "')"); + this.sendJavascript("Crypto.gotCryptedString('" + text + "')"); } catch (Exception e) { e.printStackTrace(); } @@ -122,7 +55,7 @@ public class CryptoHandler implements Plugin { public void decrypt(String pass, String text) { try { String decrypted = SimpleCrypto.decrypt(pass,text); - this.ctx.sendJavascript("Crypto.gotPlainString('" + text + "')"); + this.sendJavascript("Crypto.gotPlainString('" + text + "')"); } catch (Exception e) { e.printStackTrace(); } diff --git a/framework/src/com/phonegap/Device.java b/framework/src/com/phonegap/Device.java index 80c1281b..0c10139a 100755 --- a/framework/src/com/phonegap/Device.java +++ b/framework/src/com/phonegap/Device.java @@ -29,19 +29,14 @@ import org.json.JSONObject; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; import android.content.Context; -import android.content.Intent; import android.provider.Settings; import android.telephony.TelephonyManager; -import android.webkit.WebView; -public class Device implements Plugin { +public class Device extends Plugin { public static String phonegapVersion = "pre-0.92 EDGE"; // PhoneGap version public static String platform = "Android"; // Device OS public static String uuid; // Device UUID - private DroidGap ctx; // DroidGap object - @SuppressWarnings("unused") - private WebView webView; // Webview object /** * Constructor. @@ -56,20 +51,10 @@ public class Device implements Plugin { * @param ctx The context of the main Activity. */ public void setContext(DroidGap ctx) { - this.ctx = ctx; + super.setContext(ctx); Device.uuid = getUuid(); } - /** - * Sets the main View of the application, this is the WebView within which - * a PhoneGap app runs. - * - * @param webView The PhoneGap WebView - */ - public void setView(WebView webView) { - this.webView = webView; - } - /** * Executes the request and returns CommandResult. * @@ -113,37 +98,6 @@ public class Device implements Plugin { return false; } - /** - * Called when the system is about to start resuming a previous activity. - */ - public void onPause() { - } - - /** - * Called when the activity will start interacting with the user. - */ - public void onResume() { - } - - /** - * Called when the activity is to be shut down. - * Stop listener. - */ - public void onDestroy() { - } - - /** - * Called when an activity you launched exits, giving you the requestCode you started it with, - * the resultCode it returned, and any additional data from it. - * - * @param requestCode The request code originally supplied to startActivityForResult(), - * allowing you to identify who this result came from. - * @param resultCode The integer result code returned by the child activity through its setResult(). - * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). - */ - public void onActivityResult(int requestCode, int resultCode, Intent intent) { - } - //-------------------------------------------------------------------------- // LOCAL METHODS //-------------------------------------------------------------------------- diff --git a/framework/src/com/phonegap/DroidGap.java b/framework/src/com/phonegap/DroidGap.java index a861732c..d51a1805 100755 --- a/framework/src/com/phonegap/DroidGap.java +++ b/framework/src/com/phonegap/DroidGap.java @@ -279,8 +279,8 @@ public class DroidGap extends Activity { if (android.os.Build.VERSION.RELEASE.startsWith("1.")) { Package pack = this.getClass().getPackage(); String appPackage = pack.getName(); - Storage cupcakeStorage = (Storage)this.pluginManager.addPlugin("com.phonegap.Storage"); - cupcakeStorage.setStorage(appPackage); + // TODO: Storage cupcakeStorage = (Storage)this.pluginManager.addPlugin("com.phonegap.Storage"); + // TODO: cupcakeStorage.setStorage(appPackage); } diff --git a/framework/src/com/phonegap/FileUtils.java b/framework/src/com/phonegap/FileUtils.java index 598c23e9..71a43376 100755 --- a/framework/src/com/phonegap/FileUtils.java +++ b/framework/src/com/phonegap/FileUtils.java @@ -9,14 +9,11 @@ import org.json.JSONException; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; -import android.content.Intent; -import android.webkit.WebView; - /** * This class provides SD card file and directory services to JavaScript. * Only files on the SD card can be accessed. */ -public class FileUtils implements Plugin { +public class FileUtils extends Plugin { public static int NOT_FOUND_ERR = 8; public static int SECURITY_ERR = 18; @@ -25,10 +22,6 @@ public class FileUtils implements Plugin { public static int NOT_READABLE_ERR = 24; public static int ENCODING_ERR = 26; - - WebView webView; // WebView object - DroidGap ctx; // DroidGap object - FileReader f_in; FileWriter f_out; @@ -39,26 +32,6 @@ public class FileUtils implements Plugin { System.out.println("FileUtils()"); } - /** - * Sets the context of the Command. This can then be used to do things like - * get file paths associated with the Activity. - * - * @param ctx The context of the main Activity. - */ - public void setContext(DroidGap ctx) { - this.ctx = ctx; - } - - /** - * Sets the main View of the application, this is the WebView within which - * a PhoneGap app runs. - * - * @param webView The PhoneGap WebView - */ - public void setView(WebView webView) { - this.webView = webView; - } - /** * Executes the request and returns CommandResult. * @@ -161,37 +134,6 @@ public class FileUtils implements Plugin { return true; } - /** - * Called when the system is about to start resuming a previous activity. - */ - public void onPause() { - } - - /** - * Called when the activity will start interacting with the user. - */ - public void onResume() { - } - - /** - * Called by AccelBroker when listener is to be shut down. - * Stop listener. - */ - public void onDestroy() { - } - - /** - * Called when an activity you launched exits, giving you the requestCode you started it with, - * the resultCode it returned, and any additional data from it. - * - * @param requestCode The request code originally supplied to startActivityForResult(), - * allowing you to identify who this result came from. - * @param resultCode The integer result code returned by the child activity through its setResult(). - * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). - */ - public void onActivityResult(int requestCode, int resultCode, Intent intent) { - } - //-------------------------------------------------------------------------- // LOCAL METHODS //-------------------------------------------------------------------------- diff --git a/framework/src/com/phonegap/GeoBroker.java b/framework/src/com/phonegap/GeoBroker.java index 45281d76..3cd52f1d 100755 --- a/framework/src/com/phonegap/GeoBroker.java +++ b/framework/src/com/phonegap/GeoBroker.java @@ -9,20 +9,14 @@ import org.json.JSONException; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; -import android.content.Intent; -import android.webkit.WebView; - /* * This class is the interface to the Geolocation. It's bound to the geo object. * * This class only starts and stops various GeoListeners, which consist of a GPS and a Network Listener */ -public class GeoBroker implements Plugin { +public class GeoBroker extends Plugin { - WebView webView; // WebView object - DroidGap ctx; // DroidGap object - // List of gGeolocation listeners private HashMap geoListeners; private GeoListener global; @@ -34,26 +28,6 @@ public class GeoBroker implements Plugin { this.geoListeners = new HashMap(); } - /** - * Sets the context of the Command. This can then be used to do things like - * get file paths associated with the Activity. - * - * @param ctx The context of the main Activity. - */ - public void setContext(DroidGap ctx) { - this.ctx = ctx; - } - - /** - * Sets the main View of the application, this is the WebView within which - * a PhoneGap app runs. - * - * @param webView The PhoneGap WebView - */ - public void setView(WebView webView) { - this.webView = webView; - } - /** * Executes the request and returns CommandResult. * @@ -92,18 +66,6 @@ public class GeoBroker implements Plugin { // Starting listeners is easier to run on main thread, so don't run async. return true; } - - /** - * Called when the system is about to start resuming a previous activity. - */ - public void onPause() { - } - - /** - * Called when the activity will start interacting with the user. - */ - public void onResume() { - } /** * Called when the activity is to be shut down. @@ -124,18 +86,6 @@ public class GeoBroker implements Plugin { this.global = null; } - /** - * Called when an activity you launched exits, giving you the requestCode you started it with, - * the resultCode it returned, and any additional data from it. - * - * @param requestCode The request code originally supplied to startActivityForResult(), - * allowing you to identify who this result came from. - * @param resultCode The integer result code returned by the child activity through its setResult(). - * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). - */ - public void onActivityResult(int requestCode, int resultCode, Intent intent) { - } - //-------------------------------------------------------------------------- // LOCAL METHODS //-------------------------------------------------------------------------- @@ -152,7 +102,7 @@ public class GeoBroker implements Plugin { // Create a geolocation listener just for getCurrentLocation and call it "global" if (this.global == null) { - this.global = new GeoListener("global", this.ctx, maximumAge, this.webView); + this.global = new GeoListener(this, "global", maximumAge); } else { this.global.start(maximumAge); @@ -173,7 +123,7 @@ public class GeoBroker implements Plugin { // Make sure this listener doesn't already exist GeoListener listener = geoListeners.get(key); if (listener == null) { - listener = new GeoListener(key, this.ctx, maximumAge, this.webView); + listener = new GeoListener(this, key, maximumAge); geoListeners.put(key, listener); } diff --git a/framework/src/com/phonegap/GeoListener.java b/framework/src/com/phonegap/GeoListener.java index b78f6fb1..90e876a8 100755 --- a/framework/src/com/phonegap/GeoListener.java +++ b/framework/src/com/phonegap/GeoListener.java @@ -17,9 +17,7 @@ public class GeoListener { NetworkListener mNetwork; // Network listener LocationManager mLocMan; // Location manager - private DroidGap ctx; // DroidGap object - @SuppressWarnings("unused") - private WebView mAppView; // Webview object + private GeoBroker broker; // GeoBroker object int interval; @@ -31,24 +29,23 @@ public class GeoListener { * @param time Sampling period in msec * @param appView */ - GeoListener(String id, DroidGap ctx, int time, WebView appView) { + GeoListener(GeoBroker broker, String id, int time) { this.id = id; this.interval = time; - this.ctx = ctx; + this.broker = broker; this.mGps = null; this.mNetwork = null; - this.mLocMan = (LocationManager) ctx.getSystemService(Context.LOCATION_SERVICE); + this.mLocMan = (LocationManager) broker.ctx.getSystemService(Context.LOCATION_SERVICE); // If GPS provider, then create and start GPS listener if (this.mLocMan.getProvider(LocationManager.GPS_PROVIDER) != null) { - this.mGps = new GpsListener(ctx, time, this); + this.mGps = new GpsListener(broker.ctx, time, this); } // If network provider, then create and start network listener if (this.mLocMan.getProvider(LocationManager.NETWORK_PROVIDER) != null) { - this.mNetwork = new NetworkListener(ctx, time, this); + this.mNetwork = new NetworkListener(broker.ctx, time, this); } - this.mAppView = appView; } /** @@ -72,7 +69,7 @@ public class GeoListener { if (id == "global") { this.stop(); } - this.ctx.sendJavascript("navigator._geo.success('" + id + "'," + params + ");"); + this.broker.sendJavascript("navigator._geo.success('" + id + "'," + params + ");"); } /** @@ -82,7 +79,7 @@ public class GeoListener { * @param msg The error message */ void fail(int code, String msg) { - this.ctx.sendJavascript("navigator._geo.fail('" + this.id + "', " + ", " + code + ", '" + msg + "');"); + this.broker.sendJavascript("navigator._geo.fail('" + this.id + "', " + ", " + code + ", '" + msg + "');"); this.stop(); } diff --git a/framework/src/com/phonegap/NetworkManager.java b/framework/src/com/phonegap/NetworkManager.java index 82c75fe5..fa650e7b 100755 --- a/framework/src/com/phonegap/NetworkManager.java +++ b/framework/src/com/phonegap/NetworkManager.java @@ -9,19 +9,13 @@ import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; import android.content.Context; -import android.content.Intent; import android.net.*; -import android.webkit.WebView; -public class NetworkManager implements Plugin { +public class NetworkManager extends Plugin { public static int NOT_REACHABLE = 0; public static int REACHABLE_VIA_CARRIER_DATA_NETWORK = 1; public static int REACHABLE_VIA_WIFI_NETWORK = 2; - - - WebView webView; // WebView object - DroidGap ctx; // DroidGap object ConnectivityManager sockMan; @@ -38,20 +32,10 @@ public class NetworkManager implements Plugin { * @param ctx The context of the main Activity. */ public void setContext(DroidGap ctx) { - this.ctx = ctx; + super.setContext(ctx); this.sockMan = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE); } - /** - * Sets the main View of the application, this is the WebView within which - * a PhoneGap app runs. - * - * @param webView The PhoneGap WebView - */ - public void setView(WebView webView) { - this.webView = webView; - } - /** * Executes the request and returns CommandResult. * @@ -92,37 +76,6 @@ public class NetworkManager implements Plugin { return false; } - /** - * Called when the system is about to start resuming a previous activity. - */ - public void onPause() { - } - - /** - * Called when the activity will start interacting with the user. - */ - public void onResume() { - } - - /** - * Called by AccelBroker when listener is to be shut down. - * Stop listener. - */ - public void onDestroy() { - } - - /** - * Called when an activity you launched exits, giving you the requestCode you started it with, - * the resultCode it returned, and any additional data from it. - * - * @param requestCode The request code originally supplied to startActivityForResult(), - * allowing you to identify who this result came from. - * @param resultCode The integer result code returned by the child activity through its setResult(). - * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). - */ - public void onActivityResult(int requestCode, int resultCode, Intent intent) { - } - //-------------------------------------------------------------------------- // LOCAL METHODS //-------------------------------------------------------------------------- @@ -169,13 +122,13 @@ public class NetworkManager implements Plugin { uri = "http://" + uri; } - if (isAvailable()) { + if (this.isAvailable()) { try { DefaultHttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet(uri); httpclient.execute(httpget); - if (isWifiActive()) { + if (this.isWifiActive()) { reachable = REACHABLE_VIA_WIFI_NETWORK; } else { diff --git a/framework/src/com/phonegap/Notification.java b/framework/src/com/phonegap/Notification.java index 68a18397..c15e9125 100755 --- a/framework/src/com/phonegap/Notification.java +++ b/framework/src/com/phonegap/Notification.java @@ -5,47 +5,22 @@ import org.json.JSONException; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; import android.content.Context; -import android.content.Intent; import android.media.Ringtone; import android.media.RingtoneManager; import android.net.Uri; import android.os.Vibrator; -import android.webkit.WebView; /** * This class provides access to notifications on the device. */ -public class Notification implements Plugin { - - WebView webView; // WebView object - DroidGap ctx; // DroidGap object - +public class Notification extends Plugin { + /** * Constructor. */ public Notification() { } - /** - * Sets the context of the Command. This can then be used to do things like - * get file paths associated with the Activity. - * - * @param ctx The context of the main Activity. - */ - public void setContext(DroidGap ctx) { - this.ctx = ctx; - } - - /** - * Sets the main View of the application, this is the WebView within which - * a PhoneGap app runs. - * - * @param webView The PhoneGap WebView - */ - public void setView(WebView webView) { - this.webView = webView; - } - /** * Executes the request and returns CommandResult. * @@ -80,37 +55,6 @@ public class Notification implements Plugin { return false; } - /** - * Called when the system is about to start resuming a previous activity. - */ - public void onPause() { - } - - /** - * Called when the activity will start interacting with the user. - */ - public void onResume() { - } - - /** - * Called by AccelBroker when listener is to be shut down. - * Stop listener. - */ - public void onDestroy() { - } - - /** - * Called when an activity you launched exits, giving you the requestCode you started it with, - * the resultCode it returned, and any additional data from it. - * - * @param requestCode The request code originally supplied to startActivityForResult(), - * allowing you to identify who this result came from. - * @param resultCode The integer result code returned by the child activity through its setResult(). - * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). - */ - public void onActivityResult(int requestCode, int resultCode, Intent intent) { - } - //-------------------------------------------------------------------------- // LOCAL METHODS //-------------------------------------------------------------------------- diff --git a/framework/src/com/phonegap/Storage.java b/framework/src/com/phonegap/Storage.java index 46a8c63c..fcf16ff0 100644 --- a/framework/src/com/phonegap/Storage.java +++ b/framework/src/com/phonegap/Storage.java @@ -6,18 +6,13 @@ import org.json.JSONException; import com.phonegap.api.Plugin; import com.phonegap.api.PluginResult; -import android.content.Intent; import android.database.Cursor; import android.database.sqlite.*; import android.util.Log; -import android.webkit.WebView; -public class Storage implements Plugin { +public class Storage extends Plugin { private static final String LOG_TAG = "SQLite Storage:"; - - WebView webView; // WebView object - DroidGap ctx; // DroidGap object SQLiteDatabase myDb; String path; @@ -29,26 +24,6 @@ public class Storage implements Plugin { public Storage() { } - /** - * Sets the context of the Command. This can then be used to do things like - * get file paths associated with the Activity. - * - * @param ctx The context of the main Activity. - */ - public void setContext(DroidGap ctx) { - this.ctx = ctx; - } - - /** - * Sets the main View of the application, this is the WebView within which - * a PhoneGap app runs. - * - * @param webView The PhoneGap WebView - */ - public void setView(WebView webView) { - this.webView = webView; - } - /** * Executes the request and returns CommandResult. * @@ -92,37 +67,6 @@ public class Storage implements Plugin { return false; } - /** - * Called when the system is about to start resuming a previous activity. - */ - public void onPause() { - } - - /** - * Called when the activity will start interacting with the user. - */ - public void onResume() { - } - - /** - * Called by AccelBroker when listener is to be shut down. - * Stop listener. - */ - public void onDestroy() { - } - - /** - * Called when an activity you launched exits, giving you the requestCode you started it with, - * the resultCode it returned, and any additional data from it. - * - * @param requestCode The request code originally supplied to startActivityForResult(), - * allowing you to identify who this result came from. - * @param resultCode The integer result code returned by the child activity through its setResult(). - * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). - */ - public void onActivityResult(int requestCode, int resultCode, Intent intent) { - } - //-------------------------------------------------------------------------- // LOCAL METHODS //-------------------------------------------------------------------------- @@ -146,7 +90,7 @@ public class Storage implements Plugin { } catch (SQLiteException ex) { Log.d(LOG_TAG, ex.getMessage()); txid = ""; - this.ctx.sendJavascript("droiddb.fail(" + ex.getMessage() + "," + txid + ");"); + this.sendJavascript("droiddb.fail(" + ex.getMessage() + "," + txid + ");"); } } @@ -167,9 +111,9 @@ public class Storage implements Plugin { } } resultString += "}"; - this.ctx.sendJavascript("droiddb.addResult('" + resultString + "', " + txid + ");"); + this.sendJavascript("droiddb.addResult('" + resultString + "', " + txid + ");"); } while (cur.moveToNext()); - this.ctx.sendJavascript("droiddb.completeQuery(" + txid + ");"); + this.sendJavascript("droiddb.completeQuery(" + txid + ");"); txid = ""; myDb.close(); } diff --git a/framework/src/com/phonegap/TempListener.java b/framework/src/com/phonegap/TempListener.java index 5b79d3ab..62f634e2 100644 --- a/framework/src/com/phonegap/TempListener.java +++ b/framework/src/com/phonegap/TempListener.java @@ -12,13 +12,8 @@ import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.content.Context; -import android.content.Intent; -import android.webkit.WebView; -public class TempListener implements SensorEventListener, Plugin { - - WebView webView; // WebView object - DroidGap ctx; // DroidGap object +public class TempListener extends Plugin implements SensorEventListener { Sensor mSensor; private SensorManager sensorManager; @@ -36,20 +31,10 @@ public class TempListener implements SensorEventListener, Plugin { * @param ctx The context of the main Activity. */ public void setContext(DroidGap ctx) { - this.ctx = ctx; + super.setContext(ctx); this.sensorManager = (SensorManager) ctx.getSystemService(Context.SENSOR_SERVICE); } - /** - * Sets the main View of the application, this is the WebView within which - * a PhoneGap app runs. - * - * @param webView The PhoneGap WebView - */ - public void setView(WebView webView) { - this.webView = webView; - } - /** * Executes the request and returns CommandResult. * @@ -69,28 +54,6 @@ public class TempListener implements SensorEventListener, Plugin { } return new PluginResult(status, result); } - - /** - * 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 isSynch(String action) { - return false; - } - - /** - * Called when the system is about to start resuming a previous activity. - */ - public void onPause() { - } - - /** - * Called when the activity will start interacting with the user. - */ - public void onResume() { - } /** * Called by AccelBroker when listener is to be shut down. @@ -100,18 +63,6 @@ public class TempListener implements SensorEventListener, Plugin { this.stop(); } - /** - * Called when an activity you launched exits, giving you the requestCode you started it with, - * the resultCode it returned, and any additional data from it. - * - * @param requestCode The request code originally supplied to startActivityForResult(), - * allowing you to identify who this result came from. - * @param resultCode The integer result code returned by the child activity through its setResult(). - * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). - */ - public void onActivityResult(int requestCode, int resultCode, Intent intent) { - } - //-------------------------------------------------------------------------- // LOCAL METHODS //-------------------------------------------------------------------------- @@ -135,7 +86,7 @@ public class TempListener implements SensorEventListener, Plugin { public void onSensorChanged(SensorEvent event) { // We want to know what temp this is. float temp = event.values[0]; - this.ctx.sendJavascript("gotTemp(" + temp + ");"); + this.sendJavascript("gotTemp(" + temp + ");"); } } \ No newline at end of file diff --git a/framework/src/com/phonegap/api/IPlugin.java b/framework/src/com/phonegap/api/IPlugin.java new file mode 100755 index 00000000..c895129b --- /dev/null +++ b/framework/src/com/phonegap/api/IPlugin.java @@ -0,0 +1,74 @@ +package com.phonegap.api; + +import org.json.JSONArray; +import com.phonegap.DroidGap; +import android.content.Intent; +import android.webkit.WebView; + +/** + * Plugin interface must be implemented by any plugin classes. + * + * The execute method is called by the PluginManager. + */ +public interface IPlugin { + + /** + * Executes the request and returns PluginResult. + * + * @param action The action to execute. + * @param args JSONArry of arguments for the plugin. + * @return A PluginResult object with a status and message. + */ + PluginResult execute(String action, JSONArray args); + + /** + * 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 isSynch(String action); + + /** + * Sets the context of the Plugin. This can then be used to do things like + * get file paths associated with the Activity. + * + * @param ctx The context of the main Activity. + */ + void setContext(DroidGap ctx); + + /** + * Sets the main View of the application, this is the WebView within which + * a PhoneGap app runs. + * + * @param webView The PhoneGap WebView + */ + void setView(WebView webView); + + /** + * Called when the system is about to start resuming a previous activity. + */ + void onPause(); + + /** + * Called when the activity will start interacting with the user. + */ + void onResume(); + + /** + * The final call you receive before your activity is destroyed. + */ + void onDestroy(); + + /** + * Called when an activity you launched exits, giving you the requestCode you started it with, + * the resultCode it returned, and any additional data from it. + * + * @param requestCode The request code originally supplied to startActivityForResult(), + * allowing you to identify who this result came from. + * @param resultCode The integer result code returned by the child activity through its setResult(). + * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). + */ + void onActivityResult(int requestCode, int resultCode, Intent intent); + +} diff --git a/framework/src/com/phonegap/api/Plugin.java b/framework/src/com/phonegap/api/Plugin.java index 78a97ca3..ccc8a9d7 100755 --- a/framework/src/com/phonegap/api/Plugin.java +++ b/framework/src/com/phonegap/api/Plugin.java @@ -1,10 +1,7 @@ package com.phonegap.api; import org.json.JSONArray; - import com.phonegap.DroidGap; - -import android.content.Context; import android.content.Intent; import android.webkit.WebView; @@ -13,7 +10,11 @@ import android.webkit.WebView; * * The execute method is called by the PluginManager. */ -public interface Plugin { +public abstract class Plugin implements IPlugin { + + public WebView webView; // WebView object + public DroidGap ctx; // DroidGap object + /** * Executes the request and returns PluginResult. * @@ -21,7 +22,7 @@ public interface Plugin { * @param args JSONArry of arguments for the plugin. * @return A PluginResult object with a status and message. */ - PluginResult execute(String action, JSONArray args); + public abstract PluginResult execute(String action, JSONArray args); /** * Identifies if action to be executed returns a value and should be run synchronously. @@ -29,7 +30,9 @@ public interface Plugin { * @param action The action to execute * @return T=returns value */ - public boolean isSynch(String action); + public boolean isSynch(String action) { + return false; + } /** * Sets the context of the Plugin. This can then be used to do things like @@ -37,7 +40,9 @@ public interface Plugin { * * @param ctx The context of the main Activity. */ - void setContext(DroidGap ctx); + public void setContext(DroidGap ctx) { + this.ctx = ctx; + } /** * Sets the main View of the application, this is the WebView within which @@ -45,22 +50,27 @@ public interface Plugin { * * @param webView The PhoneGap WebView */ - void setView(WebView webView); + public void setView(WebView webView) { + this.webView = webView; + } /** * Called when the system is about to start resuming a previous activity. */ - void onPause(); + public void onPause() { + } /** * Called when the activity will start interacting with the user. */ - void onResume(); + public void onResume() { + } /** * The final call you receive before your activity is destroyed. */ - void onDestroy(); + public void onDestroy() { + } /** * Called when an activity you launched exits, giving you the requestCode you started it with, @@ -71,6 +81,16 @@ public interface Plugin { * @param resultCode The integer result code returned by the child activity through its setResult(). * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). */ - void onActivityResult(int requestCode, int resultCode, Intent intent); + public void onActivityResult(int requestCode, int resultCode, Intent intent) { + } + + /** + * Send JavaScript statement back to JavaScript. + * + * @param statement + */ + public void sendJavascript(String statement) { + this.ctx.callbackServer.sendJavascript(statement); + } }