Reverting interface change, not enough time for testing, need to remove it manually

This commit is contained in:
Joe Bowser 2012-02-28 16:30:25 -08:00
parent bf69362709
commit 403b87b68b
7 changed files with 16 additions and 76 deletions

View File

@ -24,5 +24,5 @@ import android.app.Activity;
* The Cordova activity abstract class that is extended by DroidGap.
* It is used to isolate plugin development, and remove dependency on entire Cordova library.
*/
public abstract class PhonegapActivity extends Activity implements org.apache.cordova.api.CordovaInterface {
public abstract class PhonegapActivity extends org.apache.cordova.api.CordovaInterface {
}

View File

@ -175,9 +175,9 @@ public class CameraLauncher extends Plugin {
private File createCaptureFile(int encodingType) {
File photo = null;
if (encodingType == JPEG) {
photo = new File(DirectoryManager.getTempDirectoryPath(ctx.getContext()), "Pic.jpg");
photo = new File(DirectoryManager.getTempDirectoryPath(ctx), "Pic.jpg");
} else if (encodingType == PNG) {
photo = new File(DirectoryManager.getTempDirectoryPath(ctx.getContext()), "Pic.png");
photo = new File(DirectoryManager.getTempDirectoryPath(ctx), "Pic.png");
} else {
throw new IllegalArgumentException("Invalid Encoding Type: " + encodingType);
}
@ -281,7 +281,7 @@ public class CameraLauncher extends Plugin {
// Create an ExifHelper to save the exif data that is lost during compression
ExifHelper exif = new ExifHelper();
if (this.encodingType == JPEG) {
exif.createInFile(DirectoryManager.getTempDirectoryPath(ctx.getContext()) + "/Pic.jpg");
exif.createInFile(DirectoryManager.getTempDirectoryPath(ctx) + "/Pic.jpg");
exif.readExifData();
}
@ -394,7 +394,7 @@ public class CameraLauncher extends Plugin {
Bitmap bitmap = android.graphics.BitmapFactory.decodeStream(resolver.openInputStream(uri));
bitmap = scaleBitmap(bitmap);
String fileName = DirectoryManager.getTempDirectoryPath(ctx.getContext()) + "/resize.jpg";
String fileName = DirectoryManager.getTempDirectoryPath(ctx) + "/resize.jpg";
OutputStream os = new FileOutputStream(fileName);
bitmap.compress(Bitmap.CompressFormat.JPEG, this.mQuality, os);
os.close();

View File

@ -196,7 +196,7 @@ public class Capture extends Plugin {
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
// Specify file so that large image is captured and returned
File photo = new File(DirectoryManager.getTempDirectoryPath(ctx.getContext()), "Capture.jpg");
File photo = new File(DirectoryManager.getTempDirectoryPath(ctx), "Capture.jpg");
intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo));
this.imageUri = Uri.fromFile(photo);
@ -249,7 +249,7 @@ public class Capture extends Plugin {
try {
// Create an ExifHelper to save the exif data that is lost during compression
ExifHelper exif = new ExifHelper();
exif.createInFile(DirectoryManager.getTempDirectoryPath(ctx.getContext()) + "/Capture.jpg");
exif.createInFile(DirectoryManager.getTempDirectoryPath(ctx) + "/Capture.jpg");
exif.readExifData();
// Read in bitmap of captured image

View File

@ -79,7 +79,7 @@ public class ContactManager extends Plugin {
* older phones.
*/
if (this.contactAccessor == null) {
this.contactAccessor = new ContactAccessorSdk5(this.webView, this.ctx.getContext());
this.contactAccessor = new ContactAccessorSdk5(this.webView, this.ctx);
}
try {

View File

@ -145,7 +145,7 @@ import android.widget.LinearLayout;
* ...
* </plugins>
*/
public class DroidGap extends Activity implements CordovaInterface {
public class DroidGap extends CordovaInterface {
public static String TAG = "DroidGap";
// The webview for our app
@ -1404,15 +1404,4 @@ public class DroidGap extends Activity implements CordovaInterface {
return this;
}
public void bindBackButton(boolean override) {
// TODO Auto-generated method stub
}
public boolean isBackButtonBound() {
// TODO Auto-generated method stub
return false;
}
}

View File

@ -143,7 +143,7 @@ public class Notification extends Plugin {
*/
public void beep(long count) {
Uri ringtone = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Ringtone notification = RingtoneManager.getRingtone(this.ctx.getContext(), ringtone);
Ringtone notification = RingtoneManager.getRingtone(this.ctx, ringtone);
// If phone is not set to silent mode
if (notification != null) {
@ -190,7 +190,7 @@ public class Notification extends Plugin {
Runnable runnable = new Runnable() {
public void run() {
AlertDialog.Builder dlg = new AlertDialog.Builder(ctx.getContext());
AlertDialog.Builder dlg = new AlertDialog.Builder(ctx);
dlg.setMessage(message);
dlg.setTitle(title);
dlg.setCancelable(false);
@ -226,7 +226,7 @@ public class Notification extends Plugin {
Runnable runnable = new Runnable() {
public void run() {
AlertDialog.Builder dlg = new AlertDialog.Builder(ctx.getContext());
AlertDialog.Builder dlg = new AlertDialog.Builder(ctx);
dlg.setMessage(message);
dlg.setTitle(title);
dlg.setCancelable(false);
@ -287,7 +287,7 @@ public class Notification extends Plugin {
final CordovaInterface ctx = this.ctx;
Runnable runnable = new Runnable() {
public void run() {
notification.spinnerDialog = ProgressDialog.show(ctx.getContext(), title , message, true, true,
notification.spinnerDialog = ProgressDialog.show(ctx, title , message, true, true,
new DialogInterface.OnCancelListener() {
public void onCancel(DialogInterface dialog) {
notification.spinnerDialog = null;
@ -323,7 +323,7 @@ public class Notification extends Plugin {
final CordovaInterface ctx = this.ctx;
Runnable runnable = new Runnable() {
public void run() {
notification.progressDialog = new ProgressDialog(ctx.getContext());
notification.progressDialog = new ProgressDialog(ctx);
notification.progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
notification.progressDialog.setTitle(title);
notification.progressDialog.setMessage(message);

View File

@ -38,7 +38,7 @@ import android.net.Uri;
* The Cordova activity abstract class that is extended by DroidGap.
* It is used to isolate plugin development, and remove dependency on entire Cordova library.
*/
public interface CordovaInterface {
public abstract class CordovaInterface extends Activity{
/**
* @deprecated
@ -68,13 +68,6 @@ public interface CordovaInterface {
* @param requestCode The request code that is passed to callback to identify the activity
*/
abstract public void startActivityForResult(IPlugin command, Intent intent, int requestCode);
/**
* Launch an activity for which you would not like a result when it finished.
*
* @param intent The intent to start
*/
abstract public void startActivity(Intent intent);
/**
* Set the plugin to be called when a sub-activity exits.
@ -97,47 +90,5 @@ public interface CordovaInterface {
* @param data The message data
*/
abstract public void postMessage(String id, Object data);
public abstract Resources getResources();
public abstract String getPackageName();
public abstract Object getSystemService(String service);
public abstract Context getContext();
public abstract Context getBaseContext();
public abstract Intent registerReceiver(BroadcastReceiver receiver,
IntentFilter intentFilter);
public abstract ContentResolver getContentResolver();
public abstract void unregisterReceiver(BroadcastReceiver receiver);
public abstract Cursor managedQuery(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder);
public abstract void runOnUiThread(Runnable runnable);
public abstract AssetManager getAssets();
public abstract void clearCache();
public abstract void clearHistory();
public abstract boolean backHistory();
//public abstract void addWhiteListEntry(String origin, boolean subdomains);
public abstract void bindBackButton(boolean override);
public abstract boolean isBackButtonBound();
public abstract void cancelLoadUrl();
public abstract void showWebPage(String url, boolean openExternal,
boolean clearHistory, HashMap<String, Object> params);
public abstract Context getApplicationContext();
}