Add IPlugin interface and change Plugin to be abstract class. Plugins can either implement IPlugin or extend Plugin.

This commit is contained in:
Bryce Curtis
2010-10-04 23:58:14 -05:00
parent cbff3812e8
commit 68146329b9
18 changed files with 161 additions and 748 deletions
+1 -59
View File
@@ -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
//--------------------------------------------------------------------------