Adding queries for addresses and organization

This commit is contained in:
macdonst
2010-09-17 17:15:30 -04:00
parent c2bcc29cfb
commit ca4d7f7fd2
3 changed files with 207 additions and 58 deletions
+45 -16
View File
@@ -595,14 +595,46 @@ PhoneGap.addConstructor(function() {
*
* @constructor
*/
function Camera() {
Camera = function() {
this.successCallback = null;
this.errorCallback = null;
this.options = null;
};
/**
* Takes a photo and returns the image as a base64 encoded `String`.
* Format of image that returned from getPicture.
*
* Example: navigator.camera.getPicture(success, fail,
* { quality: 80,
* destinationType: Camera.DestinationType.DATA_URL,
* sourceType: Camera.PictureSourceType.PHOTOLIBRARY})
*/
Camera.DestinationType = {
DATA_URL: 0, // Return base64 encoded string
FILE_URI: 1 // Return file uri (content://media/external/images/media/2 for Android)
};
Camera.prototype.DestinationType = Camera.DestinationType;
/**
* Source to getPicture from.
*
* Example: navigator.camera.getPicture(success, fail,
* { quality: 80,
* destinationType: Camera.DestinationType.DATA_URL,
* sourceType: Camera.PictureSourceType.PHOTOLIBRARY})
*/
Camera.PictureSourceType = {
PHOTOLIBRARY : 0, // Choose image from picture library (same as SAVEDPHOTOALBUM for Android)
CAMERA : 1, // Take picture from camera
SAVEDPHOTOALBUM : 2 // Choose image from picture library (same as PHOTOLIBRARY for Android)
};
Camera.prototype.PictureSourceType = Camera.PictureSourceType;
/**
* Gets a picture from source defined by "options.sourceType", and returns the
* image as defined by the "options.destinationType" option.
* The defaults are sourceType=CAMERA and destinationType=DATA_URL.
*
* @param {Function} successCallback
* @param {Function} errorCallback
@@ -625,15 +657,19 @@ 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) {
quality = this.options.quality;
}
PhoneGap.execAsync(null, null, "Camera", "takePicture", [quality, capturetype]);
var destinationType = Camera.DestinationType.DATA_URL;
if (this.options.destinationType) {
destinationType = this.options.destinationType;
}
var sourceType = Camera.PictureSourceType.CAMERA;
if (typeof this.options.sourceType == "number") {
sourceType = this.options.sourceType;
}
PhoneGap.execAsync(null, null, "Camera", "takePicture", [quality, destinationType, sourceType]);
};
/**
@@ -850,14 +886,6 @@ Contacts.prototype.find = function(fields, win, fail, options) {
PhoneGap.execAsync(null, null, "Contacts", "search", [fields, options]);
};
Contacts.prototype.droidFoundContact = function(contact) {
//console.log("this is what a contact looks like");
//console.log(contact);
//this.records.push(eval('(' + contact + ')'));
console.log("we should be called anymore.");
};
Contacts.prototype.droidDone = function(contacts) {
this.win(eval('(' + contacts + ')'));
};
@@ -882,11 +910,12 @@ Contacts.prototype.m_foundContacts = function(win, contacts) {
var ContactFindOptions = function(filter, multiple, limit, updatedSince) {
this.filter = filter || '';
this.multiple = multiple || true;
this.limit = limit || 0;
this.limit = limit || Number.MAX_VALUE;
this.updatedSince = updatedSince || '';
};
var ContactError = function() {
this.code=null;
};
ContactError.INVALID_ARGUMENT_ERROR = 0;