You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ripple.apache.org by br...@apache.org on 2014/11/16 20:48:22 UTC
[1/3] incubator-ripple git commit: RIPPLE 71: Adding BarcodeScanner
plugin support
Repository: incubator-ripple
Updated Branches:
refs/heads/master 520a149e4 -> 57c75494a
RIPPLE 71: Adding BarcodeScanner plugin support
Project: http://git-wip-us.apache.org/repos/asf/incubator-ripple/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ripple/commit/27d7470d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ripple/tree/27d7470d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ripple/diff/27d7470d
Branch: refs/heads/master
Commit: 27d7470d24642df7177ac26632e9eb428912ce47
Parents: cd50e49
Author: Ilya Buziuk <ib...@exadel.com>
Authored: Wed Oct 8 15:46:58 2014 +0300
Committer: Ilya Buziuk <ib...@exadel.com>
Committed: Fri Oct 10 18:07:57 2014 +0300
----------------------------------------------------------------------
assets/client/ripple.css | 48 ++++++++++
.../cordova/3.0.0/bridge/barcodescanner.js | 95 ++++++++++++++++++++
lib/client/platform/cordova/3.0.0/spec.js | 3 +
.../ui/plugins/barcode-encode/overlay.html | 27 ++++++
lib/client/ui/plugins/barcode-scan/dialog.html | 37 ++++++++
5 files changed, 210 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/27d7470d/assets/client/ripple.css
----------------------------------------------------------------------
diff --git a/assets/client/ripple.css b/assets/client/ripple.css
index 2cc2585..629451e 100644
--- a/assets/client/ripple.css
+++ b/assets/client/ripple.css
@@ -1241,3 +1241,51 @@ fieldset {
-webkit-transition: background 0.5s;
background-color: #66ccff;
}
+
+/* START - RIPPLE-71 Barcode Scanner styles */
+.skan-dialog-field-set label {
+ float: left;
+ width: 25%;
+ margin-right: 0.5em;
+ padding-top: 0.2em;
+ text-align: right;
+ font-weight: bold;
+}
+
+.skan-dialog-field-set select {
+ width: 305px;
+}
+
+.skan-dialog-field-set input[type=text] {
+ width: 300px;
+}
+
+.barcode-overlay {
+ z-index: 10000;
+ width: 100%;
+ height: 100%;
+ display: none;
+ background-color: white;
+}
+
+.barcode-close {
+ z-index: 10000;
+ width: 100%;
+ height: 100%;
+}
+
+.barcode-image {
+ z-index: 10000;
+ width: 100%;
+}
+
+.barcode-data {
+ z-index: 10000;
+ text-align: center;
+ font-family: Tahoma, Geneva, sans-serif;
+ font-size: 25px;
+ color: black;
+ padding: 20px;
+ background-color: white;
+}
+/* END - RIPPLE-71 Barcode Scanner styles */
http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/27d7470d/lib/client/platform/cordova/3.0.0/bridge/barcodescanner.js
----------------------------------------------------------------------
diff --git a/lib/client/platform/cordova/3.0.0/bridge/barcodescanner.js b/lib/client/platform/cordova/3.0.0/bridge/barcodescanner.js
new file mode 100644
index 0000000..e8803be
--- /dev/null
+++ b/lib/client/platform/cordova/3.0.0/bridge/barcodescanner.js
@@ -0,0 +1,95 @@
+/*
+ *
+ * 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.
+ *
+ */
+var ui = ripple('ui'),
+ serviceUrl = "https://chart.googleapis.com/chart?cht=qr&chs=300x300&chld=L|5&chl=";
+
+function _processScanOk(success) {
+ var scannedResult = {
+ cancelled: false,
+ text: $('#scannedText').val(),
+ format: $('#formatDropDown option:selected').text()
+ };
+ success(scannedResult);
+}
+
+function _processScanCancel(success) {
+ var scannedResult = {
+ cancelled: true,
+ text: "",
+ format: ""
+ };
+ success(scannedResult);
+}
+
+module.exports = {
+ scan: function(success, error, args) {
+ try {
+ // Showing the dialog
+ $("#scanDialog").dialog({
+ autoOpen: true,
+ modal: true,
+ title: "Barcode Scanner",
+ heigh: 50,
+ width: 510,
+ position: 'center',
+ resizable: false,
+ buttons: [{
+ text: "OK",
+ click: function() {
+ $(this).dialog('close');
+ _processScanOk(success);
+ },
+ class: "ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only small-button",
+ }, {
+ text: "Cancel",
+ click: function() {
+ $(this).dialog('close');
+ _processScanCancel(success);
+ },
+ class: "ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only small-button",
+ }]
+ });
+ } catch (err) {
+ error("Fail to emulate BarcodeScanner.scan() method"); // Something went wrong
+ }
+ },
+
+ // Uses google QR service - https://developers.google.com/chart/infographics/docs/qr_codes
+ encode: function(success, error, args) {
+ var data = args[0].data,
+ type = args[0].type,
+ url = serviceUrl + data;
+
+ try {
+
+ document.getElementById('barcodeClose').addEventListener("click", function() {
+ ui.hideOverlay("barcodeBackground");
+ });
+
+ $('#barcodeImage').attr("src", url); // Adding encoded image
+ $('#barcodeData').html(data); // Adding data
+ ui.showOverlay("barcodeBackground");
+ success(); // ?! on Android VM success function is never called ?!
+ } catch (err) {
+ error("Fail to emulate BarcodeScanner.encode() method"); // Something went wrong
+ }
+ }
+};
http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/27d7470d/lib/client/platform/cordova/3.0.0/spec.js
----------------------------------------------------------------------
diff --git a/lib/client/platform/cordova/3.0.0/spec.js b/lib/client/platform/cordova/3.0.0/spec.js
index d658af1..4c4553a 100644
--- a/lib/client/platform/cordova/3.0.0/spec.js
+++ b/lib/client/platform/cordova/3.0.0/spec.js
@@ -57,6 +57,9 @@ module.exports = {
/** external plugins **/
// scandit barcode scanner @see https://github.com/Scandit/BarcodeScannerPlugin
bridge.add("ScanditSDK", ripple('platform/cordova/3.0.0/bridge/scanditsdk'));
+
+ // RIPPLE-71 BarcodeScaner plugin support @see https://github.com/phonegap-build/BarcodeScanner
+ bridge.add("BarcodeScanner", ripple('platform/cordova/3.0.0/bridge/barcodescanner'));
honeypot.monitor(win, "cordova").andRun(get, set);
http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/27d7470d/lib/client/ui/plugins/barcode-encode/overlay.html
----------------------------------------------------------------------
diff --git a/lib/client/ui/plugins/barcode-encode/overlay.html b/lib/client/ui/plugins/barcode-encode/overlay.html
new file mode 100644
index 0000000..57c2b01
--- /dev/null
+++ b/lib/client/ui/plugins/barcode-encode/overlay.html
@@ -0,0 +1,27 @@
+<!--
+ *
+ * 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.
+ *
+-->
+<section id="barcodeBackground" class="barcode-overlay">
+ <img id="barcodeImage" class="barcode-image"></img>
+ <div id="barcodeData" class="barcode-data"></div>
+ <button id="barcodeClose" class="ui-button ui-widget ui-state-default ui-button-text-only small-button barcode-close">
+ <span class="ui-button-text">Close</span>
+ </button>
+</section>
http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/27d7470d/lib/client/ui/plugins/barcode-scan/dialog.html
----------------------------------------------------------------------
diff --git a/lib/client/ui/plugins/barcode-scan/dialog.html b/lib/client/ui/plugins/barcode-scan/dialog.html
new file mode 100644
index 0000000..7978f3b
--- /dev/null
+++ b/lib/client/ui/plugins/barcode-scan/dialog.html
@@ -0,0 +1,37 @@
+<!--
+ *
+ * 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.
+ *
+-->
+<div id="scanDialog" class="overlay-scan-dialog">
+ <fieldset id="skanDialogFieldSet" class="skan-dialog-field-set">
+ <label for="scannedText">Scanned Text:</label>
+ <input type="text" id="scannedText"></input>
+ <label for="formatDropDown">Format:</label>
+ <select id="formatDropDown">
+ <option value="QR_CODE">QR_CODE</option>
+ <option value="DATA_MATRIX">DATA_MATRIX</option>
+ <option value="UPC_E">UPC_E</option>
+ <option value="UPC_A">UPC_A</option>
+ <option value="EAN_8">EAN_8</option>
+ <option value="EAN_13">EAN_13</option>
+ <option value="CODE_128">CODE_128</option>
+ <option value="CODE_39">CODE_39</option>
+ </select>
+ </fieldset>
+</div>
[2/3] incubator-ripple git commit: Merge PR:
https://github.com/apache/incubator-ripple/pull/34
Posted by br...@apache.org.
Merge PR: https://github.com/apache/incubator-ripple/pull/34
Project: http://git-wip-us.apache.org/repos/asf/incubator-ripple/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ripple/commit/bd152f68
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ripple/tree/bd152f68
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ripple/diff/bd152f68
Branch: refs/heads/master
Commit: bd152f6876bbba642c20fca5d63e80430e8f014d
Parents: 520a149 27d7470
Author: Brent Lintner <br...@gmail.com>
Authored: Sun Nov 16 14:40:24 2014 -0500
Committer: Brent Lintner <br...@gmail.com>
Committed: Sun Nov 16 14:40:24 2014 -0500
----------------------------------------------------------------------
assets/client/ripple.css | 48 ++++++++++
.../cordova/3.0.0/bridge/barcodescanner.js | 95 ++++++++++++++++++++
lib/client/platform/cordova/3.0.0/spec.js | 3 +
.../ui/plugins/barcode-encode/overlay.html | 27 ++++++
lib/client/ui/plugins/barcode-scan/dialog.html | 37 ++++++++
5 files changed, 210 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/bd152f68/lib/client/platform/cordova/3.0.0/spec.js
----------------------------------------------------------------------
diff --cc lib/client/platform/cordova/3.0.0/spec.js
index 09ec687,4c4553a..b4055a3
--- a/lib/client/platform/cordova/3.0.0/spec.js
+++ b/lib/client/platform/cordova/3.0.0/spec.js
@@@ -57,9 -57,10 +57,12 @@@ module.exports =
/** external plugins **/
// scandit barcode scanner @see https://github.com/Scandit/BarcodeScannerPlugin
bridge.add("ScanditSDK", ripple('platform/cordova/3.0.0/bridge/scanditsdk'));
+
+ // RIPPLE-71 BarcodeScaner plugin support @see https://github.com/phonegap-build/BarcodeScanner
+ bridge.add("BarcodeScanner", ripple('platform/cordova/3.0.0/bridge/barcodescanner'));
+ bridge.add("NfcPlugin", ripple('platform/cordova/3.0.0/bridge/nfcdummy'));
+
honeypot.monitor(win, "cordova").andRun(get, set);
//HACK: BlackBerry does vibration different
[3/3] incubator-ripple git commit: A small lint.
Posted by br...@apache.org.
A small lint.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ripple/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ripple/commit/57c75494
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ripple/tree/57c75494
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ripple/diff/57c75494
Branch: refs/heads/master
Commit: 57c75494a8a15f3ce5352181fb1b781e85165e87
Parents: bd152f6
Author: Brent Lintner <br...@gmail.com>
Authored: Sun Nov 16 14:47:42 2014 -0500
Committer: Brent Lintner <br...@gmail.com>
Committed: Sun Nov 16 14:47:42 2014 -0500
----------------------------------------------------------------------
lib/client/platform/cordova/3.0.0/bridge/barcodescanner.js | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ripple/blob/57c75494/lib/client/platform/cordova/3.0.0/bridge/barcodescanner.js
----------------------------------------------------------------------
diff --git a/lib/client/platform/cordova/3.0.0/bridge/barcodescanner.js b/lib/client/platform/cordova/3.0.0/bridge/barcodescanner.js
index e8803be..441e399 100644
--- a/lib/client/platform/cordova/3.0.0/bridge/barcodescanner.js
+++ b/lib/client/platform/cordova/3.0.0/bridge/barcodescanner.js
@@ -75,7 +75,6 @@ module.exports = {
// Uses google QR service - https://developers.google.com/chart/infographics/docs/qr_codes
encode: function(success, error, args) {
var data = args[0].data,
- type = args[0].type,
url = serviceUrl + data;
try {