You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by mw...@apache.org on 2013/03/14 18:11:37 UTC
docs commit: [CB-2411] Added CameraPopoverHandle documentation.
Updated Branches:
refs/heads/master 636cda022 -> 260e1f56f
[CB-2411] Added CameraPopoverHandle documentation.
Project: http://git-wip-us.apache.org/repos/asf/cordova-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-docs/commit/260e1f56
Tree: http://git-wip-us.apache.org/repos/asf/cordova-docs/tree/260e1f56
Diff: http://git-wip-us.apache.org/repos/asf/cordova-docs/diff/260e1f56
Branch: refs/heads/master
Commit: 260e1f56fc588140b8bb29f639a85bc4de33b144
Parents: 636cda0
Author: Max Woghiren <ma...@gmail.com>
Authored: Fri Feb 15 17:28:52 2013 -0500
Committer: Michael Brooks <mi...@michaelbrooks.ca>
Committed: Thu Mar 14 10:10:03 2013 -0700
----------------------------------------------------------------------
docs/en/edge/config.json | 3 +-
docs/en/edge/cordova/camera/camera.getPicture.md | 6 +-
.../camera/parameter/CameraPopoverHandle.md | 68 +++++++++++++++
3 files changed, 74 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/260e1f56/docs/en/edge/config.json
----------------------------------------------------------------------
diff --git a/docs/en/edge/config.json b/docs/en/edge/config.json
index f80fbf1..2af4a62 100644
--- a/docs/en/edge/config.json
+++ b/docs/en/edge/config.json
@@ -17,7 +17,8 @@
"cordova/camera/parameter/cameraSuccess.md",
"cordova/camera/parameter/cameraError.md",
"cordova/camera/parameter/cameraOptions.md",
- "cordova/camera/parameter/CameraPopoverOptions.md"
+ "cordova/camera/parameter/CameraPopoverOptions.md",
+ "cordova/camera/parameter/CameraPopoverHandle.md"
],
"capture.md": [
"cordova/media/capture/capture.md",
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/260e1f56/docs/en/edge/cordova/camera/camera.getPicture.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/camera/camera.getPicture.md b/docs/en/edge/cordova/camera/camera.getPicture.md
index e13377b..9dc038a 100644
--- a/docs/en/edge/cordova/camera/camera.getPicture.md
+++ b/docs/en/edge/cordova/camera/camera.getPicture.md
@@ -20,7 +20,9 @@ license: Licensed to the Apache Software Foundation (ASF) under one
camera.getPicture
=================
-Takes a photo using the camera or retrieves a photo from the device's album. The image is returned as a base64 encoded `String` or as the URI of an image file.
+Takes a photo using the camera or retrieves a photo from the device's album.
+The image is passed to the success callback as a base64 encoded `String` or as the URI of an image file.
+The method itself returns a CameraPopoverHandle object, which can be used to reposition the file selection popover.
navigator.camera.getPicture( cameraSuccess, cameraError, [ cameraOptions ] );
@@ -29,7 +31,7 @@ Description
Function `camera.getPicture` opens the device's default camera application so that the user can take a picture (if `Camera.sourceType = Camera.PictureSourceType.CAMERA`, which is the default). Once the photo is taken, the camera application closes and your application is restored.
-If `Camera.sourceType = Camera.PictureSourceType.PHOTOLIBRARY` or `Camera.PictureSourceType.SAVEDPHOTOALBUM`, then a photo chooser dialog is shown, from which a photo from the album can be selected.
+If `Camera.sourceType = Camera.PictureSourceType.PHOTOLIBRARY` or `Camera.PictureSourceType.SAVEDPHOTOALBUM`, then a photo chooser dialog is shown, from which a photo from the album can be selected. A `CameraPopoverHandle` object, which can be used to reposition the photo chooser dialog (eg. when the device orientation changes) is returned by `camera.getPicture`.
The return value will be sent to the `cameraSuccess` function, in one of the following formats, depending on the `cameraOptions` you specify:
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/260e1f56/docs/en/edge/cordova/camera/parameter/CameraPopoverHandle.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/camera/parameter/CameraPopoverHandle.md b/docs/en/edge/cordova/camera/parameter/CameraPopoverHandle.md
new file mode 100644
index 0000000..94ab149
--- /dev/null
+++ b/docs/en/edge/cordova/camera/parameter/CameraPopoverHandle.md
@@ -0,0 +1,68 @@
+---
+license: Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+---
+
+CameraPopoverHandle
+===================
+
+A handle to the popover dialog created by `camera.getPicture`.
+
+Methods
+-------
+
+- __setPosition:__ Set the position of the popover.
+
+Supported Platforms
+-------------------
+
+- iOS
+
+setPosition
+-----------
+
+Set the position of the popover.
+
+__Parameters:__
+- cameraPopoverOptions - the CameraPopoverOptions specifying the new position
+
+Quick Example
+-------------
+
+ var cameraPopoverOptions = new CameraPopoverOptions(300, 300, 100, 100, Camera.PopoverArrowDirection.ARROW_ANY);
+ cameraPopoverHandle.setPosition(cameraPopoverOptions);
+
+Full Example
+------------
+
+ function onSuccess(imageData) {
+ // Do stuff with the image!
+ }
+
+ function onFail(message) {
+ alert('Failed to get the picture: ' + message);
+ }
+
+ var cameraPopoverHandle = navigator.camera.getPicture(onSuccess, onFail,
+ { destinationType: Camera.DestinationType.FILE_URI,
+ sourceType: Camera.PictureSourceType.PHOTOLIBRARY });
+
+ // Reposition the popover if the orientation changes.
+ window.onorientationchange = function() {
+ var cameraPopoverOptions = new CameraPopoverOptions(0, 0, 100, 100, 0);
+ cameraPopoverHandle.setPosition(cameraPopoverOptions);
+ }