mirror of
https://github.com/wahyd4/BarcodeScanner.git
synced 2026-08-13 15:05:54 +10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12be23d657 | ||
|
|
12ecfd7f55 | ||
|
|
933525da37 | ||
|
|
7ad74807c3 | ||
|
|
4ed50488b6 | ||
|
|
91d7e9aa4a | ||
|
|
eab15a370a | ||
|
|
a7bf6fc2c0 | ||
|
|
7d831d83ed | ||
|
|
ec4de624ae | ||
|
|
ba3c96c386 | ||
|
|
24acf29896 | ||
|
|
a310fda2d7 | ||
|
|
8bf3cce073 | ||
|
|
2d8701634f | ||
|
|
7880bf7b5c | ||
|
|
12a31b76b0 | ||
|
|
a2857ba5f8 | ||
|
|
f046f651ce | ||
|
|
6ad6dafc11 | ||
|
|
14d63e35ac | ||
|
|
d901977064 | ||
|
|
7094cc6eda | ||
|
|
fc3dcd56d1 | ||
|
|
50a2f8bf52 | ||
|
|
8966e5207f | ||
|
|
8fa142ca9d | ||
|
|
6fd905a8e6 | ||
|
|
32880fc1fa | ||
|
|
903b02f142 | ||
|
|
6fdac151eb | ||
|
|
c84bf0e66d | ||
|
|
e728d33155 | ||
|
|
5833a1fa9e | ||
|
|
9ed602fdac | ||
|
|
06b05fc6c9 | ||
|
|
2f86c728e5 | ||
|
|
01a74e4c6c | ||
|
|
cf2be813cb |
@@ -1,12 +1,15 @@
|
|||||||
BarcodeScanner
|
BarcodeScanner
|
||||||
==============
|
==============
|
||||||
|
|
||||||
|
Added version that runs with windows mobile devices.
|
||||||
|
To run on those devices, the zxing.net library must be added to the project (Install as nuget packet - more information on http://www.nuget.org/packages/ZXing.Net)
|
||||||
|
|
||||||
|
Windows Phone currently only supports Scaning for codes, feel free to extend it that it can also encode.
|
||||||
|
|
||||||
Cross-platform BarcodeScanner for Cordova / PhoneGap.
|
Cross-platform BarcodeScanner for Cordova / PhoneGap.
|
||||||
|
|
||||||
Follows the [Cordova Plugin spec](https://github.com/apache/cordova-plugman/blob/master/plugin_spec.md), so that it works with [Plugman](https://github.com/apache/cordova-plugman).
|
Follows the [Cordova Plugin spec](https://github.com/apache/cordova-plugman/blob/master/plugin_spec.md), so that it works with [Plugman](https://github.com/apache/cordova-plugman).
|
||||||
|
|
||||||
This plugin leverages Cordova/PhoneGap's [require/define functionality used for plugins](http://simonmacdonald.blogspot.ca/2012/08/so-you-wanna-write-phonegap-200-android.html).
|
|
||||||
|
|
||||||
Note: the Android source for this project includes an Android Library Project.
|
Note: the Android source for this project includes an Android Library Project.
|
||||||
plugman currently doesn't support Library Project refs, so its been
|
plugman currently doesn't support Library Project refs, so its been
|
||||||
prebuilt as a jar library. Any updates to the Library Project should be
|
prebuilt as a jar library. Any updates to the Library Project should be
|
||||||
@@ -49,9 +52,7 @@ The following barcode types are currently supported:
|
|||||||
|
|
||||||
A full example could be:
|
A full example could be:
|
||||||
```
|
```
|
||||||
var scanner = cordova.require("cordova/plugin/BarcodeScanner");
|
cordova.plugins.barcodeScanner.scan(
|
||||||
|
|
||||||
scanner.scan(
|
|
||||||
function (result) {
|
function (result) {
|
||||||
alert("We got a barcode\n" +
|
alert("We got a barcode\n" +
|
||||||
"Result: " + result.text + "\n" +
|
"Result: " + result.text + "\n" +
|
||||||
@@ -65,7 +66,7 @@ A full example could be:
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Encoding a Barcode ##
|
## Encoding a Barcode ##
|
||||||
The plugin creates the object `window.plugins.barcodeScanner` with the method `encode(type, data, success, fail)`.
|
The plugin creates the object `cordova.plugins.barcodeScanner` with the method `encode(type, data, success, fail)`.
|
||||||
Supported encoding types:
|
Supported encoding types:
|
||||||
|
|
||||||
* TEXT_TYPE
|
* TEXT_TYPE
|
||||||
@@ -76,9 +77,7 @@ Supported encoding types:
|
|||||||
```
|
```
|
||||||
A full example could be:
|
A full example could be:
|
||||||
|
|
||||||
var scanner = cordova.require("cordova/plugin/BarcodeScanner");
|
cordova.plugins.barcodeScanner.encode(BarcodeScanner.Encode.TEXT_TYPE, "http://www.nytimes.com", function(success) {
|
||||||
|
|
||||||
scanner.encode(BarcodeScanner.Encode.TEXT_TYPE, "http://www.nytimes.com", function(success) {
|
|
||||||
alert("encode success: " + success);
|
alert("encode success: " + success);
|
||||||
}, function(fail) {
|
}, function(fail) {
|
||||||
alert("encoding failed: " + fail);
|
alert("encoding failed: " + fail);
|
||||||
|
|||||||
+259
-223
@@ -1,41 +1,70 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?><plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
|
<?xml version="1.0" encoding="UTF-8"?><plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
id="com.phonegap.plugins.barcodescanner"
|
id="com.phonegap.plugins.barcodescanner"
|
||||||
version="0.6.1">
|
version="1.2.0">
|
||||||
|
|
||||||
<name>BarcodeScanner</name>
|
<name>BarcodeScanner</name>
|
||||||
|
|
||||||
<description>Scans Barcodes.</description>
|
<description>Scans Barcodes.</description>
|
||||||
|
<license>MIT</license>
|
||||||
|
|
||||||
<engines>
|
<engines>
|
||||||
<engine name="cordova" version=">=2.0.0" />
|
<engine name="cordova" version=">=3.0.0" />
|
||||||
</engines>
|
</engines>
|
||||||
|
|
||||||
|
<js-module src="www/barcodescanner.js" name="BarcodeScanner">
|
||||||
|
<clobbers target="cordova.plugins.barcodeScanner" />
|
||||||
|
</js-module>
|
||||||
|
|
||||||
<asset src="www/barcodescanner.js" target="barcodescanner.js" />
|
<asset src="www/barcodescanner.js" target="barcodescanner.js" />
|
||||||
|
|
||||||
<license>MIT</license>
|
|
||||||
|
|
||||||
<!-- ios -->
|
<!-- ios -->
|
||||||
<platform name="ios">
|
<platform name="ios">
|
||||||
<plugins-plist key="BarcodeScanner" string="CDVBarcodeScanner" />
|
<!-- Cordova >= 2.8 -->
|
||||||
|
<config-file target="config.xml" parent="/*">
|
||||||
<!-- Cordova >= 2.3 -->
|
<feature name="BarcodeScanner">
|
||||||
<config-file target="config.xml" parent="plugins">
|
<param name="ios-package" value="CDVBarcodeScanner" />
|
||||||
<plugin name="BarcodeScanner" value="CDVBarcodeScanner"/>
|
</feature>
|
||||||
</config-file>
|
</config-file>
|
||||||
|
|
||||||
<resource-file src="src/ios/scannerOverlay.xib" />
|
<resource-file src="src/ios/scannerOverlay.xib" />
|
||||||
|
|
||||||
<header-file src="src/ios/zxing-all-in-one.h" />
|
<header-file src="src/ios/zxing-all-in-one.h" />
|
||||||
|
|
||||||
<source-file src="src/ios/CDVBarcodeScanner.mm" />
|
<source-file src="src/ios/CDVBarcodeScanner.mm" compiler-flags="-fno-objc-arc" />
|
||||||
<source-file src="src/ios/zxing-all-in-one.cpp" />
|
<source-file src="src/ios/zxing-all-in-one.cpp" />
|
||||||
|
|
||||||
<framework src="libiconv.dylib" />
|
<framework src="libiconv.dylib" />
|
||||||
<framework src="AVFoundation.framework" />
|
<framework src="AVFoundation.framework" />
|
||||||
<framework src="AssetsLibrary.framework" />
|
<framework src="AssetsLibrary.framework" />
|
||||||
<framework src="CoreVideo.framework" />
|
<framework src="CoreVideo.framework" />
|
||||||
|
<framework src="QuartzCore.framework" />
|
||||||
</platform>
|
</platform>
|
||||||
|
|
||||||
|
<platform name="wp7">
|
||||||
|
<config-file target="config.xml" parent="/*">
|
||||||
|
<feature name="BarcodeScanner">
|
||||||
|
<param name="wp-package" value="BarcodeScanner"/>
|
||||||
|
</feature>
|
||||||
|
</config-file>
|
||||||
|
|
||||||
|
<source-file src="src/wp/BarcodeScanner.cs" />
|
||||||
|
<source-file src="src/wp/BarcodeScannerResult.cs" />
|
||||||
|
<source-file src="src/wp/Scan.xaml.cs" />
|
||||||
|
<source-file src="src/wp/Scan.xaml" />
|
||||||
|
</platform>
|
||||||
|
|
||||||
|
<platform name="wp8">
|
||||||
|
<config-file target="config.xml" parent="/*">
|
||||||
|
<feature name="BarcodeScanner">
|
||||||
|
<param name="wp-package" value="BarcodeScanner"/>
|
||||||
|
</feature>
|
||||||
|
</config-file>
|
||||||
|
|
||||||
|
<source-file src="src/wp/BarcodeScanner.cs" />
|
||||||
|
<source-file src="src/wp/BarcodeScannerResult.cs" />
|
||||||
|
<source-file src="src/wp/Scan.xaml.cs" />
|
||||||
|
<source-file src="src/wp/Scan.xaml" />
|
||||||
|
</platform>
|
||||||
|
|
||||||
<!-- android -->
|
<!-- android -->
|
||||||
<platform name="android">
|
<platform name="android">
|
||||||
@@ -44,234 +73,241 @@
|
|||||||
<!--
|
<!--
|
||||||
<source-file src="R.java" target-dir="src/com/google/zxing/client/android" />
|
<source-file src="R.java" target-dir="src/com/google/zxing/client/android" />
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
<!--
|
||||||
<config-file target="res/xml/plugins.xml" parent="/plugins">
|
<config-file target="res/xml/plugins.xml" parent="/plugins">
|
||||||
<plugin name="BarcodeScanner" value="com.phonegap.plugins.barcodescanner.BarcodeScanner"/>
|
<plugin name="BarcodeScanner" value="com.phonegap.plugins.barcodescanner.BarcodeScanner"/>
|
||||||
</config-file>
|
</config-file>
|
||||||
|
-->
|
||||||
|
|
||||||
<config-file target="res/xml/config.xml" parent="plugins">
|
<config-file target="res/xml/config.xml" parent="/*">
|
||||||
<plugin name="BarcodeScanner" value="com.phonegap.plugins.barcodescanner.BarcodeScanner"/>
|
<feature name="BarcodeScanner">
|
||||||
|
<param name="android-package" value="com.phonegap.plugins.barcodescanner.BarcodeScanner" />
|
||||||
|
</feature>
|
||||||
</config-file>
|
</config-file>
|
||||||
|
|
||||||
<config-file target="AndroidManifest.xml" parent="/manifest/application">
|
<config-file target="AndroidManifest.xml" parent="/manifest/application">
|
||||||
<activity
|
<activity
|
||||||
android:name="com.google.zxing.client.android.CaptureActivity"
|
android:name="com.google.zxing.client.android.CaptureActivity"
|
||||||
android:screenOrientation="landscape"
|
android:screenOrientation="landscape"
|
||||||
android:clearTaskOnLaunch="true"
|
android:clearTaskOnLaunch="true"
|
||||||
android:configChanges="orientation|keyboardHidden"
|
android:configChanges="orientation|keyboardHidden"
|
||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||||
android:windowSoftInputMode="stateAlwaysHidden"
|
android:windowSoftInputMode="stateAlwaysHidden"
|
||||||
android:exported="false">
|
android:exported="false">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.phonegap.plugins.barcodescanner.SCAN"/>
|
<action android:name="com.phonegap.plugins.barcodescanner.SCAN"/>
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name="com.google.zxing.client.android.encode.EncodeActivity" android:label="@string/share_name">
|
<activity android:name="com.google.zxing.client.android.encode.EncodeActivity" android:label="@string/share_name">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.phonegap.plugins.barcodescanner.ENCODE"/>
|
<action android:name="com.phonegap.plugins.barcodescanner.ENCODE"/>
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name="com.google.zxing.client.android.HelpActivity" android:label="@string/share_name">
|
<activity android:name="com.google.zxing.client.android.HelpActivity" android:label="@string/share_name">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW"/>
|
<action android:name="android.intent.action.VIEW"/>
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
<category android:name="android.intent.category.DEFAULT"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
</config-file>
|
</config-file>
|
||||||
|
|
||||||
<config-file target="AndroidManifest.xml" parent="/manifest">
|
<config-file target="AndroidManifest.xml" parent="/manifest">
|
||||||
<uses-permission android:name="android.permission.CAMERA" />
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
<uses-permission android:name="android.permission.FLASHLIGHT" />
|
<uses-permission android:name="android.permission.FLASHLIGHT" />
|
||||||
<!-- Not required to allow users to work around this -->
|
<!-- Not required to allow users to work around this -->
|
||||||
<uses-feature android:name="android.hardware.camera" android:required="false" />
|
<uses-feature android:name="android.hardware.camera" android:required="false" />
|
||||||
</config-file>
|
</config-file>
|
||||||
|
|
||||||
<source-file src="src/android/com.google.zxing.client.android.captureactivity.jar" target-dir="libs"/>
|
<source-file src="src/android/com.google.zxing.client.android.captureactivity.jar" target-dir="libs"/>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
LibraryProject/res/*.*
|
LibraryProject/res/*.*
|
||||||
search: (src/android/LibraryProject/(.+?)/[^/]+)$
|
search: (src/android/LibraryProject/(.+?)/[^/]+)$
|
||||||
replace: <source-file src="$1" target-dir="$2"/>
|
replace: <source-file src="$1" target-dir="$2"/>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<source-file src="src/android/LibraryProject/res/drawable/launcher_icon.png" target-dir="res/drawable"/>
|
<source-file src="src/android/LibraryProject/res/drawable/launcher_icon.png" target-dir="res/drawable"/>
|
||||||
<source-file src="src/android/LibraryProject/res/drawable/share_via_barcode.png" target-dir="res/drawable"/>
|
<source-file src="src/android/LibraryProject/res/drawable/share_via_barcode.png" target-dir="res/drawable"/>
|
||||||
<source-file src="src/android/LibraryProject/res/drawable/shopper_icon.png" target-dir="res/drawable"/>
|
<source-file src="src/android/LibraryProject/res/drawable/shopper_icon.png" target-dir="res/drawable"/>
|
||||||
<source-file src="src/android/LibraryProject/res/drawable-hdpi/launcher_icon.png" target-dir="res/drawable-hdpi"/>
|
<source-file src="src/android/LibraryProject/res/drawable-hdpi/launcher_icon.png" target-dir="res/drawable-hdpi"/>
|
||||||
<source-file src="src/android/LibraryProject/res/drawable-hdpi/shopper_icon.png" target-dir="res/drawable-hdpi"/>
|
<source-file src="src/android/LibraryProject/res/drawable-hdpi/shopper_icon.png" target-dir="res/drawable-hdpi"/>
|
||||||
<source-file src="src/android/LibraryProject/res/drawable-xhdpi/launcher_icon.png" target-dir="res/drawable-xhdpi"/>
|
<source-file src="src/android/LibraryProject/res/drawable-xhdpi/launcher_icon.png" target-dir="res/drawable-xhdpi"/>
|
||||||
<source-file src="src/android/LibraryProject/res/drawable-xxhdpi/launcher_icon.png" target-dir="res/drawable-xxhdpi"/>
|
<source-file src="src/android/LibraryProject/res/drawable-xxhdpi/launcher_icon.png" target-dir="res/drawable-xxhdpi"/>
|
||||||
<source-file src="src/android/LibraryProject/res/layout/bookmark_picker_list_item.xml" target-dir="res/layout"/>
|
<source-file src="src/android/LibraryProject/res/layout/bookmark_picker_list_item.xml" target-dir="res/layout"/>
|
||||||
<source-file src="src/android/LibraryProject/res/layout/capture.xml" target-dir="res/layout"/>
|
<source-file src="src/android/LibraryProject/res/layout/capture.xml" target-dir="res/layout"/>
|
||||||
<source-file src="src/android/LibraryProject/res/layout/encode.xml" target-dir="res/layout"/>
|
<source-file src="src/android/LibraryProject/res/layout/encode.xml" target-dir="res/layout"/>
|
||||||
<source-file src="src/android/LibraryProject/res/layout/help.xml" target-dir="res/layout"/>
|
<source-file src="src/android/LibraryProject/res/layout/help.xml" target-dir="res/layout"/>
|
||||||
<source-file src="src/android/LibraryProject/res/layout/history_list_item.xml" target-dir="res/layout"/>
|
<source-file src="src/android/LibraryProject/res/layout/history_list_item.xml" target-dir="res/layout"/>
|
||||||
<source-file src="src/android/LibraryProject/res/layout/search_book_contents.xml" target-dir="res/layout"/>
|
<source-file src="src/android/LibraryProject/res/layout/search_book_contents.xml" target-dir="res/layout"/>
|
||||||
<source-file src="src/android/LibraryProject/res/layout/search_book_contents_header.xml" target-dir="res/layout"/>
|
<source-file src="src/android/LibraryProject/res/layout/search_book_contents_header.xml" target-dir="res/layout"/>
|
||||||
<source-file src="src/android/LibraryProject/res/layout/search_book_contents_list_item.xml" target-dir="res/layout"/>
|
<source-file src="src/android/LibraryProject/res/layout/search_book_contents_list_item.xml" target-dir="res/layout"/>
|
||||||
<source-file src="src/android/LibraryProject/res/layout/share.xml" target-dir="res/layout"/>
|
<source-file src="src/android/LibraryProject/res/layout/share.xml" target-dir="res/layout"/>
|
||||||
<source-file src="src/android/LibraryProject/res/layout-land/encode.xml" target-dir="res/layout-land"/>
|
<source-file src="src/android/LibraryProject/res/layout-land/encode.xml" target-dir="res/layout-land"/>
|
||||||
<source-file src="src/android/LibraryProject/res/layout-land/share.xml" target-dir="res/layout-land"/>
|
<source-file src="src/android/LibraryProject/res/layout-land/share.xml" target-dir="res/layout-land"/>
|
||||||
<source-file src="src/android/LibraryProject/res/layout-ldpi/capture.xml" target-dir="res/layout-ldpi"/>
|
<source-file src="src/android/LibraryProject/res/layout-ldpi/capture.xml" target-dir="res/layout-ldpi"/>
|
||||||
<source-file src="src/android/LibraryProject/res/raw/beep.ogg" target-dir="res/raw"/>
|
<source-file src="src/android/LibraryProject/res/menu/capture.xml" target-dir="res/menu"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values/arrays.xml" target-dir="res/values"/>
|
<source-file src="src/android/LibraryProject/res/menu/encode.xml" target-dir="res/menu"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values/colors.xml" target-dir="res/values"/>
|
<source-file src="src/android/LibraryProject/res/menu/history.xml" target-dir="res/menu"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values/dimens.xml" target-dir="res/values"/>
|
<source-file src="src/android/LibraryProject/res/raw/beep.ogg" target-dir="res/raw"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values/ids.xml" target-dir="res/values"/>
|
<source-file src="src/android/LibraryProject/res/values/arrays.xml" target-dir="res/values"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-ar/strings.xml" target-dir="res/values-ar"/>
|
<source-file src="src/android/LibraryProject/res/values/colors.xml" target-dir="res/values"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-bg/strings.xml" target-dir="res/values-bg"/>
|
<source-file src="src/android/LibraryProject/res/values/dimens.xml" target-dir="res/values"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-ca/strings.xml" target-dir="res/values-ca"/>
|
<source-file src="src/android/LibraryProject/res/values/ids.xml" target-dir="res/values"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-cs/strings.xml" target-dir="res/values-cs"/>
|
<source-file src="src/android/LibraryProject/res/values-ar/strings.xml" target-dir="res/values-ar"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-da/strings.xml" target-dir="res/values-da"/>
|
<source-file src="src/android/LibraryProject/res/values-bg/strings.xml" target-dir="res/values-bg"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-de/strings.xml" target-dir="res/values-de"/>
|
<source-file src="src/android/LibraryProject/res/values-ca/strings.xml" target-dir="res/values-ca"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-el/strings.xml" target-dir="res/values-el"/>
|
<source-file src="src/android/LibraryProject/res/values-cs/strings.xml" target-dir="res/values-cs"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-es/strings.xml" target-dir="res/values-es"/>
|
<source-file src="src/android/LibraryProject/res/values-da/strings.xml" target-dir="res/values-da"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-eu/strings.xml" target-dir="res/values-eu"/>
|
<source-file src="src/android/LibraryProject/res/values-de/strings.xml" target-dir="res/values-de"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-fi/strings.xml" target-dir="res/values-fi"/>
|
<source-file src="src/android/LibraryProject/res/values-el/strings.xml" target-dir="res/values-el"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-fr/strings.xml" target-dir="res/values-fr"/>
|
<source-file src="src/android/LibraryProject/res/values-es/strings.xml" target-dir="res/values-es"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-he/strings.xml" target-dir="res/values-he"/>
|
<source-file src="src/android/LibraryProject/res/values-eu/strings.xml" target-dir="res/values-eu"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-hi/strings.xml" target-dir="res/values-hi"/>
|
<source-file src="src/android/LibraryProject/res/values-fi/strings.xml" target-dir="res/values-fi"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-hu/strings.xml" target-dir="res/values-hu"/>
|
<source-file src="src/android/LibraryProject/res/values-fr/strings.xml" target-dir="res/values-fr"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-id/strings.xml" target-dir="res/values-id"/>
|
<source-file src="src/android/LibraryProject/res/values-he/strings.xml" target-dir="res/values-he"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-it/strings.xml" target-dir="res/values-it"/>
|
<source-file src="src/android/LibraryProject/res/values-hi/strings.xml" target-dir="res/values-hi"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-iw/strings.xml" target-dir="res/values-iw"/>
|
<source-file src="src/android/LibraryProject/res/values-hu/strings.xml" target-dir="res/values-hu"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-ja/strings.xml" target-dir="res/values-ja"/>
|
<source-file src="src/android/LibraryProject/res/values-id/strings.xml" target-dir="res/values-id"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-ko/strings.xml" target-dir="res/values-ko"/>
|
<source-file src="src/android/LibraryProject/res/values-it/strings.xml" target-dir="res/values-it"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-nl/strings.xml" target-dir="res/values-nl"/>
|
<source-file src="src/android/LibraryProject/res/values-iw/strings.xml" target-dir="res/values-iw"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-pl/strings.xml" target-dir="res/values-pl"/>
|
<source-file src="src/android/LibraryProject/res/values-ja/strings.xml" target-dir="res/values-ja"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-pt/strings.xml" target-dir="res/values-pt"/>
|
<source-file src="src/android/LibraryProject/res/values-ko/strings.xml" target-dir="res/values-ko"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-ru/strings.xml" target-dir="res/values-ru"/>
|
<source-file src="src/android/LibraryProject/res/values-nl/strings.xml" target-dir="res/values-nl"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-sk/strings.xml" target-dir="res/values-sk"/>
|
<source-file src="src/android/LibraryProject/res/values-pl/strings.xml" target-dir="res/values-pl"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-sl/strings.xml" target-dir="res/values-sl"/>
|
<source-file src="src/android/LibraryProject/res/values-pt/strings.xml" target-dir="res/values-pt"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-sv/strings.xml" target-dir="res/values-sv"/>
|
<source-file src="src/android/LibraryProject/res/values-ru/strings.xml" target-dir="res/values-ru"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-tr/strings.xml" target-dir="res/values-tr"/>
|
<source-file src="src/android/LibraryProject/res/values-sk/strings.xml" target-dir="res/values-sk"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-zh-rCN/strings.xml" target-dir="res/values-zh-rCN"/>
|
<source-file src="src/android/LibraryProject/res/values-sl/strings.xml" target-dir="res/values-sl"/>
|
||||||
<source-file src="src/android/LibraryProject/res/values-zh-rTW/strings.xml" target-dir="res/values-zh-rTW"/>
|
<source-file src="src/android/LibraryProject/res/values-sv/strings.xml" target-dir="res/values-sv"/>
|
||||||
<source-file src="src/android/LibraryProject/res/xml/preferences.xml" target-dir="res/xml"/>
|
<source-file src="src/android/LibraryProject/res/values-tr/strings.xml" target-dir="res/values-tr"/>
|
||||||
|
<source-file src="src/android/LibraryProject/res/values-zh-rCN/strings.xml" target-dir="res/values-zh-rCN"/>
|
||||||
|
<source-file src="src/android/LibraryProject/res/values-zh-rTW/strings.xml" target-dir="res/values-zh-rTW"/>
|
||||||
|
<source-file src="src/android/LibraryProject/res/xml/preferences.xml" target-dir="res/xml"/>
|
||||||
|
|
||||||
<!-- plugman cannot merge - prepare manual merge -->
|
<!-- plugman cannot merge - prepare manual merge -->
|
||||||
<config-file target="res/values/strings.xml" parent="/resources">
|
<config-file target="res/values/strings.xml" parent="/resources">
|
||||||
<string name="app_picker_name">Applications</string>
|
<string name="app_picker_name">Applications</string>
|
||||||
<string name="bookmark_picker_name">Bookmarks</string>
|
<string name="bookmark_picker_name">Bookmarks</string>
|
||||||
<string name="button_add_calendar">Add to calendar</string>
|
<string name="button_add_calendar">Add to calendar</string>
|
||||||
<string name="button_add_contact">Add contact</string>
|
<string name="button_add_contact">Add contact</string>
|
||||||
<string name="button_back">Back</string>
|
<string name="button_back">Back</string>
|
||||||
<string name="button_book_search">Book Search</string>
|
<string name="button_book_search">Book Search</string>
|
||||||
<string name="button_cancel">Cancel</string>
|
<string name="button_cancel">Cancel</string>
|
||||||
<string name="button_custom_product_search">Custom search</string>
|
<string name="button_custom_product_search">Custom search</string>
|
||||||
<string name="button_dial">Dial number</string>
|
<string name="button_dial">Dial number</string>
|
||||||
<string name="button_done">Done</string>
|
<string name="button_done">Done</string>
|
||||||
<string name="button_email">Send email</string>
|
<string name="button_email">Send email</string>
|
||||||
<string name="button_get_directions">Get directions</string>
|
<string name="button_get_directions">Get directions</string>
|
||||||
<string name="button_google_shopper">Shopper</string>
|
<string name="button_google_shopper">Shopper</string>
|
||||||
<string name="button_mms">Send MMS</string>
|
<string name="button_mms">Send MMS</string>
|
||||||
<string name="button_ok">OK</string>
|
<string name="button_ok">OK</string>
|
||||||
<string name="button_open_browser">Open browser</string>
|
<string name="button_open_browser">Open browser</string>
|
||||||
<string name="button_product_search">Product Search</string>
|
<string name="button_product_search">Product Search</string>
|
||||||
<string name="button_search_book_contents">Search contents</string>
|
<string name="button_search_book_contents">Search contents</string>
|
||||||
<string name="button_share_app">Application</string>
|
<string name="button_share_app">Application</string>
|
||||||
<string name="button_share_bookmark">Bookmark</string>
|
<string name="button_share_bookmark">Bookmark</string>
|
||||||
<string name="button_share_by_email">Share via email</string>
|
<string name="button_share_by_email">Share via email</string>
|
||||||
<string name="button_share_by_sms">Share via SMS</string>
|
<string name="button_share_by_sms">Share via SMS</string>
|
||||||
<string name="button_share_clipboard">Clipboard</string>
|
<string name="button_share_clipboard">Clipboard</string>
|
||||||
<string name="button_share_contact">Contact</string>
|
<string name="button_share_contact">Contact</string>
|
||||||
<string name="button_show_map">Show map</string>
|
<string name="button_show_map">Show map</string>
|
||||||
<string name="button_sms">Send SMS</string>
|
<string name="button_sms">Send SMS</string>
|
||||||
<string name="button_web_search">Web search</string>
|
<string name="button_web_search">Web search</string>
|
||||||
<string name="button_wifi">Connect to Network</string>
|
<string name="button_wifi">Connect to Network</string>
|
||||||
<string name="contents_contact">Contact info</string>
|
<string name="contents_contact">Contact info</string>
|
||||||
<string name="contents_email">Email address</string>
|
<string name="contents_email">Email address</string>
|
||||||
<string name="contents_location">Geographic coordinates</string>
|
<string name="contents_location">Geographic coordinates</string>
|
||||||
<string name="contents_phone">Phone number</string>
|
<string name="contents_phone">Phone number</string>
|
||||||
<string name="contents_sms">SMS address</string>
|
<string name="contents_sms">SMS address</string>
|
||||||
<string name="contents_text">Plain text</string>
|
<string name="contents_text">Plain text</string>
|
||||||
<string name="history_clear_text">Clear history</string>
|
<string name="history_clear_text">Clear history</string>
|
||||||
<string name="history_clear_one_history_text">Clear</string>
|
<string name="history_clear_one_history_text">Clear</string>
|
||||||
<string name="history_email_title">Barcode Scanner history</string>
|
<string name="history_email_title">Barcode Scanner history</string>
|
||||||
<string name="history_empty">Empty</string>
|
<string name="history_empty">Empty</string>
|
||||||
<string name="history_empty_detail">No barcode scans have been recorded</string>
|
<string name="history_empty_detail">No barcode scans have been recorded</string>
|
||||||
<string name="history_send">Send history</string>
|
<string name="history_send">Send history</string>
|
||||||
<string name="history_title">History</string>
|
<string name="history_title">History</string>
|
||||||
<string name="menu_encode_mecard">Use MECARD</string>
|
<string name="menu_encode_mecard">Use MECARD</string>
|
||||||
<string name="menu_encode_vcard">Use vCard</string>
|
<string name="menu_encode_vcard">Use vCard</string>
|
||||||
<string name="menu_help">Help</string>
|
<string name="menu_help">Help</string>
|
||||||
<string name="menu_history">History</string>
|
<string name="menu_history">History</string>
|
||||||
<string name="menu_share">Share</string>
|
<string name="menu_share">Share</string>
|
||||||
<string name="msg_bulk_mode_scanned">Bulk mode: barcode scanned and saved</string>
|
<string name="msg_bulk_mode_scanned">Bulk mode: barcode scanned and saved</string>
|
||||||
<string name="msg_camera_framework_bug">Sorry, the Android camera encountered a problem. You may need to restart the device.</string>
|
<string name="msg_camera_framework_bug">Sorry, the Android camera encountered a problem. You may need to restart the device.</string>
|
||||||
<string name="msg_default_format">Format</string>
|
<string name="msg_default_format">Format</string>
|
||||||
<string name="msg_default_meta">Metadata</string>
|
<string name="msg_default_meta">Metadata</string>
|
||||||
<string name="msg_default_mms_subject">Hi</string>
|
<string name="msg_default_mms_subject">Hi</string>
|
||||||
<string name="msg_default_status">Place a barcode inside the viewfinder rectangle to scan it.</string>
|
<string name="msg_default_status">Place a barcode inside the viewfinder rectangle to scan it.</string>
|
||||||
<string name="msg_default_time">Time</string>
|
<string name="msg_default_time">Time</string>
|
||||||
<string name="msg_default_type">Type</string>
|
<string name="msg_default_type">Type</string>
|
||||||
<string name="msg_encode_contents_failed">Could not encode a barcode from the data provided.</string>
|
<string name="msg_encode_contents_failed">Could not encode a barcode from the data provided.</string>
|
||||||
<string name="msg_google_books">Google Books</string>
|
<string name="msg_google_books">Google Books</string>
|
||||||
<string name="msg_google_product">Google Product Search</string>
|
<string name="msg_google_product">Google Product Search</string>
|
||||||
<string name="msg_google_shopper_missing">Google Shopper is not installed</string>
|
<string name="msg_google_shopper_missing">Google Shopper is not installed</string>
|
||||||
<string name="msg_install_google_shopper">Google Shopper combines barcode scanning with online and local prices, reviews and more without opening the browser. Would you like to try it?</string>
|
<string name="msg_install_google_shopper">Google Shopper combines barcode scanning with online and local prices, reviews and more without opening the browser. Would you like to try it?</string>
|
||||||
<string name="msg_intent_failed">Sorry, the requested application could not be launched. The barcode contents may be invalid.</string>
|
<string name="msg_intent_failed">Sorry, the requested application could not be launched. The barcode contents may be invalid.</string>
|
||||||
<string name="msg_redirect">Redirect</string>
|
<string name="msg_redirect">Redirect</string>
|
||||||
<string name="msg_sbc_book_not_searchable">Sorry, this book is not searchable.</string>
|
<string name="msg_sbc_book_not_searchable">Sorry, this book is not searchable.</string>
|
||||||
<string name="msg_sbc_failed">Sorry, the search encountered a problem.</string>
|
<string name="msg_sbc_failed">Sorry, the search encountered a problem.</string>
|
||||||
<string name="msg_sbc_no_page_returned">No page returned</string>
|
<string name="msg_sbc_no_page_returned">No page returned</string>
|
||||||
<string name="msg_sbc_page">Page</string>
|
<string name="msg_sbc_page">Page</string>
|
||||||
<string name="msg_sbc_results">Results</string>
|
<string name="msg_sbc_results">Results</string>
|
||||||
<string name="msg_sbc_searching_book">Searching book\u2026</string>
|
<string name="msg_sbc_searching_book">Searching book\u2026</string>
|
||||||
<string name="msg_sbc_snippet_unavailable">Snippet not available</string>
|
<string name="msg_sbc_snippet_unavailable">Snippet not available</string>
|
||||||
<string name="msg_sbc_unknown_page">Unknown page</string>
|
<string name="msg_sbc_unknown_page">Unknown page</string>
|
||||||
<string name="msg_share_explanation">You can share data by displaying a barcode on your screen and scanning it with another phone.</string>
|
<string name="msg_share_explanation">You can share data by displaying a barcode on your screen and scanning it with another phone.</string>
|
||||||
<string name="msg_share_subject_line">Here are the contents of a barcode I scanned</string>
|
<string name="msg_share_subject_line">Here are the contents of a barcode I scanned</string>
|
||||||
<string name="msg_share_text">Or type some text and press Enter</string>
|
<string name="msg_share_text">Or type some text and press Enter</string>
|
||||||
<string name="msg_sure">Are you sure?</string>
|
<string name="msg_sure">Are you sure?</string>
|
||||||
<string name="msg_unmount_usb">Sorry, the SD card is not accessible.</string>
|
<string name="msg_unmount_usb">Sorry, the SD card is not accessible.</string>
|
||||||
<string name="preferences_actions_title">When a barcode is found\u2026</string>
|
<string name="preferences_actions_title">When a barcode is found\u2026</string>
|
||||||
<string name="preferences_auto_focus_title">Use auto focus</string>
|
<string name="preferences_auto_focus_title">Use auto focus</string>
|
||||||
<string name="preferences_bulk_mode_summary">Scan and save many barcodes continuously</string>
|
<string name="preferences_bulk_mode_summary">Scan and save many barcodes continuously</string>
|
||||||
<string name="preferences_bulk_mode_title">Bulk scan mode</string>
|
<string name="preferences_bulk_mode_title">Bulk scan mode</string>
|
||||||
<string name="preferences_copy_to_clipboard_title">Copy to clipboard</string>
|
<string name="preferences_copy_to_clipboard_title">Copy to clipboard</string>
|
||||||
<string name="preferences_custom_product_search_summary" formatted="false">Substitutions: %s = contents, %f = format, %t = type</string>
|
<string name="preferences_custom_product_search_summary" formatted="false">Substitutions: %s = contents, %f = format, %t = type</string>
|
||||||
<string name="preferences_custom_product_search_title">Custom search URL</string>
|
<string name="preferences_custom_product_search_title">Custom search URL</string>
|
||||||
<string name="preferences_decode_1D_title">1D barcodes</string>
|
<string name="preferences_decode_1D_title">1D barcodes</string>
|
||||||
<string name="preferences_decode_Data_Matrix_title">Data Matrix</string>
|
<string name="preferences_decode_Data_Matrix_title">Data Matrix</string>
|
||||||
<string name="preferences_decode_QR_title">QR Codes</string>
|
<string name="preferences_decode_QR_title">QR Codes</string>
|
||||||
<string name="preferences_device_bug_workarounds_title">Device Bug Workarounds</string>
|
<string name="preferences_device_bug_workarounds_title">Device Bug Workarounds</string>
|
||||||
<string name="preferences_disable_continuous_focus_summary">Use only standard focus mode</string>
|
<string name="preferences_disable_continuous_focus_summary">Use only standard focus mode</string>
|
||||||
<string name="preferences_disable_continuous_focus_title">No continuous focus</string>
|
<string name="preferences_disable_continuous_focus_title">No continuous focus</string>
|
||||||
<string name="preferences_disable_exposure_title">No exposure</string>
|
<string name="preferences_disable_exposure_title">No exposure</string>
|
||||||
<string name="preferences_front_light_summary">Improves scanning in low light on some phones, but may cause glare. Does not work on all phones.</string>
|
<string name="preferences_front_light_summary">Improves scanning in low light on some phones, but may cause glare. Does not work on all phones.</string>
|
||||||
<string name="preferences_front_light_title">Use front light</string>
|
<string name="preferences_front_light_title">Use front light</string>
|
||||||
<string name="preferences_general_title">General settings</string>
|
<string name="preferences_general_title">General settings</string>
|
||||||
<string name="preferences_name">Settings</string>
|
<string name="preferences_name">Settings</string>
|
||||||
<string name="preferences_play_beep_title">Beep</string>
|
<string name="preferences_play_beep_title">Beep</string>
|
||||||
<string name="preferences_remember_duplicates_summary">Store multiple scans of the same barcode in History</string>
|
<string name="preferences_remember_duplicates_summary">Store multiple scans of the same barcode in History</string>
|
||||||
<string name="preferences_remember_duplicates_title">Remember duplicates</string>
|
<string name="preferences_remember_duplicates_title">Remember duplicates</string>
|
||||||
<string name="preferences_result_title">Result settings</string>
|
<string name="preferences_result_title">Result settings</string>
|
||||||
<string name="preferences_scanning_title">When scanning for barcodes, decode\u2026</string>
|
<string name="preferences_scanning_title">When scanning for barcodes, decode\u2026</string>
|
||||||
<string name="preferences_search_country">Search country</string>
|
<string name="preferences_search_country">Search country</string>
|
||||||
<string name="preferences_try_bsplus">Try Barcode Scanner+</string>
|
<string name="preferences_try_bsplus">Try Barcode Scanner+</string>
|
||||||
<string name="preferences_try_bsplus_summary">Enhanced with new features and interface</string>
|
<string name="preferences_try_bsplus_summary">Enhanced with new features and interface</string>
|
||||||
<string name="preferences_supplemental_summary">Try to retrieve more information about the barcode contents</string>
|
<string name="preferences_supplemental_summary">Try to retrieve more information about the barcode contents</string>
|
||||||
<string name="preferences_supplemental_title">Retrieve more info</string>
|
<string name="preferences_supplemental_title">Retrieve more info</string>
|
||||||
<string name="preferences_vibrate_title">Vibrate</string>
|
<string name="preferences_vibrate_title">Vibrate</string>
|
||||||
<string name="result_address_book">Found contact info</string>
|
<string name="result_address_book">Found contact info</string>
|
||||||
<string name="result_calendar">Found calendar event</string>
|
<string name="result_calendar">Found calendar event</string>
|
||||||
<string name="result_email_address">Found email address</string>
|
<string name="result_email_address">Found email address</string>
|
||||||
<string name="result_geo">Found geographic coordinates</string>
|
<string name="result_geo">Found geographic coordinates</string>
|
||||||
<string name="result_isbn">Found book</string>
|
<string name="result_isbn">Found book</string>
|
||||||
<string name="result_product">Found product</string>
|
<string name="result_product">Found product</string>
|
||||||
<string name="result_sms">Found SMS address</string>
|
<string name="result_sms">Found SMS address</string>
|
||||||
<string name="result_tel">Found phone number</string>
|
<string name="result_tel">Found phone number</string>
|
||||||
<string name="result_text">Found plain text</string>
|
<string name="result_text">Found plain text</string>
|
||||||
<string name="result_uri">Found URL</string>
|
<string name="result_uri">Found URL</string>
|
||||||
<string name="result_wifi">Found WLAN Configuration</string>
|
<string name="result_wifi">Found WLAN Configuration</string>
|
||||||
<string name="sbc_name">Google Book Search</string>
|
<string name="sbc_name">Google Book Search</string>
|
||||||
<string name="share_name">Share via barcode</string>
|
<string name="share_name">Share via barcode</string>
|
||||||
<string name="wifi_changing_network">Requesting connection to network\u2026</string>
|
<string name="wifi_changing_network">Requesting connection to network\u2026</string>
|
||||||
<string name="wifi_ssid_label">Network Name</string>
|
<string name="wifi_ssid_label">Network Name</string>
|
||||||
<string name="wifi_type_label">Type</string>
|
<string name="wifi_type_label">Type</string>
|
||||||
</config-file>
|
</config-file>
|
||||||
</platform>
|
</platform>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|||||||
@@ -1,216 +0,0 @@
|
|||||||
<?php
|
|
||||||
class PluginHelper {
|
|
||||||
public $basePath = 'src/android/LibraryProject/';
|
|
||||||
|
|
||||||
private function perror($msg)
|
|
||||||
{
|
|
||||||
file_put_contents('php://stderr', $msg, FILE_APPEND);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get contents of an XML file.
|
|
||||||
*
|
|
||||||
* @param string $xmlFilePath The XML file path relative to $this->basePath.
|
|
||||||
* @param string $parent Parent element from which to get children.
|
|
||||||
* @param array $options
|
|
||||||
* <li>ident - ident chanracters.
|
|
||||||
* <li>ignorePattern - pattern that will be matched to XML.
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getXml($xmlFilePath, $parent, $options=array())
|
|
||||||
{
|
|
||||||
if (!isset($options['indent']))
|
|
||||||
{
|
|
||||||
$options['indent'] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
$contents = "";
|
|
||||||
$filePath = $this->basePath . $xmlFilePath;
|
|
||||||
if (!file_exists($filePath))
|
|
||||||
{
|
|
||||||
$this->perror("File $filePath does not exist");
|
|
||||||
return $contents;
|
|
||||||
}
|
|
||||||
|
|
||||||
$xml = file_get_contents($this->basePath . $xmlFilePath);
|
|
||||||
$document = new SimpleXMLElement($xml);
|
|
||||||
$els = $document->xpath($parent);
|
|
||||||
if (!empty($els))
|
|
||||||
{
|
|
||||||
$rootNode = $els[0];
|
|
||||||
foreach ($rootNode->children() as $child)
|
|
||||||
{
|
|
||||||
$childContent = $child->asXML();
|
|
||||||
if (isset($options['ignorePattern']) && preg_match($options['ignorePattern'], $childContent))
|
|
||||||
{
|
|
||||||
$this->perror("\nignored $childContent");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$contents .= "\n" . $options['indent'] . $childContent;
|
|
||||||
}
|
|
||||||
$contents = ltrim ($contents) . "\n";
|
|
||||||
return $contents;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->perror("Path $parent not found in $xmlFilePath");
|
|
||||||
return $contents;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate source-file tags to copy all resources from given dir.
|
|
||||||
*
|
|
||||||
* @param type $dir Dir path relative to $this->basePath.
|
|
||||||
* @param array $options
|
|
||||||
* <li>ident - ident chanracters.
|
|
||||||
*/
|
|
||||||
public function sourceFiles($dir, $options=array())
|
|
||||||
{
|
|
||||||
//ob_end_clean();
|
|
||||||
|
|
||||||
if (!isset($options['indent']))
|
|
||||||
{
|
|
||||||
$options['indent'] = "";
|
|
||||||
}
|
|
||||||
$path = $this->basePath . $dir;
|
|
||||||
|
|
||||||
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));
|
|
||||||
while($it->valid())
|
|
||||||
{
|
|
||||||
if (!$it->isDot())
|
|
||||||
{
|
|
||||||
$filename = strtr($it->key(), '\\', '/');
|
|
||||||
if (isset($options['ignorePattern']) && preg_match($options['ignorePattern'], $filename))
|
|
||||||
{
|
|
||||||
$this->perror("\nignored $filename");
|
|
||||||
$it->next();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$targetDir = preg_replace('#.+LibraryProject/(.+?)/[^/]+$#', '$1', $filename);
|
|
||||||
echo "\n{$options['indent']}<source-file src=\"$filename\" target-dir=\"$targetDir\"/>";
|
|
||||||
}
|
|
||||||
$it->next();
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "\n";
|
|
||||||
//exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// init
|
|
||||||
$pluginHelper = new PluginHelper();
|
|
||||||
|
|
||||||
ob_start();
|
|
||||||
echo '<?xml version="1.0" encoding="UTF-8"?>';
|
|
||||||
?>
|
|
||||||
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
id="com.phonegap.plugins.barcodescanner"
|
|
||||||
version="0.5.3">
|
|
||||||
|
|
||||||
<name>BarcodeScanner</name>
|
|
||||||
|
|
||||||
<description>Scans Barcodes.</description>
|
|
||||||
|
|
||||||
<engines>
|
|
||||||
<engine name="cordova" version=">=2.0.0" />
|
|
||||||
</engines>
|
|
||||||
|
|
||||||
<asset src="www/barcodescanner.js" target="barcodescanner.js" />
|
|
||||||
|
|
||||||
<!-- ios -->
|
|
||||||
<platform name="ios">
|
|
||||||
<plugins-plist key="BarcodeScanner" string="CDVBarcodeScanner" />
|
|
||||||
|
|
||||||
<!-- Cordova >= 2.3 -->
|
|
||||||
<config-file target="config.xml" parent="plugins">
|
|
||||||
<plugin name="BarcodeScanner" value="CDVBarcodeScanner"/>
|
|
||||||
</config-file>
|
|
||||||
|
|
||||||
<resource-file src="src/ios/scannerOverlay.xib" />
|
|
||||||
|
|
||||||
<header-file src="src/ios/zxing-all-in-one.h" />
|
|
||||||
|
|
||||||
<source-file src="src/ios/CDVBarcodeScanner.mm" />
|
|
||||||
<source-file src="src/ios/zxing-all-in-one.cpp" />
|
|
||||||
|
|
||||||
<framework src="libiconv.dylib" />
|
|
||||||
<framework src="AVFoundation.framework" />
|
|
||||||
<framework src="AssetsLibrary.framework" />
|
|
||||||
<framework src="CoreVideo.framework" />
|
|
||||||
</platform>
|
|
||||||
|
|
||||||
<!-- android -->
|
|
||||||
<platform name="android">
|
|
||||||
|
|
||||||
<source-file src="src/android/com/phonegap/plugins/barcodescanner/BarcodeScanner.java" target-dir="src/com/phonegap/plugins/barcodescanner" />
|
|
||||||
<!--
|
|
||||||
<source-file src="R.java" target-dir="src/com/google/zxing/client/android" />
|
|
||||||
-->
|
|
||||||
|
|
||||||
<config-file target="res/xml/plugins.xml" parent="/plugins">
|
|
||||||
<plugin name="BarcodeScanner" value="com.phonegap.plugins.barcodescanner.BarcodeScanner"/>
|
|
||||||
</config-file>
|
|
||||||
|
|
||||||
<config-file target="res/xml/config.xml" parent="plugins">
|
|
||||||
<plugin name="BarcodeScanner" value="com.phonegap.plugins.barcodescanner.BarcodeScanner"/>
|
|
||||||
</config-file>
|
|
||||||
|
|
||||||
<config-file target="AndroidManifest.xml" parent="/manifest/application">
|
|
||||||
<activity
|
|
||||||
android:name="com.google.zxing.client.android.CaptureActivity"
|
|
||||||
android:screenOrientation="landscape"
|
|
||||||
android:clearTaskOnLaunch="true"
|
|
||||||
android:configChanges="orientation|keyboardHidden"
|
|
||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
|
||||||
android:windowSoftInputMode="stateAlwaysHidden"
|
|
||||||
android:exported="false">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="com.phonegap.plugins.barcodescanner.SCAN"/>
|
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
<activity android:name="com.google.zxing.client.android.encode.EncodeActivity" android:label="@string/share_name">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="com.phonegap.plugins.barcodescanner.ENCODE"/>
|
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
<activity android:name="com.google.zxing.client.android.HelpActivity" android:label="@string/share_name">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.VIEW"/>
|
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
</config-file>
|
|
||||||
|
|
||||||
<config-file target="AndroidManifest.xml" parent="/manifest">
|
|
||||||
<uses-permission android:name="android.permission.CAMERA" />
|
|
||||||
<uses-permission android:name="android.permission.FLASHLIGHT" />
|
|
||||||
<!-- Not required to allow users to work around this -->
|
|
||||||
<uses-feature android:name="android.hardware.camera" android:required="false" />
|
|
||||||
</config-file>
|
|
||||||
|
|
||||||
<source-file src="src/android/com.google.zxing.client.android.captureactivity.jar" target-dir="libs"/>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
LibraryProject/res/*.*
|
|
||||||
search: (src/android/LibraryProject/(.+?)/[^/]+)$
|
|
||||||
replace: <source-file src="$1" target-dir="$2"/>
|
|
||||||
-->
|
|
||||||
<?
|
|
||||||
$pluginHelper->sourceFiles("res", array('indent'=>"\t\t", 'ignorePattern' => '#values/strings.xml#'));
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!-- plugman cannot merge - prepare manual merge -->
|
|
||||||
<config-file target="res/values/strings.xml" parent="/resources">
|
|
||||||
<?=$pluginHelper->getXml('res/values/strings.xml', "/resources", array('ignorePattern' => '/name="(app_name|menu_settings)"/', 'indent' => "\t\t\t"))?>
|
|
||||||
</config-file>
|
|
||||||
</platform>
|
|
||||||
</plugin>
|
|
||||||
<?php
|
|
||||||
$pluginText = ob_get_clean();
|
|
||||||
file_put_contents("plugin.xml", $pluginText);
|
|
||||||
?>
|
|
||||||
@@ -15,20 +15,5 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item android:id="@+id/menu_share"
|
<!-- removed nonfunctional menu - see file history to retrieve -->
|
||||||
android:title="@string/menu_share"
|
|
||||||
android:icon="@android:drawable/ic_menu_share"
|
|
||||||
android:orderInCategory="1"/>
|
|
||||||
<item android:id="@+id/menu_history"
|
|
||||||
android:title="@string/menu_history"
|
|
||||||
android:icon="@android:drawable/ic_menu_recent_history"
|
|
||||||
android:orderInCategory="2"/>
|
|
||||||
<item android:id="@+id/menu_settings"
|
|
||||||
android:title="@string/menu_settings"
|
|
||||||
android:icon="@android:drawable/ic_menu_preferences"
|
|
||||||
android:orderInCategory="3"/>
|
|
||||||
<item android:id="@+id/menu_help"
|
|
||||||
android:title="@string/menu_help"
|
|
||||||
android:icon="@android:drawable/ic_menu_help"
|
|
||||||
android:orderInCategory="4"/>
|
|
||||||
</menu>
|
</menu>
|
||||||
@@ -15,12 +15,5 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item android:id="@+id/menu_share"
|
<!-- removed nonfunctional menu - see file history to retrieve -->
|
||||||
android:title="@string/menu_share"
|
|
||||||
android:icon="@android:drawable/ic_menu_share"
|
|
||||||
android:orderInCategory="1"/>
|
|
||||||
<item android:id="@+id/menu_encode"
|
|
||||||
android:title="@string/menu_encode_vcard"
|
|
||||||
android:icon="@android:drawable/ic_menu_sort_alphabetically"
|
|
||||||
android:orderInCategory="2"/>
|
|
||||||
</menu>
|
</menu>
|
||||||
+15
-3
@@ -63,17 +63,29 @@ Workflow for creating and building example project with the plugin:
|
|||||||
|
|
||||||
1. Create and build example project:
|
1. Create and build example project:
|
||||||
```
|
```
|
||||||
cordova create hello com.example.hello "Hello World"
|
cordova create hello com.example.hello "HelloWorld"
|
||||||
cd hello
|
cd hello
|
||||||
cordova platform add android
|
cordova platform add android
|
||||||
cordova build
|
cordova build
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Warning! White space characters are not allowed in app name (and any other that cannot be used in an activity or class name). See: https://issues.apache.org/jira/browse/CB-4148
|
||||||
|
|
||||||
|
Note. If you wish to remove Android platform (to e.g. generate it with your www assests) you will need to remove "platforms\android" and "merges\android\".
|
||||||
|
|
||||||
2. Copy plugin files to "hello\plugins\barcodescanner\".
|
2. Copy plugin files to "hello\plugins\com.phonegap.plugins.barcodescanner\". You can simply download from github:
|
||||||
|
```
|
||||||
|
git clone https://github.com/wildabeast/BarcodeScanner.git plugins\com.phonegap.plugins.barcodescanner
|
||||||
|
```
|
||||||
|
|
||||||
3. Install the plugin (current dir. being "hello"):
|
3. Install the plugin (current dir. being "hello"):
|
||||||
```
|
```
|
||||||
plugman --plugins_dir plugins --plugin barcodescanner --platform android --project platforms\android
|
plugman --plugins_dir plugins --plugin com.phonegap.plugins.barcodescanner --platform android --project platforms\android
|
||||||
|
plugman install --plugins_dir plugins --plugin com.phonegap.plugins.barcodescanner --platform android --project platforms\android
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note. To manually remove plugin you need to re-create plugins\android.json (and remove changes done by the plugin - you can simply remove whole platform as described in first step and re-create).
|
||||||
|
|
||||||
4. Build & deploy Android project with whatever Android IDE (or ANT + ADK tools).
|
4. Build & deploy Android project with whatever Android IDE (or ANT + ADK tools).
|
||||||
|
|
||||||
|
Note. Plugin sub-dir (here "com.phonegap.plugins.barcodescanner") need to be the same as the plugin ID only since PhoneGap 3.0.
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) Matt Kane 2010
|
* Copyright (c) Matt Kane 2010
|
||||||
* Copyright (c) 2011, IBM Corporation
|
* Copyright (c) 2011, IBM Corporation
|
||||||
|
* Copyright (c) 2013, Maciej Nux Jaros
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.phonegap.plugins.barcodescanner;
|
package com.phonegap.plugins.barcodescanner;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
@@ -16,13 +16,18 @@ import android.app.Activity;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.apache.cordova.api.Plugin;
|
import org.apache.cordova.CordovaPlugin;
|
||||||
import org.apache.cordova.api.PluginResult;
|
import org.apache.cordova.CallbackContext;
|
||||||
|
import org.apache.cordova.PluginResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This calls out to the ZXing barcode reader and returns the result.
|
* This calls out to the ZXing barcode reader and returns the result.
|
||||||
|
*
|
||||||
|
* @sa https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaPlugin.java
|
||||||
*/
|
*/
|
||||||
public class BarcodeScanner extends Plugin {
|
public class BarcodeScanner extends CordovaPlugin {
|
||||||
|
public static final int REQUEST_CODE = 0x0ba7c0de;
|
||||||
|
|
||||||
private static final String SCAN = "scan";
|
private static final String SCAN = "scan";
|
||||||
private static final String ENCODE = "encode";
|
private static final String ENCODE = "encode";
|
||||||
private static final String CANCELLED = "cancelled";
|
private static final String CANCELLED = "cancelled";
|
||||||
@@ -39,9 +44,9 @@ public class BarcodeScanner extends Plugin {
|
|||||||
private static final String PHONE_TYPE = "PHONE_TYPE";
|
private static final String PHONE_TYPE = "PHONE_TYPE";
|
||||||
private static final String SMS_TYPE = "SMS_TYPE";
|
private static final String SMS_TYPE = "SMS_TYPE";
|
||||||
|
|
||||||
public static final int REQUEST_CODE = 0x0ba7c0de;
|
private static final String LOG_TAG = "BarcodeScanner";
|
||||||
|
|
||||||
public String callback;
|
private CallbackContext callbackContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
@@ -50,15 +55,24 @@ public class BarcodeScanner extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the request and returns PluginResult.
|
* Executes the request.
|
||||||
*
|
*
|
||||||
* @param action The action to execute.
|
* This method is called from the WebView thread. To do a non-trivial amount of work, use:
|
||||||
* @param args JSONArray of arguments for the plugin.
|
* cordova.getThreadPool().execute(runnable);
|
||||||
* @param callbackId The callback id used when calling back into JavaScript.
|
*
|
||||||
* @return A PluginResult object with a status and message.
|
* To run on the UI thread, use:
|
||||||
|
* cordova.getActivity().runOnUiThread(runnable);
|
||||||
|
*
|
||||||
|
* @param action The action to execute.
|
||||||
|
* @param args The exec() arguments.
|
||||||
|
* @param callbackContext The callback context used when calling back into JavaScript.
|
||||||
|
* @return Whether the action was valid.
|
||||||
|
*
|
||||||
|
* @sa https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaPlugin.java
|
||||||
*/
|
*/
|
||||||
public PluginResult execute(String action, JSONArray args, String callbackId) {
|
@Override
|
||||||
this.callback = callbackId;
|
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) {
|
||||||
|
this.callbackContext = callbackContext;
|
||||||
|
|
||||||
if (action.equals(ENCODE)) {
|
if (action.equals(ENCODE)) {
|
||||||
JSONObject obj = args.optJSONObject(0);
|
JSONObject obj = args.optJSONObject(0);
|
||||||
@@ -72,25 +86,23 @@ public class BarcodeScanner extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
return new PluginResult(PluginResult.Status.ERROR, "User did not specify data to encode");
|
callbackContext.error("User did not specify data to encode");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
encode(type, data);
|
encode(type, data);
|
||||||
} else {
|
} else {
|
||||||
return new PluginResult(PluginResult.Status.ERROR, "User did not specify data to encode");
|
callbackContext.error("User did not specify data to encode");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
} else if (action.equals(SCAN)) {
|
||||||
else if (action.equals(SCAN)) {
|
|
||||||
scan();
|
scan();
|
||||||
} else {
|
} else {
|
||||||
return new PluginResult(PluginResult.Status.INVALID_ACTION);
|
return false;
|
||||||
}
|
}
|
||||||
PluginResult r = new PluginResult(PluginResult.Status.NO_RESULT);
|
return true;
|
||||||
r.setKeepCallback(true);
|
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts an intent to scan and decode a barcode.
|
* Starts an intent to scan and decode a barcode.
|
||||||
*/
|
*/
|
||||||
@@ -98,17 +110,18 @@ public class BarcodeScanner extends Plugin {
|
|||||||
Intent intentScan = new Intent(SCAN_INTENT);
|
Intent intentScan = new Intent(SCAN_INTENT);
|
||||||
intentScan.addCategory(Intent.CATEGORY_DEFAULT);
|
intentScan.addCategory(Intent.CATEGORY_DEFAULT);
|
||||||
|
|
||||||
this.cordova.startActivityForResult((Plugin) this, intentScan, REQUEST_CODE);
|
this.cordova.startActivityForResult((CordovaPlugin) this, intentScan, REQUEST_CODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the barcode scanner intent completes
|
* Called when the barcode scanner intent completes.
|
||||||
*
|
*
|
||||||
* @param requestCode The request code originally supplied to startActivityForResult(),
|
* @param requestCode The request code originally supplied to startActivityForResult(),
|
||||||
* allowing you to identify who this result came from.
|
* allowing you to identify who this result came from.
|
||||||
* @param resultCode The integer result code returned by the child activity through its setResult().
|
* @param resultCode The integer result code returned by the child activity through its setResult().
|
||||||
* @param intent An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
|
* @param intent An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||||
if (requestCode == REQUEST_CODE) {
|
if (requestCode == REQUEST_CODE) {
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
@@ -117,30 +130,34 @@ public class BarcodeScanner extends Plugin {
|
|||||||
obj.put(TEXT, intent.getStringExtra("SCAN_RESULT"));
|
obj.put(TEXT, intent.getStringExtra("SCAN_RESULT"));
|
||||||
obj.put(FORMAT, intent.getStringExtra("SCAN_RESULT_FORMAT"));
|
obj.put(FORMAT, intent.getStringExtra("SCAN_RESULT_FORMAT"));
|
||||||
obj.put(CANCELLED, false);
|
obj.put(CANCELLED, false);
|
||||||
} catch(JSONException e) {
|
} catch (JSONException e) {
|
||||||
//Log.d(LOG_TAG, "This should never happen");
|
Log.d(LOG_TAG, "This should never happen");
|
||||||
}
|
}
|
||||||
this.success(new PluginResult(PluginResult.Status.OK, obj), this.callback);
|
//this.success(new PluginResult(PluginResult.Status.OK, obj), this.callback);
|
||||||
|
this.callbackContext.success(obj);
|
||||||
} else if (resultCode == Activity.RESULT_CANCELED) {
|
} else if (resultCode == Activity.RESULT_CANCELED) {
|
||||||
JSONObject obj = new JSONObject();
|
JSONObject obj = new JSONObject();
|
||||||
try {
|
try {
|
||||||
obj.put(TEXT, "");
|
obj.put(TEXT, "");
|
||||||
obj.put(FORMAT, "");
|
obj.put(FORMAT, "");
|
||||||
obj.put(CANCELLED, true);
|
obj.put(CANCELLED, true);
|
||||||
} catch(JSONException e) {
|
} catch (JSONException e) {
|
||||||
//Log.d(LOG_TAG, "This should never happen");
|
Log.d(LOG_TAG, "This should never happen");
|
||||||
}
|
}
|
||||||
this.success(new PluginResult(PluginResult.Status.OK, obj), this.callback);
|
//this.success(new PluginResult(PluginResult.Status.OK, obj), this.callback);
|
||||||
|
this.callbackContext.success(obj);
|
||||||
} else {
|
} else {
|
||||||
this.error(new PluginResult(PluginResult.Status.ERROR), this.callback);
|
//this.error(new PluginResult(PluginResult.Status.ERROR), this.callback);
|
||||||
|
this.callbackContext.error("Unexpected error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initiates a barcode encode.
|
* Initiates a barcode encode.
|
||||||
* @param data The data to encode in the bar code
|
*
|
||||||
* @param data2
|
* @param type Endoiding type.
|
||||||
|
* @param data The data to encode in the bar code.
|
||||||
*/
|
*/
|
||||||
public void encode(String type, String data) {
|
public void encode(String type, String data) {
|
||||||
Intent intentEncode = new Intent(ENCODE_INTENT);
|
Intent intentEncode = new Intent(ENCODE_INTENT);
|
||||||
@@ -149,4 +166,4 @@ public class BarcodeScanner extends Plugin {
|
|||||||
|
|
||||||
this.cordova.getActivity().startActivity(intentEncode);
|
this.cordova.getActivity().startActivity(intentEncode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#import <AVFoundation/AVFoundation.h>
|
#import <AVFoundation/AVFoundation.h>
|
||||||
#import <AssetsLibrary/AssetsLibrary.h>
|
#import <AssetsLibrary/AssetsLibrary.h>
|
||||||
|
#import <AudioToolbox/AudioToolbox.h>
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// use the all-in-one version of zxing that we built
|
// use the all-in-one version of zxing that we built
|
||||||
@@ -46,8 +47,8 @@
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@interface CDVBarcodeScanner : CDVPlugin {}
|
@interface CDVBarcodeScanner : CDVPlugin {}
|
||||||
- (NSString*)isScanNotPossible;
|
- (NSString*)isScanNotPossible;
|
||||||
- (void)scan:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
|
- (void)scan:(CDVInvokedUrlCommand*)command;
|
||||||
- (void)encode:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
|
- (void)encode:(CDVInvokedUrlCommand*)command;
|
||||||
- (void)returnSuccess:(NSString*)scannedText format:(NSString*)format cancelled:(BOOL)cancelled callback:(NSString*)callback;
|
- (void)returnSuccess:(NSString*)scannedText format:(NSString*)format cancelled:(BOOL)cancelled callback:(NSString*)callback;
|
||||||
- (void)returnError:(NSString*)message callback:(NSString*)callback;
|
- (void)returnError:(NSString*)message callback:(NSString*)callback;
|
||||||
@end
|
@end
|
||||||
@@ -120,18 +121,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
- (void)scan:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options {
|
- (void)scan:(CDVInvokedUrlCommand*)command {
|
||||||
CDVbcsProcessor* processor;
|
CDVbcsProcessor* processor;
|
||||||
NSString* callback;
|
NSString* callback;
|
||||||
NSString* capabilityError;
|
NSString* capabilityError;
|
||||||
|
|
||||||
callback = [arguments objectAtIndex:0];
|
callback = command.callbackId;
|
||||||
|
|
||||||
// We allow the user to define an alternate xib file for loading the overlay.
|
// We allow the user to define an alternate xib file for loading the overlay.
|
||||||
NSString *overlayXib = nil;
|
NSString *overlayXib = nil;
|
||||||
if ( [arguments count] == 2 )
|
if ( [command.arguments count] >= 1 )
|
||||||
{
|
{
|
||||||
overlayXib = [arguments objectAtIndex:1];
|
overlayXib = [command.arguments objectAtIndex:0];
|
||||||
}
|
}
|
||||||
|
|
||||||
capabilityError = [self isScanNotPossible];
|
capabilityError = [self isScanNotPossible];
|
||||||
@@ -152,8 +153,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
- (void)encode:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options {
|
- (void)encode:(CDVInvokedUrlCommand*)command {
|
||||||
[self returnError:@"encode function not supported" callback:[arguments objectAtIndex:0]];
|
[self returnError:@"encode function not supported" callback:command.callbackId];
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
@@ -205,6 +206,8 @@
|
|||||||
@synthesize is2D = _is2D;
|
@synthesize is2D = _is2D;
|
||||||
@synthesize capturing = _capturing;
|
@synthesize capturing = _capturing;
|
||||||
|
|
||||||
|
SystemSoundID _soundFileObject;
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
- (id)initWithPlugin:(CDVBarcodeScanner*)plugin
|
- (id)initWithPlugin:(CDVBarcodeScanner*)plugin
|
||||||
callback:(NSString*)callback
|
callback:(NSString*)callback
|
||||||
@@ -222,6 +225,9 @@ parentViewController:(UIViewController*)parentViewController
|
|||||||
self.is2D = YES;
|
self.is2D = YES;
|
||||||
self.capturing = NO;
|
self.capturing = NO;
|
||||||
|
|
||||||
|
CFURLRef soundFileURLRef = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("CDVBarcodeScanner.bundle/beep"), CFSTR ("caf"), NULL);
|
||||||
|
AudioServicesCreateSystemSoundID(soundFileURLRef, &_soundFileObject);
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,6 +243,9 @@ parentViewController:(UIViewController*)parentViewController
|
|||||||
|
|
||||||
self.capturing = NO;
|
self.capturing = NO;
|
||||||
|
|
||||||
|
AudioServicesRemoveSystemSoundCompletion(_soundFileObject);
|
||||||
|
AudioServicesDisposeSystemSoundID(_soundFileObject);
|
||||||
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,6 +290,9 @@ parentViewController:(UIViewController*)parentViewController
|
|||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
- (void)barcodeScanSucceeded:(NSString*)text format:(NSString*)format {
|
- (void)barcodeScanSucceeded:(NSString*)text format:(NSString*)format {
|
||||||
[self barcodeScanDone];
|
[self barcodeScanDone];
|
||||||
|
|
||||||
|
AudioServicesPlaySystemSound(_soundFileObject);
|
||||||
|
|
||||||
[self.plugin returnSuccess:text format:format cancelled:FALSE callback:self.callback];
|
[self.plugin returnSuccess:text format:format cancelled:FALSE callback:self.callback];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,7 +332,9 @@ parentViewController:(UIViewController*)parentViewController
|
|||||||
output.alwaysDiscardsLateVideoFrames = YES;
|
output.alwaysDiscardsLateVideoFrames = YES;
|
||||||
output.videoSettings = videoOutputSettings;
|
output.videoSettings = videoOutputSettings;
|
||||||
|
|
||||||
[output setSampleBufferDelegate:self queue:dispatch_get_main_queue()];
|
dispatch_queue_t queue = dispatch_queue_create("CDVBarcodeScanner", NULL);
|
||||||
|
[output setSampleBufferDelegate:self queue:queue];
|
||||||
|
dispatch_release(queue);
|
||||||
|
|
||||||
if (![captureSession canSetSessionPreset:AVCaptureSessionPresetMedium]) {
|
if (![captureSession canSetSessionPreset:AVCaptureSessionPresetMedium]) {
|
||||||
return @"unable to preset medium quality video capture";
|
return @"unable to preset medium quality video capture";
|
||||||
@@ -416,7 +430,13 @@ parentViewController:(UIViewController*)parentViewController
|
|||||||
const char* cString = resultText->getText().c_str();
|
const char* cString = resultText->getText().c_str();
|
||||||
NSString* resultString = [[[NSString alloc] initWithCString:cString encoding:NSUTF8StringEncoding] autorelease];
|
NSString* resultString = [[[NSString alloc] initWithCString:cString encoding:NSUTF8StringEncoding] autorelease];
|
||||||
|
|
||||||
[self barcodeScanSucceeded:resultString format:format];
|
NSMethodSignature *sig = [self methodSignatureForSelector:@selector(barcodeScanSucceeded:format:)];
|
||||||
|
NSInvocation *invoke = [NSInvocation invocationWithMethodSignature:sig];
|
||||||
|
[invoke setTarget:self];
|
||||||
|
[invoke setSelector:@selector(barcodeScanSucceeded:format:)];
|
||||||
|
[invoke setArgument:&resultString atIndex:2];
|
||||||
|
[invoke setArgument:&format atIndex:3];
|
||||||
|
[invoke performSelectorOnMainThread:@selector(invoke) withObject:nil waitUntilDone:YES];
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (zxing::ReaderException &rex) {
|
catch (zxing::ReaderException &rex) {
|
||||||
|
|||||||
@@ -1940,7 +1940,7 @@ GreyscaleLuminanceSource::GreyscaleLuminanceSource(unsigned char* greyData, int
|
|||||||
|
|
||||||
unsigned char* GreyscaleLuminanceSource::getRow(int y, unsigned char* row) {
|
unsigned char* GreyscaleLuminanceSource::getRow(int y, unsigned char* row) {
|
||||||
if (y < 0 || y >= this->getHeight()) {
|
if (y < 0 || y >= this->getHeight()) {
|
||||||
throw IllegalArgumentException("Requested row is outside the image: " + y);
|
throw IllegalArgumentException("Requested row is outside the image.");
|
||||||
}
|
}
|
||||||
int width = getWidth();
|
int width = getWidth();
|
||||||
// TODO(flyashi): determine if row has enough size.
|
// TODO(flyashi): determine if row has enough size.
|
||||||
@@ -2017,7 +2017,7 @@ GreyscaleRotatedLuminanceSource::GreyscaleRotatedLuminanceSource(unsigned char*
|
|||||||
// The API asks for rows, but we're rotated, so we return columns.
|
// The API asks for rows, but we're rotated, so we return columns.
|
||||||
unsigned char* GreyscaleRotatedLuminanceSource::getRow(int y, unsigned char* row) {
|
unsigned char* GreyscaleRotatedLuminanceSource::getRow(int y, unsigned char* row) {
|
||||||
if (y < 0 || y >= getHeight()) {
|
if (y < 0 || y >= getHeight()) {
|
||||||
throw IllegalArgumentException("Requested row is outside the image: " + y);
|
throw IllegalArgumentException("Requested row is outside the image");
|
||||||
}
|
}
|
||||||
int width = getWidth();
|
int width = getWidth();
|
||||||
if (row == NULL) {
|
if (row == NULL) {
|
||||||
@@ -10309,7 +10309,7 @@ namespace {
|
|||||||
int secondThirdBytes = bits.readBits(16);
|
int secondThirdBytes = bits.readBits(16);
|
||||||
return ((firstByte & 0x1F) << 16) | secondThirdBytes;
|
return ((firstByte & 0x1F) << 16) | secondThirdBytes;
|
||||||
}
|
}
|
||||||
throw IllegalArgumentException("Bad ECI bits starting with byte " + firstByte);
|
throw IllegalArgumentException("Bad ECI bits starting with byte ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
using BarcodeScanner;
|
||||||
|
using Microsoft.Phone.Controls;
|
||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using WPCordovaClassLib.Cordova;
|
||||||
|
using WPCordovaClassLib.Cordova.Commands;
|
||||||
|
using WPCordovaClassLib.Cordova.JSON;
|
||||||
|
|
||||||
|
namespace Cordova.Extension.Commands
|
||||||
|
{
|
||||||
|
public class BarcodeScanner : BaseCommand
|
||||||
|
{
|
||||||
|
private PhoneApplicationFrame currentRootVisual;
|
||||||
|
|
||||||
|
public void scan(string options)
|
||||||
|
{
|
||||||
|
Deployment.Current.Dispatcher.BeginInvoke(() =>
|
||||||
|
{
|
||||||
|
currentRootVisual = Application.Current.RootVisual as PhoneApplicationFrame;
|
||||||
|
currentRootVisual.Navigated += OnFrameNavigated;
|
||||||
|
currentRootVisual.Navigate(new Uri("/Plugins/com.phonegap.plugins.barcodescanner/Scan.xaml", UriKind.Relative));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnFrameNavigated(object sender, NavigationEventArgs e)
|
||||||
|
{
|
||||||
|
var scanPage = e.Content as Scan;
|
||||||
|
if (scanPage != null)
|
||||||
|
{
|
||||||
|
scanPage.BarcodeScannerPlugin = this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnScanFailed(string error)
|
||||||
|
{
|
||||||
|
DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, error));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnScanSucceeded(BarcodeScannerResult scanResult)
|
||||||
|
{
|
||||||
|
var resultString = JsonHelper.Serialize(scanResult);
|
||||||
|
DispatchCommandResult(new PluginResult(PluginResult.Status.OK, resultString));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace BarcodeScanner
|
||||||
|
{
|
||||||
|
public class BarcodeScannerResult
|
||||||
|
{
|
||||||
|
public string format
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string text
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<phone:PhoneApplicationPage
|
||||||
|
x:Class="BarcodeScanner.Scan"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||||
|
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||||
|
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||||
|
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||||
|
SupportedOrientations="Portrait" Orientation="Portrait"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
shell:SystemTray.IsVisible="True">
|
||||||
|
|
||||||
|
<!--LayoutRoot is the root grid where all page content is placed-->
|
||||||
|
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="100" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Canvas x:Name="viewfinderCanvas">
|
||||||
|
|
||||||
|
<!--Camera viewfinder -->
|
||||||
|
<Canvas.Background>
|
||||||
|
<VideoBrush x:Name="viewfinderBrush">
|
||||||
|
<VideoBrush.RelativeTransform>
|
||||||
|
<CompositeTransform
|
||||||
|
x:Name="viewfinderTransform"
|
||||||
|
CenterX="0.5"
|
||||||
|
CenterY="0.5"
|
||||||
|
Rotation="90"/>
|
||||||
|
</VideoBrush.RelativeTransform>
|
||||||
|
</VideoBrush>
|
||||||
|
</Canvas.Background>
|
||||||
|
</Canvas>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
</phone:PhoneApplicationPage>
|
||||||
@@ -0,0 +1,151 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using Microsoft.Phone.Controls;
|
||||||
|
using Microsoft.Phone.Shell;
|
||||||
|
using Microsoft.Devices;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using ZXing;
|
||||||
|
|
||||||
|
namespace BarcodeScanner
|
||||||
|
{
|
||||||
|
public partial class Scan : PhoneApplicationPage
|
||||||
|
{
|
||||||
|
private PhotoCamera phoneCamera;
|
||||||
|
private IBarcodeReader barcodeReader;
|
||||||
|
private DispatcherTimer scanTimer;
|
||||||
|
private WriteableBitmap previewBuffer;
|
||||||
|
|
||||||
|
private string scannedCode = string.Empty;
|
||||||
|
|
||||||
|
private bool scanSucceeded;
|
||||||
|
|
||||||
|
public Scan()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Cordova.Extension.Commands.BarcodeScanner BarcodeScannerPlugin
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
|
||||||
|
{
|
||||||
|
// Initialize the camera object
|
||||||
|
phoneCamera = new PhotoCamera();
|
||||||
|
phoneCamera.Initialized += OnCameraInitialized;
|
||||||
|
|
||||||
|
CameraButtons.ShutterKeyHalfPressed += OnCameraButtonShutterKeyHalfPressed;
|
||||||
|
|
||||||
|
//Display the camera feed in the UI
|
||||||
|
viewfinderBrush.SetSource(phoneCamera);
|
||||||
|
|
||||||
|
|
||||||
|
// This timer will be used to scan the camera buffer every 250ms and scan for any barcodes
|
||||||
|
scanTimer = new DispatcherTimer();
|
||||||
|
scanTimer.Interval = TimeSpan.FromMilliseconds(250);
|
||||||
|
scanTimer.Tick += (o, arg) => ScanForBarcode();
|
||||||
|
|
||||||
|
base.OnNavigatedTo(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnCameraButtonShutterKeyHalfPressed(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
phoneCamera.Focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnNavigatingFrom(System.Windows.Navigation.NavigatingCancelEventArgs e)
|
||||||
|
{
|
||||||
|
scanTimer.Stop();
|
||||||
|
|
||||||
|
if (phoneCamera != null)
|
||||||
|
{
|
||||||
|
phoneCamera.Dispose();
|
||||||
|
phoneCamera.Initialized -= OnCameraInitialized;
|
||||||
|
CameraButtons.ShutterKeyHalfPressed -= OnCameraButtonShutterKeyHalfPressed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!scanSucceeded)
|
||||||
|
{
|
||||||
|
BarcodeScannerPlugin.OnScanFailed("Cancelled by user");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnCameraInitialized(object sender, Microsoft.Devices.CameraOperationCompletedEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Succeeded)
|
||||||
|
{
|
||||||
|
this.Dispatcher.BeginInvoke(delegate()
|
||||||
|
{
|
||||||
|
phoneCamera.FlashMode = FlashMode.Off;
|
||||||
|
previewBuffer = new WriteableBitmap((int)phoneCamera.PreviewResolution.Width, (int)phoneCamera.PreviewResolution.Height);
|
||||||
|
|
||||||
|
barcodeReader = new BarcodeReader();
|
||||||
|
|
||||||
|
// By default, BarcodeReader will scan every supported barcode type
|
||||||
|
// If we want to limit the type of barcodes our app can read,
|
||||||
|
// we can do it by adding each format to this list object
|
||||||
|
|
||||||
|
//var supportedBarcodeFormats = new List<BarcodeFormat>();
|
||||||
|
//supportedBarcodeFormats.Add(BarcodeFormat.QR_CODE);
|
||||||
|
//supportedBarcodeFormats.Add(BarcodeFormat.DATA_MATRIX);
|
||||||
|
//_bcReader.PossibleFormats = supportedBarcodeFormats;
|
||||||
|
|
||||||
|
barcodeReader.Options.TryHarder = true;
|
||||||
|
|
||||||
|
barcodeReader.ResultFound += OnBarcodeResultFound;
|
||||||
|
scanTimer.Start();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Dispatcher.BeginInvoke(() =>
|
||||||
|
{
|
||||||
|
BarcodeScannerPlugin.OnScanFailed("Unable to initialize the camera");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnBarcodeResultFound(Result obj)
|
||||||
|
{
|
||||||
|
if (BarcodeIsValid(obj.Text))
|
||||||
|
{
|
||||||
|
var barcodeScannerResult = new BarcodeScannerResult();
|
||||||
|
barcodeScannerResult.format = obj.BarcodeFormat.ToString();
|
||||||
|
barcodeScannerResult.text = obj.Text;
|
||||||
|
scanSucceeded = true;
|
||||||
|
|
||||||
|
BarcodeScannerPlugin.OnScanSucceeded(barcodeScannerResult);
|
||||||
|
NavigationService.GoBack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool BarcodeIsValid(string barcode)
|
||||||
|
{
|
||||||
|
if (barcode.Equals(scannedCode))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ScanForBarcode()
|
||||||
|
{
|
||||||
|
//grab a camera snapshot
|
||||||
|
phoneCamera.GetPreviewBufferArgb32(previewBuffer.Pixels);
|
||||||
|
previewBuffer.Invalidate();
|
||||||
|
|
||||||
|
//scan the captured snapshot for barcodes
|
||||||
|
//if a barcode is found, the ResultFound event will fire
|
||||||
|
barcodeReader.Decode(previewBuffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+47
-23
@@ -6,41 +6,56 @@
|
|||||||
* Copyright (c) 2011, IBM Corporation
|
* Copyright (c) 2011, IBM Corporation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var ScannerLoader = function (require, exports, module) {
|
||||||
cordova.define("cordova/plugin/BarcodeScanner",
|
|
||||||
|
|
||||||
function (require, exports, module) {
|
|
||||||
|
|
||||||
var exec = require("cordova/exec");
|
var exec = require("cordova/exec");
|
||||||
|
|
||||||
var BarcodeScanner = function () {
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @returns {BarcodeScanner}
|
||||||
|
*/
|
||||||
|
function BarcodeScanner() {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encoding constants.
|
||||||
|
*
|
||||||
|
* @type Object
|
||||||
|
*/
|
||||||
|
this.Encode = {
|
||||||
|
TEXT_TYPE: "TEXT_TYPE",
|
||||||
|
EMAIL_TYPE: "EMAIL_TYPE",
|
||||||
|
PHONE_TYPE: "PHONE_TYPE",
|
||||||
|
SMS_TYPE: "SMS_TYPE"
|
||||||
|
// CONTACT_TYPE: "CONTACT_TYPE", // TODO: not implemented, requires passing a Bundle class from Javascript to Java
|
||||||
|
// LOCATION_TYPE: "LOCATION_TYPE" // TODO: not implemented, requires passing a Bundle class from Javascript to Java
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
/**
|
||||||
BarcodeScanner.Encode = {
|
* Read code from scanner.
|
||||||
TEXT_TYPE: "TEXT_TYPE",
|
*
|
||||||
EMAIL_TYPE: "EMAIL_TYPE",
|
* @param {Function} successCallback This function will recieve a result object: {
|
||||||
PHONE_TYPE: "PHONE_TYPE",
|
* text : '12345-mock', // The code that was scanned.
|
||||||
SMS_TYPE: "SMS_TYPE",
|
* format : 'FORMAT_NAME', // Code format.
|
||||||
// CONTACT_TYPE: "CONTACT_TYPE", // TODO: not implemented, requires passing a Bundle class from Javascript to Java
|
* cancelled : true/false, // Was canceled.
|
||||||
// LOCATION_TYPE: "LOCATION_TYPE" // TODO: not implemented, requires passing a Bundle class from Javascript to Java
|
* }
|
||||||
};
|
* @param {Function} errorCallback
|
||||||
|
*/
|
||||||
//-------------------------------------------------------------------
|
|
||||||
BarcodeScanner.prototype.scan = function (successCallback, errorCallback) {
|
BarcodeScanner.prototype.scan = function (successCallback, errorCallback) {
|
||||||
if (errorCallback == null) {
|
if (errorCallback == null) {
|
||||||
errorCallback = function () {
|
errorCallback = function () {
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof errorCallback != "function") {
|
if (typeof errorCallback != "function") {
|
||||||
console.log("BarcodeScanner.scan failure: failure parameter not a function");
|
console.log("BarcodeScanner.scan failure: failure parameter not a function");
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof successCallback != "function") {
|
if (typeof successCallback != "function") {
|
||||||
console.log("BarcodeScanner.scan failure: success callback parameter must be a function");
|
console.log("BarcodeScanner.scan failure: success callback parameter must be a function");
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
exec(successCallback, errorCallback, 'BarcodeScanner', 'scan', []);
|
exec(successCallback, errorCallback, 'BarcodeScanner', 'scan', []);
|
||||||
@@ -50,17 +65,17 @@ cordova.define("cordova/plugin/BarcodeScanner",
|
|||||||
BarcodeScanner.prototype.encode = function (type, data, successCallback, errorCallback, options) {
|
BarcodeScanner.prototype.encode = function (type, data, successCallback, errorCallback, options) {
|
||||||
if (errorCallback == null) {
|
if (errorCallback == null) {
|
||||||
errorCallback = function () {
|
errorCallback = function () {
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof errorCallback != "function") {
|
if (typeof errorCallback != "function") {
|
||||||
console.log("BarcodeScanner.encode failure: failure parameter not a function");
|
console.log("BarcodeScanner.encode failure: failure parameter not a function");
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof successCallback != "function") {
|
if (typeof successCallback != "function") {
|
||||||
console.log("BarcodeScanner.encode failure: success callback parameter must be a function");
|
console.log("BarcodeScanner.encode failure: success callback parameter must be a function");
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
exec(successCallback, errorCallback, 'BarcodeScanner', 'encode', [
|
exec(successCallback, errorCallback, 'BarcodeScanner', 'encode', [
|
||||||
@@ -70,4 +85,13 @@ cordova.define("cordova/plugin/BarcodeScanner",
|
|||||||
|
|
||||||
var barcodeScanner = new BarcodeScanner();
|
var barcodeScanner = new BarcodeScanner();
|
||||||
module.exports = barcodeScanner;
|
module.exports = barcodeScanner;
|
||||||
});
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ScannerLoader(require, exports, module);
|
||||||
|
|
||||||
|
cordova.define("cordova/plugin/BarcodeScanner", ScannerLoader);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user