You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by lo...@apache.org on 2013/03/29 14:53:08 UTC
spec commit: [CB-2793] added definition and display of default values
for camera.getPicture test
Updated Branches:
refs/heads/2.6.x c00970f02 -> f6cbe2ea8
[CB-2793] added definition and display of default values for camera.getPicture test
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/f6cbe2ea
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/f6cbe2ea
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/f6cbe2ea
Branch: refs/heads/2.6.x
Commit: f6cbe2ea8289531a73d549e5dca150c64f5e4d6a
Parents: c00970f
Author: lorinbeer <lo...@adobe.com>
Authored: Wed Mar 27 14:18:05 2013 -0700
Committer: lorinbeer <lo...@adobe.com>
Committed: Fri Mar 29 06:52:48 2013 -0700
----------------------------------------------------------------------
camera/index.html | 50 +++++++++++++++++++++++++++++++++++------------
1 files changed, 37 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/f6cbe2ea/camera/index.html
----------------------------------------------------------------------
diff --git a/camera/index.html b/camera/index.html
index d0285df..09b08f3 100644
--- a/camera/index.html
+++ b/camera/index.html
@@ -39,6 +39,17 @@
var fileObj = null;
var fileEntry = null;
var pageStartTime = +new Date();
+
+ //default camera options
+ var camQualityDefault = ['quality value', 50];
+ var camDestinationTypeDefault = ['FILE_URI', 1];
+ var camPictureSourceTypeDefault = ['CAMERA', 1];
+ var camAllowEditDefault = ['allowEdit', false];
+ var camEncodingTypeDefault = ['JPEG', 0];
+ var camMediaTypeDefault = ['mediaType', 0];
+ var camCorrectOrientationDefault = ['correctOrientation', false];
+ var camSaveToPhotoAlbumDefault = ['saveToPhotoAlbum', true];
+
//-------------------------------------------------------------------------
// Camera
@@ -276,25 +287,37 @@
return ret;
}
- function createOptionsEl(name, values) {
+ function createOptionsEl(name, values, selectionDefault) {
var container = document.createElement('div');
container.style.display = 'inline-block';
container.appendChild(document.createTextNode(name + ': '));
var select = document.createElement('select');
select.keyName = name;
container.appendChild(select);
- var opt = document.createElement('option');
- opt.value = '';
- opt.textContent = '<default>';
- select.appendChild(opt);
+
+ // if we didn't get a default value, insert the blank <default> entry
+ if (selectionDefault == undefined) {
+ var opt = document.createElement('option');
+ opt.value = '';
+ opt.text = '<default>';
+ select.appendChild(opt);
+ }
+
select.isBool = typeof values == 'boolean';
if (select.isBool) {
values = {'true': 1, 'false': 0};
}
+
for (var k in values) {
+ console.log(name + " value = " + k);
var opt = document.createElement('option');
opt.value = values[k];
opt.textContent = k;
+ if (selectionDefault) {
+ if (selectionDefault[0] == k) {
+ opt.selected = true;
+ }
+ }
select.appendChild(opt);
}
var optionsDiv = document.getElementById('image-options');
@@ -308,17 +331,18 @@
document.addEventListener("deviceready", function() {
deviceReady = true;
console.log("Device="+device.platform+" "+device.version);
- createOptionsEl('sourceType', Camera.PictureSourceType);
- createOptionsEl('destinationType', Camera.DestinationType);
- createOptionsEl('encodingType', Camera.EncodingType);
- createOptionsEl('mediaType', Camera.MediaType);
- createOptionsEl('quality', {'0': 0, '50': 50, '80': 80, '100': 100});
+ createOptionsEl('sourceType', Camera.PictureSourceType, camPictureSourceTypeDefault);
+ createOptionsEl('destinationType', Camera.DestinationType, camDestinationTypeDefault);
+ createOptionsEl('encodingType', Camera.EncodingType, camEncodingTypeDefault);
+ createOptionsEl('mediaType', Camera.MediaType, camMediaTypeDefault);
+ createOptionsEl('quality', {'0': 0, '50': 50, '80': 80, '100': 100}, camQualityDefault);
createOptionsEl('targetWidth', {'50': 50, '200': 200, '800': 800, '2048': 2048});
createOptionsEl('targetHeight', {'50': 50, '200': 200, '800': 800, '2048': 2048});
- createOptionsEl('allowEdit', true);
- createOptionsEl('correctOrientation', true);
- createOptionsEl('saveToPhotoAlbum', true);
+ createOptionsEl('allowEdit', true, camAllowEditDefault);
+ createOptionsEl('correctOrientation', true, camCorrectOrientationDefault);
+ createOptionsEl('saveToPhotoAlbum', true, camSaveToPhotoAlbumDefault);
createOptionsEl('cameraDirection', Camera.Direction);
+
}, false);
window.setTimeout(function() {
if (!deviceReady) {