From 26effd1def270c36f7c5d34c478438b594f24119 Mon Sep 17 00:00:00 2001 From: Simon MacDonald Date: Tue, 8 Jan 2013 15:21:51 -0500 Subject: [PATCH 1/8] Test for correctOrientation not rotate=0 when determining if we are in the special case where the image should just be retureturned to the user without modification. --- framework/src/org/apache/cordova/CameraLauncher.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/framework/src/org/apache/cordova/CameraLauncher.java b/framework/src/org/apache/cordova/CameraLauncher.java index 49a68c03..f9edd10f 100755 --- a/framework/src/org/apache/cordova/CameraLauncher.java +++ b/framework/src/org/apache/cordova/CameraLauncher.java @@ -322,7 +322,8 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect } // If all this is true we shouldn't compress the image. - if (this.targetHeight == -1 && this.targetWidth == -1 && this.mQuality == 100 && rotate == 0) { + if (this.targetHeight == -1 && this.targetWidth == -1 && this.mQuality == 100 && + !this.correctOrientation) { writeUncompressedImage(uri); this.callbackContext.success(uri.toString()); From 7ace1d652d665c850941531c18cdc55b9c7981b3 Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Tue, 8 Jan 2013 13:54:38 -0800 Subject: [PATCH 2/8] Fixing CB-2171, 0 byte file in filesystem on 404 from server. Patches are welcome. --- framework/src/org/apache/cordova/FileTransfer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/framework/src/org/apache/cordova/FileTransfer.java b/framework/src/org/apache/cordova/FileTransfer.java index fdc9c75d..9bec20c9 100644 --- a/framework/src/org/apache/cordova/FileTransfer.java +++ b/framework/src/org/apache/cordova/FileTransfer.java @@ -676,10 +676,11 @@ public class FileTransfer extends CordovaPlugin { progress.setTotal(connection.getContentLength()); } - FileOutputStream outputStream = new FileOutputStream(file); + FileOutputStream outputStream = null; InputStream inputStream = null; try { + outputStream = new FileOutputStream(file); inputStream = getInputStream(connection); synchronized (context) { if (context.aborted) { From a1cfe87f1e55919a246478d981fecde72b038a02 Mon Sep 17 00:00:00 2001 From: Simon MacDonald Date: Tue, 8 Jan 2013 21:10:41 -0500 Subject: [PATCH 3/8] CB-2093: NullPointerException when attaching image from Gallery that contains spaces in the path Guarding against a null string being passed into FileUtils.getMimeType() --- .../src/org/apache/cordova/FileUtils.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/framework/src/org/apache/cordova/FileUtils.java b/framework/src/org/apache/cordova/FileUtils.java index 5694b3d0..aa695acf 100755 --- a/framework/src/org/apache/cordova/FileUtils.java +++ b/framework/src/org/apache/cordova/FileUtils.java @@ -1019,15 +1019,19 @@ public class FileUtils extends CordovaPlugin { * @return a mime type */ public static String getMimeType(String filename) { - // Stupid bug in getFileExtensionFromUrl when the file name has a space - // So we need to replace the space with a url encoded %20 - String url = filename.replace(" ", "%20"); - MimeTypeMap map = MimeTypeMap.getSingleton(); - String extension = MimeTypeMap.getFileExtensionFromUrl(url); - if (extension.toLowerCase().equals("3ga")) { - return "audio/3gpp"; + if (filename != null) { + // Stupid bug in getFileExtensionFromUrl when the file name has a space + // So we need to replace the space with a url encoded %20 + String url = filename.replace(" ", "%20"); + MimeTypeMap map = MimeTypeMap.getSingleton(); + String extension = MimeTypeMap.getFileExtensionFromUrl(url); + if (extension.toLowerCase().equals("3ga")) { + return "audio/3gpp"; + } else { + return map.getMimeTypeFromExtension(extension); + } } else { - return map.getMimeTypeFromExtension(extension); + return ""; } } From c9aa43afe0a1dff6f3b57a458fce4de7e667faed Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Thu, 10 Jan 2013 11:32:37 -0800 Subject: [PATCH 4/8] CB-2185: Fixing getMimeType to get the mimetype of the file if it is upper-case --- framework/src/org/apache/cordova/FileUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/framework/src/org/apache/cordova/FileUtils.java b/framework/src/org/apache/cordova/FileUtils.java index aa695acf..35496e72 100755 --- a/framework/src/org/apache/cordova/FileUtils.java +++ b/framework/src/org/apache/cordova/FileUtils.java @@ -1022,7 +1022,9 @@ public class FileUtils extends CordovaPlugin { if (filename != null) { // Stupid bug in getFileExtensionFromUrl when the file name has a space // So we need to replace the space with a url encoded %20 - String url = filename.replace(" ", "%20"); + + // CB-2185: Stupid bug not putting JPG extension in the mime-type map + String url = filename.replace(" ", "%20").toLowerCase(); MimeTypeMap map = MimeTypeMap.getSingleton(); String extension = MimeTypeMap.getFileExtensionFromUrl(url); if (extension.toLowerCase().equals("3ga")) { From 25aef945d14eae7167ece73c11e32d8471114bee Mon Sep 17 00:00:00 2001 From: Benn Mapes Date: Thu, 10 Jan 2013 14:51:20 -0800 Subject: [PATCH 5/8] Deleted depricated methods --- framework/src/org/apache/cordova/api/CordovaInterface.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/framework/src/org/apache/cordova/api/CordovaInterface.java b/framework/src/org/apache/cordova/api/CordovaInterface.java index 6499febe..22e36b64 100755 --- a/framework/src/org/apache/cordova/api/CordovaInterface.java +++ b/framework/src/org/apache/cordova/api/CordovaInterface.java @@ -54,11 +54,6 @@ public interface CordovaInterface { */ public abstract Activity getActivity(); - @Deprecated - public abstract Context getContext(); - - @Deprecated - public abstract void cancelLoadUrl(); /** * Called when a message is sent to plugin. From 1f393866166387bcf3ea1a0f3c943a6712da1822 Mon Sep 17 00:00:00 2001 From: Benn Mapes Date: Thu, 10 Jan 2013 15:07:26 -0800 Subject: [PATCH 6/8] Fixed broken functions that were deprecated --- framework/src/org/apache/cordova/App.java | 10 +--------- .../src/org/apache/cordova/api/LegacyContext.java | 3 +-- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/framework/src/org/apache/cordova/App.java b/framework/src/org/apache/cordova/App.java index dad34a07..afdbf3f2 100755 --- a/framework/src/org/apache/cordova/App.java +++ b/framework/src/org/apache/cordova/App.java @@ -64,7 +64,7 @@ public class App extends CordovaPlugin { this.loadUrl(args.getString(0), args.optJSONObject(1)); } else if (action.equals("cancelLoadUrl")) { - this.cancelLoadUrl(); + //this.cancelLoadUrl(); } else if (action.equals("clearHistory")) { this.clearHistory(); @@ -160,14 +160,6 @@ public class App extends CordovaPlugin { this.webView.showWebPage(url, openExternal, clearHistory, params); } - /** - * Cancel loadUrl before it has been loaded (Only works on a CordovaInterface class) - */ - @Deprecated - public void cancelLoadUrl() { - this.cordova.cancelLoadUrl(); - } - /** * Clear page history for the app. */ diff --git a/framework/src/org/apache/cordova/api/LegacyContext.java b/framework/src/org/apache/cordova/api/LegacyContext.java index c3030381..fe154f7c 100644 --- a/framework/src/org/apache/cordova/api/LegacyContext.java +++ b/framework/src/org/apache/cordova/api/LegacyContext.java @@ -43,7 +43,6 @@ public class LegacyContext implements CordovaInterface { @Deprecated public void cancelLoadUrl() { Log.i(LOG_TAG, "Replace ctx.cancelLoadUrl() with cordova.cancelLoadUrl()"); - this.cordova.cancelLoadUrl(); } @Deprecated @@ -55,7 +54,7 @@ public class LegacyContext implements CordovaInterface { @Deprecated public Context getContext() { Log.i(LOG_TAG, "Replace ctx.getContext() with cordova.getContext()"); - return this.cordova.getContext(); + return this.cordova.getActivity(); } @Deprecated From dc94fc39ec8bac1cb09eaa264a74266538a1b9c4 Mon Sep 17 00:00:00 2001 From: Fil Maj Date: Thu, 10 Jan 2013 18:29:36 -0800 Subject: [PATCH 7/8] Fixes CB-2204: if bin/create fails, exit with code 1 --- bin/create | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/create b/bin/create index d1380cbe..c92acb45 100755 --- a/bin/create +++ b/bin/create @@ -69,7 +69,7 @@ function on_error { echo "An unexpected error occurred: $previous_command exited with $?" echo "Deleting project..." [ -d "$PROJECT_PATH" ] && rm -rf "$PROJECT_PATH" - exit "$?" + exit 1 } function replace { From dbb127447fc61ff14fcec7df81101230af6d2700 Mon Sep 17 00:00:00 2001 From: Simon MacDonald Date: Thu, 10 Jan 2013 22:06:35 -0500 Subject: [PATCH 8/8] CB-2154: navigator.splashscreen.show() broken in Phonegap 2.2 and 2.3.0rc2 Fixed the splashscreen so it will show for a minimum of 3 seconds if the user has not called loadUrl with a timeout in their main activity. --- framework/src/org/apache/cordova/DroidGap.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/framework/src/org/apache/cordova/DroidGap.java b/framework/src/org/apache/cordova/DroidGap.java index ecff67ac..579ce8da 100755 --- a/framework/src/org/apache/cordova/DroidGap.java +++ b/framework/src/org/apache/cordova/DroidGap.java @@ -40,6 +40,7 @@ import android.graphics.Color; import android.media.AudioManager; import android.os.Bundle; import android.os.Handler; +import android.util.Log; import android.view.Display; import android.view.KeyEvent; import android.view.Menu; @@ -170,7 +171,7 @@ public class DroidGap extends Activity implements CordovaInterface { // Draw a splash screen using an image located in the drawable resource directory. // This is not the same as calling super.loadSplashscreen(url) protected int splashscreen = 0; - protected int splashscreenTime = 0; + protected int splashscreenTime = 3000; // LoadUrl timeout value in msec (default of 20 sec) protected int loadUrlTimeoutValue = 20000; @@ -1053,9 +1054,9 @@ public class DroidGap extends Activity implements CordovaInterface { } else { // If the splash dialog is showing don't try to show it again - if (this.splashDialog != null && !this.splashDialog.isShowing()) { - this.splashscreen = this.getIntegerProperty("splashscreen", 0); - this.showSplashScreen(this.splashscreenTime); + if (this.splashDialog == null || !this.splashDialog.isShowing()) { + this.splashscreen = this.getIntegerProperty("splashscreen", 0); + this.showSplashScreen(this.splashscreenTime); } } }