You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/12/05 01:55:56 UTC
[1/9] git commit: add ubuntu platform
Updated Branches:
refs/heads/master e0176cc61 -> 0d9428992
add ubuntu platform
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/commit/b44ea1c6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/b44ea1c6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/b44ea1c6
Branch: refs/heads/master
Commit: b44ea1c69fc295dc5064651f717b0fbd23a6ab10
Parents: fed4f22
Author: Maxim Ermilov <ma...@canonical.com>
Authored: Sat Oct 26 06:17:04 2013 +0400
Committer: Maxim Ermilov <ma...@canonical.com>
Committed: Sat Oct 26 06:17:04 2013 +0400
----------------------------------------------------------------------
plugin.xml | 16 +++++
src/ubuntu/CaptureWidget.qml | 119 ++++++++++++++++++++++++++++++
src/ubuntu/back.png | Bin 0 -> 12428 bytes
src/ubuntu/camera.cpp | 143 +++++++++++++++++++++++++++++++++++++
src/ubuntu/camera.h | 76 ++++++++++++++++++++
src/ubuntu/shoot.png | Bin 0 -> 14430 bytes
src/ubuntu/toolbar-left.png | Bin 0 -> 1212 bytes
src/ubuntu/toolbar-middle.png | Bin 0 -> 4416 bytes
src/ubuntu/toolbar-right.png | Bin 0 -> 1161 bytes
9 files changed, 354 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/b44ea1c6/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 1327534..53b5529 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -44,6 +44,22 @@
</platform>
+ <!-- ubuntu -->
+ <platform name="ubuntu">
+ <js-module src="www/CameraPopoverHandle.js" name="CameraPopoverHandle">
+ <clobbers target="CameraPopoverHandle" />
+ </js-module>
+ <header-file src="src/ubuntu/camera.h" />
+ <source-file src="src/ubuntu/camera.cpp" />
+
+ <resource-file src="src/ubuntu/back.png" />
+ <resource-file src="src/ubuntu/CaptureWidget.qml" />
+ <resource-file src="src/ubuntu/shoot.png" />
+ <resource-file src="src/ubuntu/toolbar-left.png" />
+ <resource-file src="src/ubuntu/toolbar-middle.png" />
+ <resource-file src="src/ubuntu/toolbar-right.png" />
+ </platform>
+
<!-- ios -->
<platform name="ios">
<config-file target="config.xml" parent="/*">
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/b44ea1c6/src/ubuntu/CaptureWidget.qml
----------------------------------------------------------------------
diff --git a/src/ubuntu/CaptureWidget.qml b/src/ubuntu/CaptureWidget.qml
new file mode 100644
index 0000000..e3fe20e
--- /dev/null
+++ b/src/ubuntu/CaptureWidget.qml
@@ -0,0 +1,119 @@
+/*
+ *
+ * Copyright 2013 Canonical Ltd.
+ *
+ * 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.
+ *
+*/
+import QtQuick 2.0
+import QtMultimedia 5.0
+
+Rectangle {
+ property string shootImagePath: "shoot.png"
+ function isSuffix(str, suffix) {
+ return String(str).substr(String(str).length - suffix.length) == suffix
+ }
+
+ id: ui
+ color: "#252423"
+ anchors.fill: parent
+
+ Camera {
+ objectName: "camera"
+ id: camera
+ onError: {
+ console.log(errorString);
+ }
+ videoRecorder.audioBitRate: 128000
+ videoRecorder.mediaContainer: "mp4"
+ imageCapture {
+ onImageSaved: {
+ root.exec("Camera", "onImageSaved", [path]);
+ ui.destroy();
+ }
+ }
+ }
+ VideoOutput {
+ id: output
+ source: camera
+ width: parent.width
+ height: parent.height
+ }
+
+ Item {
+ anchors.bottom: parent.bottom
+ width: parent.width
+ height: shootButton.height
+ BorderImage {
+ id: leftBackground
+ anchors.left: parent.left
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.right: middle.left
+ anchors.topMargin: units.dp(2)
+ anchors.bottomMargin: units.dp(2)
+ source: "toolbar-left.png"
+ Image {
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.leftMargin: parent.iconSpacing
+ source: "back.png"
+ width: units.gu(6)
+ height: units.gu(5)
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ root.exec("Camera", "cancel");
+ }
+ }
+ }
+ }
+ BorderImage {
+ id: middle
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ height: shootButton.height + units.gu(1)
+ width: shootButton.width
+ source: "toolbar-middle.png"
+ Image {
+ id: shootButton
+ width: units.gu(8)
+ height: width
+ anchors.horizontalCenter: parent.horizontalCenter
+ source: shootImagePath
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ camera.imageCapture.capture();
+ }
+ }
+ }
+ }
+ BorderImage {
+ id: rightBackground
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
+ anchors.left: middle.right
+ anchors.topMargin: units.dp(2)
+ anchors.bottomMargin: units.dp(2)
+ source: "toolbar-right.png"
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/b44ea1c6/src/ubuntu/back.png
----------------------------------------------------------------------
diff --git a/src/ubuntu/back.png b/src/ubuntu/back.png
new file mode 100644
index 0000000..af78faa
Binary files /dev/null and b/src/ubuntu/back.png differ
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/b44ea1c6/src/ubuntu/camera.cpp
----------------------------------------------------------------------
diff --git a/src/ubuntu/camera.cpp b/src/ubuntu/camera.cpp
new file mode 100644
index 0000000..eada5dc
--- /dev/null
+++ b/src/ubuntu/camera.cpp
@@ -0,0 +1,143 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+#include "camera.h"
+#include <cordova.h>
+
+#include <QCameraViewfinder>
+#include <QCameraImageCapture>
+#include <QGraphicsObject>
+#include <QCloseEvent>
+#include <QQuickItem>
+
+const char code[] = "\
+var component, object; \
+function createObject() { \
+ component = Qt.createComponent(%1); \
+ if (component.status == Component.Ready) \
+ finishCreation(); \
+ else \
+ component.statusChanged.connect(finishCreation); \
+} \
+function finishCreation() { \
+ CordovaWrapper.object = component.createObject(root, \
+ {root: root, cordova: cordova}); \
+} \
+createObject()";
+
+
+Camera::Camera(Cordova *cordova):
+ CPlugin(cordova),
+ _lastScId(0),
+ _lastEcId(0) {
+}
+
+bool Camera::preprocessImage(QString &path) {
+ bool convertToPNG = (*_options.find("encodingType")).toInt() == Camera::PNG;
+ int quality = (*_options.find("quality")).toInt();
+ int width = (*_options.find("targetWidth")).toInt();
+ int height = (*_options.find("targetHeight")).toInt();
+
+ QImage image(path);
+ if (width <= 0)
+ width = image.width();
+ if (height <= 0)
+ height = image.height();
+ image = image.scaled(width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+
+ QFile oldImage(path);
+ QTemporaryFile newImage;
+
+ const char *type;
+ if (convertToPNG) {
+ newImage.setFileTemplate("imgXXXXXX.png");
+ type = "png";
+ } else {
+ newImage.setFileTemplate("imgXXXXXX.jpg");
+ type = "jpg";
+ }
+
+ newImage.open();
+ newImage.setAutoRemove(false);
+ image.save(newImage.fileName(), type, quality);
+
+ path = newImage.fileName();
+ oldImage.remove();
+
+ return true;
+}
+
+void Camera::onImageSaved(QString path) {
+ bool dataURL = _options.find("destinationType")->toInt() == Camera::DATA_URL;
+
+ QString cbParams;
+ if (preprocessImage(path)) {
+ QString absolutePath = QFileInfo(path).absoluteFilePath();
+ if (dataURL) {
+ QFile image(absolutePath);
+ image.open(QIODevice::ReadOnly);
+ QByteArray content = image.readAll().toBase64();
+ cbParams = QString("\"%1\"").arg(content.data());
+ image.remove();
+ } else {
+ cbParams = CordovaInternal::format(QUrl::fromLocalFile(absolutePath).toString());
+ }
+ }
+
+ this->callback(_lastScId, cbParams);
+
+ _lastEcId = _lastScId = 0;
+}
+
+void Camera::takePicture(int scId, int ecId, int quality, int destinationType, int/*sourceType*/, int targetWidth, int targetHeight, int encodingType,
+ int/*mediaType*/, bool/*allowEdit*/, bool/*correctOrientation*/, bool/*saveToPhotoAlbum*/, const QVariantMap &/*popoverOptions*/, int/*cameraDirection*/) {
+ if (_camera.isNull()) {
+ _camera = QSharedPointer<QCamera>(new QCamera());
+ }
+
+ if (((_lastScId || _lastEcId) && (_lastScId != scId && _lastEcId != ecId)) || !_camera->isAvailable() || _camera->lockStatus() != QCamera::Unlocked) {
+ this->cb(_lastEcId, "Device is busy");
+ return;
+ }
+
+ _options.clear();
+ _options.insert("quality", quality);
+ _options.insert("destinationType", destinationType);
+ _options.insert("targetWidth", targetWidth);
+ _options.insert("targetHeight", targetHeight);
+ _options.insert("encodingType", encodingType);
+
+ _lastScId = scId;
+ _lastEcId = ecId;
+
+ QString path = m_cordova->get_app_dir() + "/../qml/CaptureWidget.qml";
+
+ // TODO: relative url
+ QString qml = QString(code).arg(CordovaInternal::format(path));
+ m_cordova->execQML(qml);
+}
+
+void Camera::cancel() {
+ m_cordova->execQML("CordovaWrapper.object.destroy()");
+ this->cb(_lastEcId, "canceled");
+
+ _lastEcId = _lastScId = 0;
+}
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/b44ea1c6/src/ubuntu/camera.h
----------------------------------------------------------------------
diff --git a/src/ubuntu/camera.h b/src/ubuntu/camera.h
new file mode 100644
index 0000000..aa06698
--- /dev/null
+++ b/src/ubuntu/camera.h
@@ -0,0 +1,76 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+#ifndef CAMERA_H
+#define CAMERA_H
+
+#include <cplugin.h>
+
+#include <QtCore>
+#include <QQuickView>
+#include <QCamera>
+#include <QtMultimediaWidgets/QCameraViewfinder>
+#include <QCameraImageCapture>
+
+class Camera: public CPlugin {
+ Q_OBJECT
+public:
+ explicit Camera(Cordova *cordova);
+
+ virtual const QString fullName() override {
+ return Camera::fullID();
+ }
+
+ virtual const QString shortName() override {
+ return "Camera";
+ }
+
+ static const QString fullID() {
+ return "Camera";
+ }
+
+public slots:
+ void takePicture(int scId, int ecId, int quality, int destinationType, int/*sourceType*/, int targetWidth, int targetHeight, int encodingType,
+ int/*mediaType*/, bool/*allowEdit*/, bool/*correctOrientation*/, bool/*saveToPhotoAlbum*/, const QVariantMap &popoverOptions, int cameraDirection);
+ void cancel();
+
+ void onImageSaved(QString path);
+
+private:
+ bool preprocessImage(QString &path);
+
+ int _lastScId;
+ int _lastEcId;
+ QSharedPointer<QCamera> _camera;
+
+ QVariantMap _options;
+protected:
+ enum DestinationType {
+ DATA_URL = 0,
+ FILE_URI = 1
+ };
+ enum EncodingType {
+ JPEG = 0,
+ PNG = 1
+ };
+};
+
+#endif // CAMERA_H
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/b44ea1c6/src/ubuntu/shoot.png
----------------------------------------------------------------------
diff --git a/src/ubuntu/shoot.png b/src/ubuntu/shoot.png
new file mode 100644
index 0000000..c093b63
Binary files /dev/null and b/src/ubuntu/shoot.png differ
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/b44ea1c6/src/ubuntu/toolbar-left.png
----------------------------------------------------------------------
diff --git a/src/ubuntu/toolbar-left.png b/src/ubuntu/toolbar-left.png
new file mode 100644
index 0000000..720d7f6
Binary files /dev/null and b/src/ubuntu/toolbar-left.png differ
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/b44ea1c6/src/ubuntu/toolbar-middle.png
----------------------------------------------------------------------
diff --git a/src/ubuntu/toolbar-middle.png b/src/ubuntu/toolbar-middle.png
new file mode 100644
index 0000000..77595bb
Binary files /dev/null and b/src/ubuntu/toolbar-middle.png differ
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/b44ea1c6/src/ubuntu/toolbar-right.png
----------------------------------------------------------------------
diff --git a/src/ubuntu/toolbar-right.png b/src/ubuntu/toolbar-right.png
new file mode 100644
index 0000000..e4e6aa6
Binary files /dev/null and b/src/ubuntu/toolbar-right.png differ
[6/9] git commit: added ubuntu support
Posted by st...@apache.org.
added ubuntu support
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/commit/a6736cda
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/a6736cda
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/a6736cda
Branch: refs/heads/master
Commit: a6736cda71933d2d00c9d5c25cda805d724d35f7
Parents: d8a3d2f 885c6a7
Author: Steven Gill <st...@gmail.com>
Authored: Mon Dec 2 15:11:12 2013 -0800
Committer: Steven Gill <st...@gmail.com>
Committed: Mon Dec 2 15:11:12 2013 -0800
----------------------------------------------------------------------
plugin.xml | 21 ++++++
src/ubuntu/CaptureWidget.qml | 119 ++++++++++++++++++++++++++++++
src/ubuntu/back.png | Bin 0 -> 12428 bytes
src/ubuntu/camera.cpp | 143 +++++++++++++++++++++++++++++++++++++
src/ubuntu/camera.h | 76 ++++++++++++++++++++
src/ubuntu/shoot.png | Bin 0 -> 14430 bytes
src/ubuntu/toolbar-left.png | Bin 0 -> 1212 bytes
src/ubuntu/toolbar-middle.png | Bin 0 -> 4416 bytes
src/ubuntu/toolbar-right.png | Bin 0 -> 1161 bytes
9 files changed, 359 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/a6736cda/plugin.xml
----------------------------------------------------------------------
diff --cc plugin.xml
index f441c6e,a7da775..fda60c6
--- a/plugin.xml
+++ b/plugin.xml
@@@ -46,27 -44,27 +46,48 @@@
</platform>
+ <!-- amazon-fireos -->
+ <platform name="amazon-fireos">
+ <config-file target="res/xml/config.xml" parent="/*">
+ <feature name="Camera">
+ <param name="android-package" value="org.apache.cordova.camera.CameraLauncher"/>
+ </feature>
+ </config-file>
+ <config-file target="AndroidManifest.xml" parent="/*">
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ </config-file>
+
+ <source-file src="src/android/CameraLauncher.java" target-dir="src/org/apache/cordova/camera" />
+ <source-file src="src/android/FileHelper.java" target-dir="src/org/apache/cordova/camera" />
+ <source-file src="src/android/ExifHelper.java" target-dir="src/org/apache/cordova/camera" />
+
+ <js-module src="www/CameraPopoverHandle.js" name="CameraPopoverHandle">
+ <clobbers target="CameraPopoverHandle" />
+ </js-module>
+
+ </platform>
+
+ <!-- ubuntu -->
+ <platform name="ubuntu">
+ <config-file target="config.xml" parent="/*">
+ <feature name="Camera">
+ <param policy_group="camera" policy_version="1" />
+ </feature>
+ </config-file>
+ <js-module src="www/CameraPopoverHandle.js" name="CameraPopoverHandle">
+ <clobbers target="CameraPopoverHandle" />
+ </js-module>
+ <header-file src="src/ubuntu/camera.h" />
+ <source-file src="src/ubuntu/camera.cpp" />
+
+ <resource-file src="src/ubuntu/back.png" />
+ <resource-file src="src/ubuntu/CaptureWidget.qml" />
+ <resource-file src="src/ubuntu/shoot.png" />
+ <resource-file src="src/ubuntu/toolbar-left.png" />
+ <resource-file src="src/ubuntu/toolbar-middle.png" />
+ <resource-file src="src/ubuntu/toolbar-right.png" />
+ </platform>
+
<!-- ios -->
<platform name="ios">
<config-file target="config.xml" parent="/*">
[3/9] git commit: Added amazon-fireos platform.
Posted by st...@apache.org.
Added amazon-fireos platform.
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/commit/4590f259
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/4590f259
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/4590f259
Branch: refs/heads/master
Commit: 4590f2597c70cd9ef73852510a8e4d0c800d6e16
Parents: 7c35f56
Author: Archana Naik <na...@lab126.com>
Authored: Fri Oct 18 10:43:26 2013 -0700
Committer: Archana Naik <na...@lab126.com>
Committed: Wed Oct 30 11:49:00 2013 -0700
----------------------------------------------------------------------
plugin.xml | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/4590f259/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index b43c9ff..f441c6e 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -46,6 +46,27 @@
</platform>
+ <!-- amazon-fireos -->
+ <platform name="amazon-fireos">
+ <config-file target="res/xml/config.xml" parent="/*">
+ <feature name="Camera">
+ <param name="android-package" value="org.apache.cordova.camera.CameraLauncher"/>
+ </feature>
+ </config-file>
+ <config-file target="AndroidManifest.xml" parent="/*">
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ </config-file>
+
+ <source-file src="src/android/CameraLauncher.java" target-dir="src/org/apache/cordova/camera" />
+ <source-file src="src/android/FileHelper.java" target-dir="src/org/apache/cordova/camera" />
+ <source-file src="src/android/ExifHelper.java" target-dir="src/org/apache/cordova/camera" />
+
+ <js-module src="www/CameraPopoverHandle.js" name="CameraPopoverHandle">
+ <clobbers target="CameraPopoverHandle" />
+ </js-module>
+
+ </platform>
+
<!-- ios -->
<platform name="ios">
<config-file target="config.xml" parent="/*">
[4/9] git commit: 1. User Agent detection now detects AmazonWebView.
2. Change to use amazon-fireos as the platform if user agent string contains
'cordova-amazon-fireos'
Posted by st...@apache.org.
1. User Agent detection now detects AmazonWebView.
2. Change to use amazon-fireos as the platform if user agent string contains 'cordova-amazon-fireos'
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/commit/d8a3d2ff
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/d8a3d2ff
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/d8a3d2ff
Branch: refs/heads/master
Commit: d8a3d2ff3a5d8670d5c46521be6617a6db23997f
Parents: 4590f25
Author: Archana Naik <na...@lab126.com>
Authored: Fri Oct 18 10:48:04 2013 -0700
Committer: Archana Naik <na...@lab126.com>
Committed: Wed Oct 30 11:49:00 2013 -0700
----------------------------------------------------------------------
test/cordova-incl.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/d8a3d2ff/test/cordova-incl.js
----------------------------------------------------------------------
diff --git a/test/cordova-incl.js b/test/cordova-incl.js
index dbcd1a6..bc1dd7a 100644
--- a/test/cordova-incl.js
+++ b/test/cordova-incl.js
@@ -20,7 +20,9 @@
*/
var PLAT;
-if (/Android/.exec(navigator.userAgent)) {
+if (/cordova-amazon-fireos/.exec(navigator.userAgent)) {
+ PLAT = 'amazon-fireos';
+}else if (/Android/.exec(navigator.userAgent)) {
PLAT = 'android';
} else if (/(iPad)|(iPhone)|(iPod)/.exec(navigator.userAgent)) {
PLAT = 'ios';
@@ -61,7 +63,7 @@ if (!window._doNotWriteCordovaScript) {
}
function backHome() {
- if (window.device && device.platform && device.platform.toLowerCase() == 'android') {
+ if (window.device && device.platform && (device.platform.toLowerCase() == 'android' || device.platform.toLowerCase() == 'amazon-fireos')) {
navigator.app.backHistory();
}
else {
[8/9] git commit: fix camera for firefox os
Posted by st...@apache.org.
fix camera for firefox os
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/commit/3424ddb3
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/3424ddb3
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/3424ddb3
Branch: refs/heads/master
Commit: 3424ddb39c25d28ccb976a817b7af9d371381447
Parents: e8e4208
Author: James Long <lo...@gmail.com>
Authored: Tue Oct 29 15:40:18 2013 -0400
Committer: hermwong <he...@gmail.com>
Committed: Tue Dec 3 13:10:25 2013 -0800
----------------------------------------------------------------------
src/firefoxos/CameraProxy.js | 49 +++++++++++++++++++--------------------
1 file changed, 24 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/3424ddb3/src/firefoxos/CameraProxy.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/CameraProxy.js b/src/firefoxos/CameraProxy.js
index bbed304..9afb343 100644
--- a/src/firefoxos/CameraProxy.js
+++ b/src/firefoxos/CameraProxy.js
@@ -17,36 +17,35 @@
* specific language governing permissions and limitations
* under the License.
*
-*/
+ */
+function takePicture(success, error, opts) {
+ var pick = new MozActivity({
+ name: "pick",
+ data: {
+ type: ["image/*"]
+ }
+ });
+ pick.onerror = error || function() {};
-function getPicture(cameraSuccess, cameraError, cameraOptions) {
- cameraError = cameraError || function(){};
- var pick = new MozActivity({
- name: "pick",
- data: {
- type: ["image/png", "image/jpg", "image/jpeg"]
- }
- });
- pick.onerror = cameraError;
- pick.onsuccess = function() {
- // image is returned as Blob in this.result.blob
- // we need to call cameraSuccess with url or base64 encoded image
- if (cameraOptions && cameraOptions.destinationType == 0) {
- // TODO: base64
- return;
- }
- if (!cameraOptions || !cameraOptions.destinationType || cameraOptions.destinationType > 0) {
- // url
- return cameraSuccess(window.URL.createObjectURL(this.result.blob));
- }
- };
+ pick.onsuccess = function() {
+ // image is returned as Blob in this.result.blob
+ // we need to call success with url or base64 encoded image
+ if (opts && opts.destinationType == 0) {
+ // TODO: base64
+ return;
+ }
+ if (!opts || !opts.destinationType || opts.destinationType > 0) {
+ // url
+ return success(window.URL.createObjectURL(this.result.blob));
+ }
+ };
}
module.exports = {
- getPicture: getPicture,
- cleanup: function(){}
+ takePicture: takePicture,
+ cleanup: function(){}
};
-require("cordova/firefoxos/commandProxy").add("Camera", module.exports);
\ No newline at end of file
+require("cordova/firefoxos/commandProxy").add("Camera", module.exports);
[5/9] git commit: [ubuntu] specify policy_group
Posted by st...@apache.org.
[ubuntu] specify policy_group
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/commit/885c6a74
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/885c6a74
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/885c6a74
Branch: refs/heads/master
Commit: 885c6a745987e17538b545fdfa6fe1ddcb620f94
Parents: b44ea1c
Author: Maxim Ermilov <ma...@canonical.com>
Authored: Mon Nov 11 17:59:22 2013 +0400
Committer: Maxim Ermilov <ma...@canonical.com>
Committed: Mon Nov 11 17:59:22 2013 +0400
----------------------------------------------------------------------
plugin.xml | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/885c6a74/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 53b5529..a7da775 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -46,6 +46,11 @@
<!-- ubuntu -->
<platform name="ubuntu">
+ <config-file target="config.xml" parent="/*">
+ <feature name="Camera">
+ <param policy_group="camera" policy_version="1" />
+ </feature>
+ </config-file>
<js-module src="www/CameraPopoverHandle.js" name="CameraPopoverHandle">
<clobbers target="CameraPopoverHandle" />
</js-module>
[7/9] git commit: getPicture via web activities
Posted by st...@apache.org.
getPicture via web activities
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/commit/e8e42089
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/e8e42089
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/e8e42089
Branch: refs/heads/master
Commit: e8e420895eb45bf0b5d5094060429c164ef38364
Parents: a6736cd
Author: Piotr Zalewa <pi...@zalewa.info>
Authored: Fri Sep 20 19:59:05 2013 +0200
Committer: hermwong <he...@gmail.com>
Committed: Tue Dec 3 13:09:27 2013 -0800
----------------------------------------------------------------------
plugin.xml | 12 ++++++++++++
src/firefoxos/camera.js | 32 ++++++++++++++++++++++++++++++++
www/Camera.js | 8 +++++---
3 files changed, 49 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/e8e42089/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index fda60c6..078a6c6 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -25,6 +25,18 @@
<clobbers target="navigator.camera" />
</js-module>
+ <!-- firefoxos -->
+ <platform name="firefoxos">
+ <config-file target="config.xml" parent="/*">
+ <feature name="Camera">
+ <param name="firefoxos-package" value="Camera" />
+ </feature>
+ </config-file>
+
+ <js-module src="src/firefoxos/camera.js" name="camera-impl">
+ <runs />
+ </js-module>
+ </platform>
<!-- android -->
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/e8e42089/src/firefoxos/camera.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/camera.js b/src/firefoxos/camera.js
new file mode 100644
index 0000000..270f221
--- /dev/null
+++ b/src/firefoxos/camera.js
@@ -0,0 +1,32 @@
+
+var firefoxos = require('cordova/platform');
+
+function getPicture(cameraSuccess, cameraError, cameraOptions) {
+ cameraError = cameraError || function(){};
+ var pick = new MozActivity({
+ name: "pick",
+ data: {
+ type: ["image/png", "image/jpg", "image/jpeg"]
+ }
+ });
+ pick.onerror = cameraError;
+ pick.onsuccess = function() {
+ // image is returned as Blob in this.result.blob
+ // we need to call cameraSuccess with url or base64 encoded image
+ if (cameraOptions && cameraOptions.destinationType == 0) {
+ // TODO: base64
+ return;
+ }
+ if (!cameraOptions || !cameraOptions.destinationTyoe || cameraOptions.destinationType > 0) {
+ // url
+ return cameraSuccess(window.URL.createObjectURL(this.result.blob));
+ }
+ };
+}
+var Camera = {
+ takePicture: getPicture,
+ cleanup: function(){}
+};
+
+firefoxos.registerPlugin('Camera', Camera);
+
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/e8e42089/www/Camera.js
----------------------------------------------------------------------
diff --git a/www/Camera.js b/www/Camera.js
index b2da5da..555bb5e 100644
--- a/www/Camera.js
+++ b/www/Camera.js
@@ -21,8 +21,9 @@
var argscheck = require('cordova/argscheck'),
exec = require('cordova/exec'),
- Camera = require('./Camera'),
- CameraPopoverHandle = require('./CameraPopoverHandle');
+ Camera = require('./Camera');
+ // XXX: commented out
+ //CameraPopoverHandle = require('./CameraPopoverHandle');
var cameraExport = {};
@@ -63,7 +64,8 @@ cameraExport.getPicture = function(successCallback, errorCallback, options) {
mediaType, allowEdit, correctOrientation, saveToPhotoAlbum, popoverOptions, cameraDirection];
exec(successCallback, errorCallback, "Camera", "takePicture", args);
- return new CameraPopoverHandle();
+ // XXX: commented out
+ //return new CameraPopoverHandle();
};
cameraExport.cleanup = function(successCallback, errorCallback) {
[9/9] git commit: [CB-5565] Updated version and RELEASENOTES.md for
release 0.2.5
Posted by st...@apache.org.
[CB-5565] Updated version and RELEASENOTES.md for release 0.2.5
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/commit/0d942899
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/0d942899
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/0d942899
Branch: refs/heads/master
Commit: 0d94289921be32786f849174fbb3a4739207274a
Parents: 3424ddb
Author: Steven Gill <st...@gmail.com>
Authored: Wed Dec 4 15:16:30 2013 -0800
Committer: Steven Gill <st...@gmail.com>
Committed: Wed Dec 4 15:16:30 2013 -0800
----------------------------------------------------------------------
RELEASENOTES.md | 10 +++++++++-
plugin.xml | 2 +-
2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/0d942899/RELEASENOTES.md
----------------------------------------------------------------------
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index 75b32d1..dbf7c80 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -46,4 +46,12 @@
* CB-5128: added repo + issue tag to plugin.xml for camera plugin
* CB-4958 - iOS - Camera plugin should not show the status bar
* [CB-4919] updated plugin.xml for FxOS
-* [CB-4915] Incremented plugin version on dev branch.
\ No newline at end of file
+* [CB-4915] Incremented plugin version on dev branch.
+
+### 0.2.5 (Dec 4, 2013)
+* fix camera for firefox os
+* getPicture via web activities
+* [ubuntu] specify policy_group
+* add ubuntu platform
+* 1. User Agent detection now detects AmazonWebView. 2. Change to use amazon-fireos as the platform if user agent string contains 'cordova-amazon-fireos'
+* Added amazon-fireos platform.
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/0d942899/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 078a6c6..3e92811 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -3,7 +3,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="org.apache.cordova.camera"
- version="0.2.5-dev">
+ version="0.2.5">
<name>Camera</name>
<description>Cordova Camera Plugin</description>
<license>Apache 2.0</license>
[2/9] git commit: CB-5188:
Posted by st...@apache.org.
CB-5188:
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/commit/7c35f56a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/7c35f56a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/7c35f56a
Branch: refs/heads/master
Commit: 7c35f56a0d1b7421526b1068fe75429773052ccf
Parents: e0176cc
Author: Steven Gill <st...@gmail.com>
Authored: Mon Oct 28 12:27:13 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Mon Oct 28 12:27:13 2013 -0700
----------------------------------------------------------------------
plugin.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/7c35f56a/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 3312571..b43c9ff 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -3,7 +3,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="org.apache.cordova.camera"
- version="0.2.4">
+ version="0.2.5-dev">
<name>Camera</name>
<description>Cordova Camera Plugin</description>
<license>Apache 2.0</license>