Modify camera capture to use async plugin. Use option instead of method to specify capture type (base64 or file).

This commit is contained in:
Bryce Curtis
2010-09-10 14:45:32 -05:00
parent d72c77d6f3
commit 53fca124ab
2 changed files with 20 additions and 35 deletions
+7 -14
View File
@@ -1,13 +1,3 @@
com.phonegap.CameraLauncherProxy = function() {
this.className = "com.phonegap.CameraLauncher";
};
com.phonegap.CameraLauncherProxy.prototype.setBase64 = function(b) {
return PhoneGap.exec(this.className, "setBase64", [b]);
};
com.phonegap.CameraLauncherProxy.prototype.takePicture = function(quality) {
return PhoneGap.exec(this.className, "takePicture", [quality]);
};
com.phonegap.CameraLauncher = new com.phonegap.CameraLauncherProxy();
/**
* This class provides access to the device camera.
@@ -44,12 +34,15 @@ Camera.prototype.getPicture = function(successCallback, errorCallback, options)
this.successCallback = successCallback;
this.errorCallback = errorCallback;
this.options = options;
var capturetype = "base64";
var quality = 80;
if (this.options.capturetype) {
capturetype = this.options.capturetype;
}
if (options.quality) {
com.phonegap.CameraLauncher.takePicture(options.quality);
}
else {
com.phonegap.CameraLauncher.takePicture(80);
quality = this.options.quality;
}
PhoneGap.execAsync(null, null, "Camera", "takePicture", [quality, capturetype]);
};
/**