From a0406b0b1e8b2c6cd59d149db5a1b737787069a5 Mon Sep 17 00:00:00 2001 From: lorinbeer Date: Tue, 20 Aug 2013 13:55:43 -0700 Subject: [PATCH 1/2] [CB-4432] copyright notice change --- src/blackberry10/index.js | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/blackberry10/index.js b/src/blackberry10/index.js index 922f049..9a5ebf3 100644 --- a/src/blackberry10/index.js +++ b/src/blackberry10/index.js @@ -1,18 +1,23 @@ /* - * Copyright 2010-2011 Research In Motion Limited. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ var PictureSourceType = { PHOTOLIBRARY : 0, // Choose image from picture library (same as SAVEDPHOTOALBUM for Android) CAMERA : 1, // Take picture from camera From fa52e35c420a17952283cfb8d8c2d194eed8f70e Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Wed, 21 Aug 2013 15:39:43 -0700 Subject: [PATCH 2/2] No longer causes a stack trace, but it doesn't cause the error to be called. --- src/android/CameraLauncher.java | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/android/CameraLauncher.java b/src/android/CameraLauncher.java index bd50a63..b7454ce 100755 --- a/src/android/CameraLauncher.java +++ b/src/android/CameraLauncher.java @@ -76,7 +76,7 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect private static final String GET_PICTURE = "Get Picture"; private static final String GET_VIDEO = "Get Video"; private static final String GET_All = "Get All"; - + private static final String LOG_TAG = "CameraLauncher"; private int mQuality; // Compression quality hint (0-100: 0=low quality & high compression, 100=compress of max quality) @@ -153,15 +153,26 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect this.targetHeight = -1; } - if (srcType == CAMERA) { - this.takePicture(destType, encodingType); + try { + if (srcType == CAMERA) { + this.takePicture(destType, encodingType); + } + else if ((srcType == PHOTOLIBRARY) || (srcType == SAVEDPHOTOALBUM)) { + this.getImage(srcType, destType); + } } - else if ((srcType == PHOTOLIBRARY) || (srcType == SAVEDPHOTOALBUM)) { - this.getImage(srcType, destType); + catch (IllegalArgumentException e) + { + callbackContext.error("Illegal Argument Exception"); + PluginResult r = new PluginResult(PluginResult.Status.ERROR); + callbackContext.sendPluginResult(r); + return true; } + PluginResult r = new PluginResult(PluginResult.Status.NO_RESULT); r.setKeepCallback(true); callbackContext.sendPluginResult(r); + return true; } return false;