You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ti...@apache.org on 2012/06/28 01:49:12 UTC
[2/2] webworks commit: [CB-973] Fixed up tab issue
[CB-973] Fixed up tab issue
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/commit/a5209421
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/tree/a5209421
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/diff/a5209421
Branch: refs/heads/master
Commit: a5209421a026d8b024295c4304678365090a7371
Parents: a03c2e8
Author: Tim Kim <ti...@nitobi.com>
Authored: Wed Jun 27 16:48:32 2012 -0700
Committer: Tim Kim <ti...@nitobi.com>
Committed: Wed Jun 27 16:48:32 2012 -0700
----------------------------------------------------------------------
.../ext/src/org/apache/cordova/camera/Camera.java | 78 +++++++-------
.../org/apache/cordova/camera/CameraOptions.java | 25 +++---
2 files changed, 51 insertions(+), 52 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/a5209421/framework/ext/src/org/apache/cordova/camera/Camera.java
----------------------------------------------------------------------
diff --git a/framework/ext/src/org/apache/cordova/camera/Camera.java b/framework/ext/src/org/apache/cordova/camera/Camera.java
index e5f95c1..d54483f 100644
--- a/framework/ext/src/org/apache/cordova/camera/Camera.java
+++ b/framework/ext/src/org/apache/cordova/camera/Camera.java
@@ -176,51 +176,51 @@ public class Camera extends Plugin
// otherwise, get encoded string if base 64 string is output format.
String imageURIorData = filePath;
- // save to file:///store/home/user/ as oppsed to photo album
- // so it doesn't show up in the camera's photo album viewer
- if(!options.saveToPhotoAlbum){
- FileConnection fconnIn = null;
- FileConnection fconnOut = null;
- InputStream in = null;
- OutputStream out = null;
- String newOutName = "";
- try
- {
- fconnIn = (FileConnection)Connector.open(filePath);
- if (fconnIn.exists())
- {
- newOutName = "file:///store/home/user/"+fconnIn.getName();
- fconnOut = (FileConnection)Connector.open(newOutName);
- if (!fconnOut.exists())
- {
- fconnOut.create();
- in = fconnIn.openInputStream();
- out = fconnOut.openOutputStream();
- out.write(IOUtilities.streamToBytes(in, 96*1024));
- fconnIn.delete();
- out.close();
- imageURIorData = newOutName;
- filePath = newOutName;
- waitForImageFile(newOutName);
- }
- }
- }
- finally
- {
- if (in != null) in.close();
- if (out != null) out.close();
- if (fconnIn != null) fconnIn.close();
- if (fconnOut != null) fconnOut.close();
- }
-
- }
+ // save to file:///store/home/user/ as oppsed to photo album
+ // so it doesn't show up in the camera's photo album viewer
+ if(!options.saveToPhotoAlbum){
+ FileConnection fconnIn = null;
+ FileConnection fconnOut = null;
+ InputStream in = null;
+ OutputStream out = null;
+ String newOutName = "";
+ try
+ {
+ fconnIn = (FileConnection)Connector.open(filePath);
+ if (fconnIn.exists())
+ {
+ newOutName = "file:///store/home/user/"+fconnIn.getName();
+ fconnOut = (FileConnection)Connector.open(newOutName);
+ if (!fconnOut.exists())
+ {
+ fconnOut.create();
+ in = fconnIn.openInputStream();
+ out = fconnOut.openOutputStream();
+ out.write(IOUtilities.streamToBytes(in, 96*1024));
+ fconnIn.delete();
+ out.close();
+ imageURIorData = newOutName;
+ filePath = newOutName;
+ waitForImageFile(newOutName);
+ }
+ }
+ }
+ finally
+ {
+ if (in != null) in.close();
+ if (out != null) out.close();
+ if (fconnIn != null) fconnIn.close();
+ if (fconnOut != null) fconnOut.close();
+ }
+
+ }
if (options.reformat) {
imageURIorData = reformatImage(filePath, options);
} else if (options.destinationType == CameraOptions.DESTINATION_DATA_URL) {
imageURIorData = encodeImage(filePath);
}
-
+
// we have to check the size to avoid memory errors in the browser
if (imageURIorData.length() > MAX_ENCODING_SIZE)
{
http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/a5209421/framework/ext/src/org/apache/cordova/camera/CameraOptions.java
----------------------------------------------------------------------
diff --git a/framework/ext/src/org/apache/cordova/camera/CameraOptions.java b/framework/ext/src/org/apache/cordova/camera/CameraOptions.java
index 8b18f16..8bfa0df 100644
--- a/framework/ext/src/org/apache/cordova/camera/CameraOptions.java
+++ b/framework/ext/src/org/apache/cordova/camera/CameraOptions.java
@@ -59,8 +59,8 @@ public class CameraOptions {
public String fileExtension = ".jpg";
public int imageFilter = Bitmap.FILTER_LANCZOS;
public boolean reformat = false;
- public boolean saveToPhotoAlbum = true;
-
+ public boolean saveToPhotoAlbum = true;
+
/**
* Defines the order of args in the JSONArray
*
@@ -82,7 +82,7 @@ public class CameraOptions {
private static final int ARG_TARGET_WIDTH = 3;
private static final int ARG_TARGET_HEIGHT = 4;
private static final int ARG_ENCODING = 5;
- private static final int ARG_SAVETOPHOTOALBUM = 9;
+ private static final int ARG_SAVETOPHOTOALBUM = 9;
/**
* Parse the JSONArray and populate the class members with the values.
@@ -162,19 +162,18 @@ public class CameraOptions {
return options;
}
-
+
/**
* no parseBoolean in JDK 1.3 :(
*/
-
- public static boolean parseBoolean(String s) {
- if (s.equals("true")){
- return true;
- }else{
- return false;
- }
- }
-
+ public static boolean parseBoolean(String s) {
+ if(s.equals("true")){
+ return true;
+ }else{
+ return false;
+ }
+ }
+
/**
* @see java.lang.Object#toString()
*/