From 403b87b68b203191afaeb739a65f9aa37e156a9f Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Tue, 28 Feb 2012 16:30:25 -0800 Subject: [PATCH] Reverting interface change, not enough time for testing, need to remove it manually --- .../com/phonegap/api/PhonegapActivity.java | 2 +- .../org/apache/cordova/CameraLauncher.java | 8 +-- framework/src/org/apache/cordova/Capture.java | 4 +- .../org/apache/cordova/ContactManager.java | 2 +- .../src/org/apache/cordova/DroidGap.java | 13 +---- .../src/org/apache/cordova/Notification.java | 10 ++-- .../apache/cordova/api/CordovaInterface.java | 53 +------------------ 7 files changed, 16 insertions(+), 76 deletions(-) diff --git a/framework/src/com/phonegap/api/PhonegapActivity.java b/framework/src/com/phonegap/api/PhonegapActivity.java index c1b7c46e..200ea1c2 100755 --- a/framework/src/com/phonegap/api/PhonegapActivity.java +++ b/framework/src/com/phonegap/api/PhonegapActivity.java @@ -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 { } diff --git a/framework/src/org/apache/cordova/CameraLauncher.java b/framework/src/org/apache/cordova/CameraLauncher.java index 77573a73..c7eac886 100755 --- a/framework/src/org/apache/cordova/CameraLauncher.java +++ b/framework/src/org/apache/cordova/CameraLauncher.java @@ -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(); diff --git a/framework/src/org/apache/cordova/Capture.java b/framework/src/org/apache/cordova/Capture.java index ce7e9de0..34423d0b 100644 --- a/framework/src/org/apache/cordova/Capture.java +++ b/framework/src/org/apache/cordova/Capture.java @@ -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 diff --git a/framework/src/org/apache/cordova/ContactManager.java b/framework/src/org/apache/cordova/ContactManager.java index 57656347..1231ed05 100755 --- a/framework/src/org/apache/cordova/ContactManager.java +++ b/framework/src/org/apache/cordova/ContactManager.java @@ -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 { diff --git a/framework/src/org/apache/cordova/DroidGap.java b/framework/src/org/apache/cordova/DroidGap.java index c5e795e3..e221ed72 100755 --- a/framework/src/org/apache/cordova/DroidGap.java +++ b/framework/src/org/apache/cordova/DroidGap.java @@ -145,7 +145,7 @@ import android.widget.LinearLayout; * ... * */ -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; - } - - } diff --git a/framework/src/org/apache/cordova/Notification.java b/framework/src/org/apache/cordova/Notification.java index 61935183..535142b9 100755 --- a/framework/src/org/apache/cordova/Notification.java +++ b/framework/src/org/apache/cordova/Notification.java @@ -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); diff --git a/framework/src/org/apache/cordova/api/CordovaInterface.java b/framework/src/org/apache/cordova/api/CordovaInterface.java index 51d0392b..9435f873 100755 --- a/framework/src/org/apache/cordova/api/CordovaInterface.java +++ b/framework/src/org/apache/cordova/api/CordovaInterface.java @@ -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 params); - - public abstract Context getApplicationContext(); + }