You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by be...@apache.org on 2013/02/21 20:44:31 UTC

spec commit: [CB-2411] Added a popover repositioning test.

Updated Branches:
  refs/heads/next 842e6031c -> 87d07d62e


[CB-2411] Added a popover repositioning test.

Also added minor camera test documentation.

The "Select Image Using File URI" test will reposition the popover towards the top left corner when the orientation changes.


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/87d07d62
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/87d07d62
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/87d07d62

Branch: refs/heads/next
Commit: 87d07d62e2419690ba4a495892fca241f0710b72
Parents: 842e603
Author: Max Woghiren <ma...@gmail.com>
Authored: Tue Feb 19 13:12:40 2013 -0500
Committer: Becky Gibson <be...@apache.org>
Committed: Thu Feb 21 13:01:38 2013 -0500

----------------------------------------------------------------------
 camera/index.html |   30 +++++++++++++++++++++++++++++-
 1 files changed, 29 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/87d07d62/camera/index.html
----------------------------------------------------------------------
diff --git a/camera/index.html b/camera/index.html
index 037877f..82e0a3c 100644
--- a/camera/index.html
+++ b/camera/index.html
@@ -34,6 +34,7 @@
 
     var deviceReady = false;
     var platformId = cordova.require('cordova/platform').id;
+    var CameraPopoverOptions = cordova.require('cordova/plugin/CameraPopoverOptions');
 
     //-------------------------------------------------------------------------
     // Camera
@@ -97,7 +98,7 @@
      */
     function getImageUsingFileUri(upload) {
         clearStatus();
-        navigator.camera.getPicture(
+        var popoverHandle = navigator.camera.getPicture(
             function(data) {
                 getPictureWin(data);
                 if (upload) {
@@ -106,10 +107,17 @@
             }, getPictureFail,
             { destinationType: Camera.DestinationType.FILE_URI,
               sourceType: Camera.PictureSourceType.PHOTOLIBRARY});
+
+        // Reposition the popover if the orientation changes.
+        window.onorientationchange = function() {
+            var newPopoverOptions = new CameraPopoverOptions(0, 0, 100, 100, 0);
+            popoverHandle.setPosition(newPopoverOptions);
+        }
     };
 
     /**
      * Select image from library using a NATIVE_URI destination type
+     * This calls FileEntry.getMetadata, FileEntry.setMetadata, FileEntry.getParent, FileEntry.file, and FileReader.readAsDataURL.
      */
     function getImageUsingNativeUri() {
         var onMetadataReceived = function(metadata) {
@@ -185,6 +193,10 @@
               sourceType: Camera.PictureSourceType.PHOTOLIBRARY });
     };
 
+    /**
+     * Copy image from library using a NATIVE_URI destination type
+     * This calls FileEntry.copyTo and FileEntry.moveTo.
+     */
     function copyImageUsingNativeUri() {
         var onFileCopied = function(fileEntry) {
             document.getElementById('camera_status').innerHTML += "FileEntry.copyTo <b>success</b><br />";
@@ -229,6 +241,10 @@
         window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, onFileSystemReceived, null);
     };
 
+    /**
+     * Write image to library using a NATIVE_URI destination type
+     * This calls FileEntry.createWriter, FileWriter.write, and FileWriter.truncate.
+     */
     function writeImageUsingNativeUri() {
         var onFileWrite = function(evt) {
             handleUnexpectedSuccess("FileWriter.write");
@@ -276,6 +292,10 @@
               sourceType: Camera.PictureSourceType.PHOTOLIBRARY });
     };
 
+    /**
+     * Upload image from library using a NATIVE_URI destination type
+     * This calls FileTransfer.upload.
+     */
     function uploadImageUsingNativeUri() {
         var onFileUploaded = function(response) {
             document.getElementById('camera_status').innerHTML += "FileTransfer.upload <b>success</b>: response = " + response.responseCode + ".<br />";
@@ -300,6 +320,10 @@
               sourceType: Camera.PictureSourceType.PHOTOLIBRARY });
     };
 
+    /**
+     * Display image from library using a NATIVE_URI destination type
+     * This uses img and canvas tags.
+     */
     function displayImageUsingNativeUri() {
         clearStatus();
         navigator.camera.getPicture(
@@ -322,6 +346,10 @@
               sourceType: Camera.PictureSourceType.PHOTOLIBRARY });
     };
 
+    /**
+     * Remove image from library using a NATIVE_URI destination type
+     * This calls FileEntry.remove.
+     */
     function removeImageUsingNativeUri() {
         var onFileEntryRemoved = function() {
             if (platformId == 'ios') {