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 { 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/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()); diff --git a/framework/src/org/apache/cordova/DroidGap.java b/framework/src/org/apache/cordova/DroidGap.java index d34c570d..476c0208 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; @@ -169,7 +170,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; @@ -1048,9 +1049,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); } } } diff --git a/framework/src/org/apache/cordova/FileTransfer.java b/framework/src/org/apache/cordova/FileTransfer.java index 9cf6a437..d3e304f1 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) { diff --git a/framework/src/org/apache/cordova/FileUtils.java b/framework/src/org/apache/cordova/FileUtils.java index 5694b3d0..35496e72 100755 --- a/framework/src/org/apache/cordova/FileUtils.java +++ b/framework/src/org/apache/cordova/FileUtils.java @@ -1019,15 +1019,21 @@ 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 + + // 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")) { + return "audio/3gpp"; + } else { + return map.getMimeTypeFromExtension(extension); + } } else { - return map.getMimeTypeFromExtension(extension); + return ""; } } 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. 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