Compare commits
362 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d09b7c76c3 | |||
| 3a2db7ffc6 | |||
| 2a65a6c973 | |||
| 3c77f1d6c8 | |||
| b6c6421dd5 | |||
| 8173d4a8b2 | |||
| 8fdbbbef5e | |||
| 2324a5403e | |||
| c752130405 | |||
| 1c27c8fe2d | |||
| aa129af542 | |||
| 90b5db5fcd | |||
| 24d02945fe | |||
| 6ccf3a9d1a | |||
| 23f29e5a56 | |||
| 1a8d949325 | |||
| f1554b7478 | |||
| cc12c103e0 | |||
| a13ce2b161 | |||
| 0c97cf70cc | |||
| 9beeac7960 | |||
| cc34502f13 | |||
| 2221621de9 | |||
| 4d4c5a2c4e | |||
| 65d2716c71 | |||
| 7fd1ab8794 | |||
| 630e3cc0f8 | |||
| 40260272fc | |||
| f54615e43a | |||
| 1acc3a6f4f | |||
| 73093b9b4f | |||
| db85816b3d | |||
| 6a3d857019 | |||
| 6c8ea7e3fd | |||
| 35ee545f8b | |||
| 5d9e2c3756 | |||
| cce2a300ef | |||
| 13440ad875 | |||
| 5a2470f034 | |||
| 545672bb8f | |||
| 542dc66090 | |||
| ea414a236e | |||
| 1ba1ded540 | |||
| 4893bcc194 | |||
| 6498fad6a7 | |||
| f7f779d7ac | |||
| c555ffbe05 | |||
| e0d340952d | |||
| 9b924e6875 | |||
| 8df0cb554a | |||
| 09d992ddfa | |||
| 95cd4a3a4d | |||
| 7e5bbd2997 | |||
| 8d8cd7d445 | |||
| bd857c68eb | |||
| 0fdfbce9fb | |||
| eba457ee9e | |||
| 9319110de8 | |||
| ee4b181f23 | |||
| a4f751500c | |||
| 75b4aa57f5 | |||
| eb4cbd5095 | |||
| aa4fca5dae | |||
| d22b581cd3 | |||
| 9349b31ab3 | |||
| c0c8363f85 | |||
| 27c22e8ffe | |||
| d77fa29226 | |||
| 9aa5381c2b | |||
| 3a7612661a | |||
| 70f4bbb8de | |||
| 363ad77540 | |||
| 62547c10d7 | |||
| 0de49aa7c8 | |||
| 1a1c8d0e66 | |||
| 31332404fc | |||
| 28c646b9e2 | |||
| c0c0fcd745 | |||
| 98d00abcbd | |||
| 7042d74f4a | |||
| 94ae63d857 | |||
| 0e7413e1f7 | |||
| 82e8f9afcc | |||
| 6556f81558 | |||
| 5983e2fb8e | |||
| be04a7587f | |||
| 330cb2b63b | |||
| 6b49e8774f | |||
| 209e1c9a04 | |||
| c7a143499e | |||
| a4dfc2fca4 | |||
| 98b69af339 | |||
| 40010a62df | |||
| 5927f38a1d | |||
| f2a477b647 | |||
| 65aaa93a27 | |||
| 1e1b075f13 | |||
| 224bfd6ea2 | |||
| c1a3786c17 | |||
| 2af07f95cf | |||
| 4e7ee70b73 | |||
| aec45c4f10 | |||
| c1918b32fb | |||
| a2774c7bde | |||
| 2f061a1da5 | |||
| 70f4159e3a | |||
| 295193d613 | |||
| d8f3157e97 | |||
| a7d91dbed6 | |||
| e8257760da | |||
| 2f022c0a70 | |||
| 3fd9354cd7 | |||
| c98a04a407 | |||
| 8e90d15117 | |||
| fa2cd1562d | |||
| 11073ddcf9 | |||
| 17ad61674e | |||
| 8a67d852e4 | |||
| 68f17bde30 | |||
| 34788e0fbc | |||
| 45756b51b2 | |||
| adee48a8ae | |||
| e48229ac3f | |||
| 2ff44f91b5 | |||
| f30ea0c955 | |||
| cf4c0dce50 | |||
| 670000698d | |||
| 60ed28ee06 | |||
| c83b2c5a5c | |||
| eaeddd23af | |||
| 0fd028b9e2 | |||
| e2892cad8f | |||
| 1817bb198b | |||
| 29848b2b4f | |||
| 9ec92a5101 | |||
| 2cf4b60f0f | |||
| e3aed41746 | |||
| 09571d3813 | |||
| 6c250faeb6 | |||
| 4955c18a87 | |||
| 6f73f470c9 | |||
| 5d48d2ff35 | |||
| 92f6acf3d6 | |||
| 5309388c7a | |||
| b3a2c1e07e | |||
| 958bbb1491 | |||
| 34aca80673 | |||
| 0b774fba7c | |||
| 81effea784 | |||
| b4a88bfb56 | |||
| 6c3e917b15 | |||
| f484d21af8 | |||
| d3330c9663 | |||
| 964dbab7b2 | |||
| 76861f8683 | |||
| 42d09b810b | |||
| c4cbaba495 | |||
| 2373c88ca9 | |||
| 4f311133ee | |||
| 531918d28a | |||
| e3d3950d9a | |||
| 1b8fbe60cc | |||
| a2cc8e2756 | |||
| a7c8046c22 | |||
| 8992dc5710 | |||
| 33b88ed645 | |||
| 50e3acce09 | |||
| a8305bd237 | |||
| 11de8f4288 | |||
| c9e3bf415f | |||
| e27bef5518 | |||
| 9ea3e3ef08 | |||
| 03ab7214f6 | |||
| 0b07174be9 | |||
| 50ea6bb48a | |||
| aefdceaffd | |||
| 91157bc907 | |||
| 4c745d697b | |||
| 2219087d6a | |||
| c81ea8e6eb | |||
| 8ae76eaac6 | |||
| 7d47cd352a | |||
| 3e12faa379 | |||
| cac37cb7e5 | |||
| 39430544f6 | |||
| e7fce1f563 | |||
| 5ad456a5d0 | |||
| 905e4a33d6 | |||
| d34fa22d7a | |||
| cb68383a4c | |||
| 842895f0c4 | |||
| 0aebd7b795 | |||
| 706c407351 | |||
| 962592eab4 | |||
| 2e5ec9e78c | |||
| 7d2c96ffad | |||
| db3962cd3c | |||
| 3bb383147d | |||
| 062feb8453 | |||
| 9dd1022ba2 | |||
| a7ee170653 | |||
| ed3eddd357 | |||
| d0876fbd10 | |||
| 5cdd8fea69 | |||
| d75b7a7c15 | |||
| 31bba74b34 | |||
| f0e0335ca4 | |||
| b61c0dc332 | |||
| 7bb0187ece | |||
| c457d9a541 | |||
| 568692eebe | |||
| 3a05fc63a7 | |||
| cc0b16bc9d | |||
| 363db3cf73 | |||
| 74d9b82a45 | |||
| 72a90e75c1 | |||
| 25b2997a51 | |||
| a3f546bc1a | |||
| 85a93e63b6 | |||
| 56ef6c6dca | |||
| dbf0067cf6 | |||
| 77d0cdfe85 | |||
| 002c8e676e | |||
| bcf2062b2b | |||
| 878fc85f73 | |||
| 5035f3c453 | |||
| a35de1381a | |||
| 2ace11eabc | |||
| e25b6b5989 | |||
| e1de481ccd | |||
| 656363067d | |||
| 4c12440dc6 | |||
| b95f7abba2 | |||
| 856d634d5b | |||
| f0c7ad1fb3 | |||
| ec1a4e7ccd | |||
| 8b7f5cae86 | |||
| 36962bcff1 | |||
| 4210396bd0 | |||
| b8fbbb9f60 | |||
| 5cc9968a58 | |||
| f616533466 | |||
| 1deb4b55d4 | |||
| 624738f9ed | |||
| 5c97efddcf | |||
| e9d0512b9f | |||
| 0acaf239a6 | |||
| 3c04718814 | |||
| 213f020a4f | |||
| 9c75630305 | |||
| c32a34e0e5 | |||
| 60a3a99acf | |||
| 4da6cedea6 | |||
| b513c28bf9 | |||
| da0338ad19 | |||
| fe1ae0c102 | |||
| d8648583f8 | |||
| c85a5ce188 | |||
| dd49d8b3be | |||
| 6cd9c7b3d3 | |||
| ea0c7ed83f | |||
| 069b556241 | |||
| b8c0bf7d45 | |||
| ddf0642984 | |||
| 45225545e0 | |||
| 7abfa72d11 | |||
| e2343191ef | |||
| 2b973f5dbc | |||
| dcbeb26d14 | |||
| 11ecd782e1 | |||
| 442365af77 | |||
| d86a7dfed2 | |||
| d281cb0a1a | |||
| cfddf30f0d | |||
| 4dd4d58295 | |||
| 10b1b29f82 | |||
| 9968f4915b | |||
| bba8496fb4 | |||
| 6afe954732 | |||
| 4b409dfd81 | |||
| ef569d6460 | |||
| 27dbe6a711 | |||
| c74750c3e6 | |||
| 0bc95038bb | |||
| 26b07ed902 | |||
| 4672cf50c8 | |||
| a29e5ad10f | |||
| 4a7de7a4f5 | |||
| b81197efe9 | |||
| 71eaecbb03 | |||
| e5ea3c6c4e | |||
| 0ef32b5bcf | |||
| ed54f5c44c | |||
| 8f5134fbae | |||
| 33905500ba | |||
| 1ae87643a3 | |||
| 6871011551 | |||
| b8a351985c | |||
| c04a600a91 | |||
| 40db627e6b | |||
| 1a63fbdeae | |||
| 522414fa30 | |||
| 2d09eca094 | |||
| c95c7e7ad9 | |||
| b8c1ebceab | |||
| 7a4fd34cff | |||
| 623cc0e79c | |||
| 0d57fdd5fb | |||
| b49642fa35 | |||
| ba81c4149b | |||
| c5687925ca | |||
| dae3221039 | |||
| f14acff90e | |||
| 16c5c92704 | |||
| e6324ee2b4 | |||
| 14e40e2d66 | |||
| 7b19c20e0d | |||
| cb32669b10 | |||
| 74b18fb861 | |||
| 39c164eb16 | |||
| 71e70ea26c | |||
| cac7dbb4d7 | |||
| d590c333a5 | |||
| 7bdd6f7428 | |||
| 4c242b8662 | |||
| ccbe0254e8 | |||
| c0490472b7 | |||
| f82223445f | |||
| 0b035e58a7 | |||
| b8e53c4d1e | |||
| efdb192aa6 | |||
| 3e74da3f7a | |||
| beec54a944 | |||
| 0d5a470f5d | |||
| 077b2fe80e | |||
| 0009a9c8b9 | |||
| 1c357625fb | |||
| 06088e84b2 | |||
| f778ac956b | |||
| b3c17e742a | |||
| c9de43f9d8 | |||
| d86b60c002 | |||
| 3bc9e73980 | |||
| 902f2c6f58 | |||
| 699e93db5b | |||
| 05cc7cd3a6 | |||
| 5b4bd9dfbc | |||
| 808a45d665 | |||
| d16d2766e9 | |||
| fcd5982861 | |||
| 9056458ea8 | |||
| bb5d984c0c | |||
| 259f961500 | |||
| 15af079cfe | |||
| 95031b3bcc | |||
| bf3a584344 | |||
| a12142d3c5 | |||
| 5908caea35 | |||
| 28a855c776 | |||
| bfa2ba413e | |||
| 12be735f40 | |||
| 7a44f8198c |
@@ -0,0 +1,21 @@
|
||||
name: Build Android
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '11'
|
||||
- name: Build and Lint with Gradle
|
||||
run: ./gradlew build
|
||||
- name: Archive lint results
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: lint-results
|
||||
path: "**/build/reports/lint-results*"
|
||||
+4
-1
@@ -7,4 +7,7 @@ maven-repository
|
||||
*.iml
|
||||
local.properties
|
||||
mvn-clone
|
||||
|
||||
*.keystore
|
||||
.project
|
||||
.settings
|
||||
.classpath
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
language: android
|
||||
jdk: oraclejdk7
|
||||
|
||||
script:
|
||||
- TERM=dumb ./gradlew build
|
||||
|
||||
+138
@@ -1,3 +1,141 @@
|
||||
### 4.3.0 (2021-10-25)
|
||||
|
||||
* Minimum SDK version 19, but requires additional config (see readme) for < 24 compatibility.
|
||||
* Add ScanOptions and ScanContract for use with `registerForActivityResult()`.
|
||||
* Deprecates IntentIntegrator.
|
||||
* Use minimal AndroidX libraries.
|
||||
|
||||
### 4.2.0 (2021-03-15)
|
||||
|
||||
* Fix MediaPlayer warnings (#587).
|
||||
* Prevent CameraConfigurationUtils clash (#609).
|
||||
* Add licenses to POM (#556).
|
||||
* Bug: Crashes on SDK versions older than 21 (#645).
|
||||
|
||||
### 4.1.0 (2020-01-07)
|
||||
|
||||
* Ability to hide the laser in ViewfinderView (#503).
|
||||
* Make possibleResultPoints method in BarcodeCallback optional (#504).
|
||||
* Ability to customize or disable the permission error dialog (#505).
|
||||
|
||||
### 4.0.2 (2019-09-07)
|
||||
|
||||
* Use androidx.
|
||||
* Use zxing:core 3.4.0 by default.
|
||||
* Minimum SDK version 24.
|
||||
* Fix ArithmeticException.
|
||||
* Fix ResultPoint locations when camera is mirrored.
|
||||
|
||||
### 4.0.0 / 4.0.1 (2019-09-07)
|
||||
|
||||
* Broken release - use 4.0.2.
|
||||
|
||||
### 3.6.0 (2018-03-04)
|
||||
|
||||
* Use zxing:core 3.3.2 by default (#360).
|
||||
* Minimum SDK version 19, or 14 by using zxing:core 3.3.0.
|
||||
* Fix preview race condition (#324).
|
||||
* Request code can now specified per Intent, instead of globally (#287).
|
||||
* More helpers to specify barcode formats.
|
||||
* Allow scanning both inverted and non-inverted barcodes at the same time (alternating) (#326).
|
||||
* More examples.
|
||||
|
||||
### 3.5.0 (2017-03-20)
|
||||
|
||||
* Allow changing the REQUEST_CODE value (#234).
|
||||
* Add support for inverted scans (#235).
|
||||
* Use zxing:core 3.3.0 by default (#265).
|
||||
|
||||
Fixes:
|
||||
|
||||
* Fix memory leak when using scan timeout (#283).
|
||||
* Better handling of various camera errors (#241, #268, #270)
|
||||
|
||||
### 3.4.0 (2016-10-16)
|
||||
|
||||
Changes:
|
||||
|
||||
* Beep on scan is now controlled only by the media volume, and still plays
|
||||
even if the device is in "silent mode", as long as the media volume is not muted.
|
||||
* The 150ms delay after scanning is removed.
|
||||
|
||||
Fixes:
|
||||
|
||||
* An issue where the beep sometimes played twice is fixed (#221).
|
||||
* Fix rare crash (#209)
|
||||
* Fix orientation lock issue (#181)
|
||||
* Fix race condition with TextureView (#204)
|
||||
|
||||
|
||||
### 3.3.0 (2016-06-05)
|
||||
|
||||
* Add an optional timeout to cancel scanning. (#161)
|
||||
* Rename CompoundBarcodeView to DecoratedBarcodeView.
|
||||
* Add more internal documentation (comments).
|
||||
|
||||
### 3.2.0 (2016-02-06)
|
||||
|
||||
* Improved preview scaling strategies, configurable between centerCrop, fitCenter, fitXY (#135)
|
||||
* Fix issues with Android 6 permission support (#123)
|
||||
* Fix camera initialization issues, specifically related to orientation changes (#133)
|
||||
* More control over focus mode (#112)
|
||||
* Keep drawing viewfinder frame after scanning / pausing (#134)
|
||||
* More control over torch state, and save the state on orientation change (#136)
|
||||
|
||||
### 3.1.0 (2015-12-29)
|
||||
|
||||
* Add support for Android 6 runtime permissions (Camera only).
|
||||
* Experimental support for using TextureView instead of SurfaceView.
|
||||
* Fix build issues with custom attributes.
|
||||
* Support library version 23+ is now a requirement.
|
||||
|
||||
|
||||
### 3.1.0 (2015-12-29)
|
||||
|
||||
* Initial Android 6 permission supoprt
|
||||
|
||||
### 3.0.3 (2015-08-16)
|
||||
|
||||
* Fix for preview on Google Glass.
|
||||
* Make ViewfinderView extensible. (#75)
|
||||
* Add option to return image of barcode via Intents. (#72)
|
||||
|
||||
### 3.0.2 (2015-07-21)
|
||||
|
||||
* Add helper class for encoding barcodes.
|
||||
* Support custom layouts for CompoundBarcodeView.
|
||||
|
||||
### 3.0.1 (2015-06-10)
|
||||
|
||||
* Fix auto-focus stopping when enabling the torch.
|
||||
* Fix rendering of BarcodeView / CompoundBarcodeView in layout preview of Android Studio.
|
||||
* Add option to disable beep via IntentIntegrator.
|
||||
* Fix some memory leaks with RotationListener (affected some devices only).
|
||||
|
||||
### 3.0.0 (2015-05-17)
|
||||
|
||||
* First stable release of 3.0.
|
||||
|
||||
### 3.0.0-beta4 (2015-05-03)
|
||||
|
||||
* Extract functionality out of CaptureActivity into CompoundBarcodeView and CaptureManager.
|
||||
* Add sample with Lollipop Toolbar/Actionbar (using appcompat library).
|
||||
|
||||
### 3.0.0-beta3 (2015-05-03)
|
||||
|
||||
* Add preview of scanned image to the result.
|
||||
* For some warnings for "sending message to a Handler on a dead thread"
|
||||
|
||||
### 3.0.0-beta2 (2015-04-10)
|
||||
|
||||
* Use DecoderFactory instead of Decoder.
|
||||
* Fix some orientation issues.
|
||||
|
||||
### 3.0.0-beta1 (2015-04-05)
|
||||
|
||||
* Major rewrite, allowing the library to be embedded in other Activities. See the new README for
|
||||
details.
|
||||
|
||||
### 2.3.0 (2015-04-01)
|
||||
|
||||
* Fix issues with portrait orientation.
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
## Embedding BarcodeView
|
||||
|
||||
For more control over the UI or scanning behaviour, some components may be used directly:
|
||||
|
||||
* BarcodeView: Handles displaying the preview and decoding of the barcodes.
|
||||
* DecoratedBarcodeView: Combines BarcodeView with a viewfinder for feedback, as well as some status /
|
||||
prompt text.
|
||||
* CaptureManager: Manages the InactivityTimer, BeepManager, orientation lock, and returning of the
|
||||
barcode result.
|
||||
|
||||
These components can be used from any Activity or Fragment.
|
||||
|
||||
This is much more low-level than using IntentIntegrator. Your code becomes responsible for:
|
||||
* Setting up the BarcodeView (doesn't have all the helpers from IntentIntegrator)*
|
||||
* Requesting permission to do the Camera.
|
||||
* Making sure only one Camera instance is active at a time.
|
||||
* Handling the scan results.
|
||||
|
||||
Samples:
|
||||
* [ContinuousCaptureActivity][6]: continuously scan and display results (instead of a once-off scan).
|
||||
* [ToolbarCaptureActivity][8]: Same as the normal CaptureActivity, but with a Lollipop Toolbar.
|
||||
|
||||
|
||||
## Notes on threading
|
||||
|
||||
For a responsive user interface, all camera operations happen on a dedicated background thread.
|
||||
In most cases this doesn't matter, but it does mean that the camera is not released immediately
|
||||
when the BarcodeView is paused. If you want to start using the camera for something else
|
||||
immediately after scanning, use `BarcodeView#pauseAndWait()` instead of `BarcodeView#pause()`.
|
||||
This will block the main thread until the camera is released.
|
||||
|
||||
|
||||
## Notes on scaling
|
||||
|
||||
On each Android device, the camera has a set list of available preview sizes. When embedding the
|
||||
barcode scanning along with other components on an Activity, there will almost never be a preview
|
||||
size that matches up exactly, so we have to pick one and scale and/or crop it.
|
||||
|
||||
Also affecting this is that either SurfaceView or TextureView can be used to display the preview.
|
||||
SurfaceView has better performance, but does not support cropping. TextureView is more powerful,
|
||||
but has some performance overhead, and is only supported on Android API 14+. We use SurfaceView by
|
||||
default.
|
||||
|
||||
To avoid aspect ratio distortion, we can crop the preview. However, in some combinations of
|
||||
SurfaceView and other components, the camera preview may end up displaying outside the SurfaceView,
|
||||
and over other components. This happens especially when:
|
||||
|
||||
1. Placing the scanner inside a dialog, or:
|
||||
2. Other components are placed before the (Decorated)BarcodeView, resulting in a lower z-order.
|
||||
|
||||
For these cases we have two solutions:
|
||||
|
||||
1. Use TextureView instead of SurfaceView. This may have a performance impact, but solves the above
|
||||
issues. Note that this is only available with Android API 14+.
|
||||
|
||||
2. Use either `fitCenter` or `fitXY` for scaling, instead of `centerCrop`. Note that `fitCenter` may
|
||||
result in black bars next to the preview, and `fitXY` may distort the aspect ratio.
|
||||
|
||||
The default is to:
|
||||
|
||||
1. Use TextureView on Android API 14+, SurfaceView on lower versions.
|
||||
2. Use `centerCrop` scaling when TextureView is used.
|
||||
3. Use `fitCenter` if SurfaceView is used.
|
||||
|
||||
You can override these options:
|
||||
|
||||
```xml
|
||||
<com.journeyapps.barcodescanner.DecoratedBarcodeView
|
||||
android:layout_width="..."
|
||||
android:layout_height="..."
|
||||
app:zxing_use_texture_view="false" (defaults to true, only has an effect on Android API 14+)
|
||||
app:zxing_preview_scaling_strategy="centerCrop"/> (or fitCenter / fitXY)
|
||||
```
|
||||
|
||||
For a full-screen barcode scanner with no Toolbar, the recommended options are:
|
||||
|
||||
```
|
||||
app:zxing_use_texture_view="false"
|
||||
app:zxing_preview_scaling_strategy="centerCrop"
|
||||
```
|
||||
|
||||
|
||||
[8]: sample/src/main/java/example/zxing/ToolbarCaptureActivity.java
|
||||
[6]: sample/src/main/java/example/zxing/ContinuousCaptureActivity.java
|
||||
@@ -0,0 +1,33 @@
|
||||
#### Description of the problem:
|
||||
|
||||
|
||||
|
||||
**Which library version are you using?** E.g. 3.2.0.
|
||||
|
||||
**Which phone/tablet are you using, and which Android version does it run? (e.g. Samsung Galaxy S5,
|
||||
Android 5.0)**
|
||||
|
||||
**Does the same happen on other devices or an emulator?**
|
||||
|
||||
**Can you reproduce the issue in the sample project included with the library? If not, can you
|
||||
provide your own sample project or sample code that produces this error?**
|
||||
|
||||
**In the case of an error do you have a stack trace or adb logs?**
|
||||
|
||||
<!--
|
||||
If you have an issue scanning specific barcodes, please test with the Barcode Scanner application,
|
||||
available on the Play Store: https://play.google.com/store/apps/details?id=com.google.zxing.client.android&hl=en
|
||||
|
||||
If you are also not able to scan the barcode there, the issue may be with the underlying zxing library,
|
||||
in which case you should report the issue here: https://github.com/zxing/zxing/issues
|
||||
-->
|
||||
|
||||
<!--
|
||||
If you have a question on usage of the library, please check the documentation and sample
|
||||
application first:
|
||||
|
||||
https://github.com/journeyapps/zxing-android-embedded/blob/master/README.md
|
||||
https://github.com/journeyapps/zxing-android-embedded/blob/master/EMBEDDING.md
|
||||
https://github.com/journeyapps/zxing-android-embedded/tree/master/sample/src/main/java/example/zxing
|
||||
-->
|
||||
|
||||
@@ -1,129 +1,221 @@
|
||||
# ZXing Android Minimal
|
||||
# ZXing Android Embedded
|
||||
|
||||
This is a port of the [ZXing Android Barcode Scanner application](https://github.com/zxing/zxing/) as an Android
|
||||
library project, for embedding in other Android applications. This is not affiliated with the official ZXing project.
|
||||
Barcode scanning library for Android, using [ZXing][2] for decoding.
|
||||
|
||||
Generally it is recommended to scan a barcode [via intents](https://github.com/zxing/zxing/wiki/Scanning-Via-Intent).
|
||||
There are however some cases in which it is not feasible:
|
||||
The project is loosely based on the [ZXing Android Barcode Scanner application][2], but is not affiliated with the official ZXing project.
|
||||
|
||||
* Your users cannot install the Barcode Scanner application.
|
||||
* You need to customise the barcode scanning logic.
|
||||
* You need to customise the UI.
|
||||
Features:
|
||||
|
||||
In these cases, this library may be more suitable.
|
||||
1. Can be used via Intents (little code required).
|
||||
2. Can be embedded in an Activity, for advanced customization of UI and logic.
|
||||
3. Scanning can be performed in landscape or portrait mode.
|
||||
4. Camera is managed in a background thread, for fast startup time.
|
||||
|
||||
A sample application is available in [Releases](https://github.com/journeyapps/zxing-android-embedded/releases).
|
||||
|
||||
By default, Android SDK 24+ is required because of `zxing:core` 3.4.x.
|
||||
SDK 19+ is supported with additional configuration, see [Older SDK versions](#older-sdk-versions).
|
||||
|
||||
## Adding aar dependency with Gradle
|
||||
|
||||
**Please note that the repository, group name and artifact names changed in 2.0.1.**
|
||||
Add the following to your `build.gradle` file:
|
||||
|
||||
Add the following to your build.gradle file:
|
||||
```groovy
|
||||
// Config for SDK 24+
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
|
||||
}
|
||||
```
|
||||
|
||||
## Older SDK versions
|
||||
|
||||
By default, only SDK 24+ will work, even though the library specifies 19 as the minimum version.
|
||||
|
||||
For SDK versions 19+, one of the changes below are required.
|
||||
Some older SDK versions below 19 may work, but this is not tested or supported.
|
||||
|
||||
### Option 1. Downgrade zxing:core to 3.3.0
|
||||
|
||||
```groovy
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
maven {
|
||||
url "http://dl.bintray.com/journeyapps/maven"
|
||||
dependencies {
|
||||
implementation('com.journeyapps:zxing-android-embedded:4.3.0') { transitive = false }
|
||||
implementation 'com.google.zxing:core:3.3.0'
|
||||
}
|
||||
```
|
||||
|
||||
### Option 2: Desugaring (Advanced)
|
||||
|
||||
This option does not require changing library versions, but may complicate the build process.
|
||||
|
||||
This requires Android Gradle Plugin version 4.0.0 or later.
|
||||
|
||||
See [Java 8+ API desugaring support](https://developer.android.com/studio/write/java8-support#library-desugaring).
|
||||
|
||||
Example for SDK 21+:
|
||||
|
||||
```groovy
|
||||
android {
|
||||
defaultConfig {
|
||||
minSdkVersion 21
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
// Flag to enable support for the new language APIs
|
||||
coreLibraryDesugaringEnabled true
|
||||
// Sets Java compatibility to Java 8
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Supports Android 4.0.3 and later (API level 15)
|
||||
compile 'com.journeyapps:zxing-android-embedded:2.3.0@aar'
|
||||
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
|
||||
|
||||
// Supports Android 2.1 and later (API level 7), but not optimal for later Android versions.
|
||||
// If you only plan on supporting Android 4.0.3 and up, you don't need to include this.
|
||||
compile 'com.journeyapps:zxing-android-legacy:2.3.0@aar'
|
||||
|
||||
// Convenience library to launch the scanning Activities.
|
||||
// It automatically picks the best scanning library from the above two, depending on the
|
||||
// Android version and what is available.
|
||||
compile 'com.journeyapps:zxing-android-integration:2.3.0@aar'
|
||||
|
||||
// Version 3.0.x of zxing core contains some code that is not compatible on Android 2.2 and earlier.
|
||||
// This mostly affects encoding, but you should test if you plan to support these versions.
|
||||
// Older versions e.g. 2.2 may also work if you need support for older Android versions.
|
||||
compile 'com.google.zxing:core:3.2.0'
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
||||
}
|
||||
```
|
||||
|
||||
### What's the difference between zxing-android-embedded and zxing-android-legacy?
|
||||
SDK 19+ additionally requires multiDex. In addition to these gradle config changes, the Application
|
||||
class must also be changed. See for details: [Configure your app for multidex](https://developer.android.com/studio/build/multidex#mdex-gradle).
|
||||
|
||||
The official ZXing Barcode Scanner application dropped support for older Android versions, and newer
|
||||
releases only support Android 4.0.3 and newer. If you install it on an older Android version from
|
||||
the Play Store, you will get an older version of the Barcode Scanner.
|
||||
```groovy
|
||||
android {
|
||||
defaultConfig {
|
||||
multiDexEnabled true
|
||||
minSdkVersion 19
|
||||
}
|
||||
|
||||
In order to keep up to date with the latest changes and improvements from the official project, we
|
||||
need to do the same. However, many applications still need to support older Android versions.
|
||||
compileOptions {
|
||||
// Flag to enable support for the new language APIs
|
||||
coreLibraryDesugaringEnabled true
|
||||
// Sets Java compatibility to Java 8
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
To cater for these applications, we have two libraries:
|
||||
dependencies {
|
||||
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
|
||||
|
||||
1. zxing-android-embedded - This corresponds to the latest Barcode Scanner version.
|
||||
2. zxing-android-legacy - This corresponds to version 2.2 of the ZXing project -
|
||||
the latest version that supported Android 2.2.
|
||||
|
||||
`zxing-android-embedded` uses a `zxing` prefix for all its resources, while `zxing-android-legacy`
|
||||
uses a `zxinglegacy` prefix. It is therefore possible to include both of these in your application.
|
||||
If you include both, `IntentIntegrator` will automatically choose the best one.
|
||||
|
||||
If you only need to support Android 4.0.3 and newer, you only need the `zxing-android-embedded`
|
||||
library.
|
||||
|
||||
It is also possible to only use the `zxing-android-legacy` library, but it does not include the
|
||||
latest updates and bugfixes from the ZXing project.
|
||||
|
||||
|
||||
## Adding apklib dependency with Maven
|
||||
|
||||
Support for Maven apklib is dropped in version 1.2.0.
|
||||
|
||||
Use the [1.1.x branch](https://github.com/journeyapps/zxing-android-embedded/tree/1.1.x) if you need to use this from a Maven project.
|
||||
|
||||
## Usage
|
||||
|
||||
Launch the intent with the default options:
|
||||
```java
|
||||
new IntentIntegrator(this).initiateScan(); // `this` is the current Activity
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
||||
implementation "androidx.multidex:multidex:2.0.1"
|
||||
}
|
||||
```
|
||||
|
||||
Use from a Fragment:
|
||||
```java
|
||||
IntentIntegrator.forFragment(this).initiateScan(); // `this` is the current Fragment
|
||||
## Hardware Acceleration
|
||||
|
||||
// If you're using the support library, use IntentIntegrator.forSupportFragment(this) instead.
|
||||
Hardware acceleration is required since TextureView is used.
|
||||
|
||||
Make sure it is enabled in your manifest file:
|
||||
|
||||
```xml
|
||||
<application android:hardwareAccelerated="true" ... >
|
||||
```
|
||||
|
||||
## Usage with ScanContract
|
||||
|
||||
Note: `startActivityForResult` is deprecated, so this example uses `registerForActivityResult` instead.
|
||||
See for details: https://developer.android.com/training/basics/intents/result
|
||||
|
||||
`startActivityForResult` can still be used via `IntentIntegrator`, but that is not recommended anymore.
|
||||
|
||||
```java
|
||||
// Register the launcher and result handler
|
||||
private final ActivityResultLauncher<ScanOptions> barcodeLauncher = registerForActivityResult(new ScanContract(),
|
||||
result -> {
|
||||
if(result.getContents() == null) {
|
||||
Toast.makeText(MyActivity.this, "Cancelled", Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
Toast.makeText(MyActivity.this, "Scanned: " + result.getContents(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
|
||||
// Launch
|
||||
public void onButtonClick(View view) {
|
||||
barcodeLauncher.launch(new ScanOptions());
|
||||
}
|
||||
```
|
||||
|
||||
Customize options:
|
||||
```java
|
||||
IntentIntegrator integrator = new IntentIntegrator(this);
|
||||
integrator.setDesiredBarcodeFormats(IntentIntegrator.ONE_D_CODE_TYPES);
|
||||
integrator.setPrompt("Scan a barcode");
|
||||
integrator.setResultDisplayDuration(0);
|
||||
integrator.setWide(); // Wide scanning rectangle, may work better for 1D barcodes
|
||||
integrator.setCameraId(0); // Use a specific camera of the device
|
||||
integrator.initiateScan();
|
||||
ScanOptions options = new ScanOptions();
|
||||
options.setDesiredBarcodeFormats(ScanOptions.ONE_D_CODE_TYPES);
|
||||
options.setPrompt("Scan a barcode");
|
||||
options.setCameraId(0); // Use a specific camera of the device
|
||||
options.setBeepEnabled(false);
|
||||
options.setBarcodeImageEnabled(true);
|
||||
barcodeLauncher.launch(options);
|
||||
```
|
||||
|
||||
See [IntentIntegrator](integration/src/main/java/com/google/zxing/integration/android/IntentIntegrator.java) for more options.
|
||||
See [BarcodeOptions][5] for more options.
|
||||
|
||||
### Custom Layout
|
||||
### Generate Barcode example
|
||||
|
||||
You can provide a custom layout for the capture activity. Note that you'll need to provide two
|
||||
different layouts if you are using both zxing-android-embedded and zxing-android-legacy.
|
||||
|
||||
See [custom_capture_layout.xml](sample/src/main/res/layout/custom_capture_layout.xml) and
|
||||
[custom_legacy_capture_layout.xml](sample/src/main/res/layout/custom_legacy_capture_layout.xml) for
|
||||
examples.
|
||||
While this is not the primary purpose of this library, it does include basic support for
|
||||
generating some barcode types:
|
||||
|
||||
```java
|
||||
IntentIntegrator integrator = new IntentIntegrator(this);
|
||||
integrator.setCaptureLayout(R.layout.custom_layout);
|
||||
integrator.setLegacyCaptureLayout(R.layout.custom_legacy_layout);
|
||||
integrator.initiateScan();
|
||||
try {
|
||||
BarcodeEncoder barcodeEncoder = new BarcodeEncoder();
|
||||
Bitmap bitmap = barcodeEncoder.encodeBitmap("content", BarcodeFormat.QR_CODE, 400, 400);
|
||||
ImageView imageViewQrCode = (ImageView) findViewById(R.id.qrCode);
|
||||
imageViewQrCode.setImageBitmap(bitmap);
|
||||
} catch(Exception e) {
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
For a cancel/back button, use the ids `@id/zxing_back_button` for zxing-android-embedded and
|
||||
`@id/zxinglegacy_back_button` for zxing-android-legacy.
|
||||
To customize the generated barcode image, use the `setBackgroundColor` and `setForegroundColor` functions of the
|
||||
`BarcodeEncoder` class with a [`@ColorInt`](https://developer.android.com/reference/androidx/annotation/ColorInt)
|
||||
value to update the background and foreground colors of the barcode respectively. By default, the barcode has a
|
||||
white background and black foreground.
|
||||
|
||||
|
||||
### Changing the orientation
|
||||
|
||||
To change the orientation, specify the orientation in your `AndroidManifest.xml` and let the `ManifestMerger` to update the Activity's definition.
|
||||
|
||||
Sample:
|
||||
|
||||
```xml
|
||||
<activity
|
||||
android:name="com.journeyapps.barcodescanner.CaptureActivity"
|
||||
android:screenOrientation="fullSensor"
|
||||
tools:replace="screenOrientation" />
|
||||
```
|
||||
|
||||
```java
|
||||
ScanOptions options = new ScanOptions();
|
||||
options.setOrientationLocked(false);
|
||||
barcodeLauncher.launch(options);
|
||||
```
|
||||
|
||||
### Customization and advanced options
|
||||
|
||||
See [EMBEDDING](EMBEDDING.md).
|
||||
|
||||
For more advanced options, look at the [Sample Application](https://github.com/journeyapps/zxing-android-embedded/blob/master/sample/src/main/java/example/zxing/MainActivity.java),
|
||||
and browse the source code of the library.
|
||||
|
||||
This is considered advanced usage, and is not well-documented or supported.
|
||||
|
||||
## Android Permissions
|
||||
|
||||
The camera permission is required for barcode scanning to function. It is automatically included as
|
||||
part of the library. On Android 6 it is requested at runtime when the barcode scanner is first opened.
|
||||
|
||||
When using BarcodeView directly (instead of via IntentIntegrator / CaptureActivity), you have to
|
||||
request the permission manually before calling `BarcodeView#resume()`, otherwise the camera will
|
||||
fail to open.
|
||||
|
||||
## Building locally
|
||||
|
||||
@@ -141,11 +233,30 @@ You can then use your local version by specifying in your `build.gradle` file:
|
||||
|
||||
## Sponsored by
|
||||
|
||||
[Journey][1] - Build enterprise mobile apps for iOS and Android. Work in the cloud, code in JavaScript and forget about back-end development.
|
||||
[JourneyApps][1]
|
||||
|
||||
|
||||
## License
|
||||
|
||||
[Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
||||
Licensed under the [Apache License 2.0][7]
|
||||
|
||||
Copyright (C) 2012-2022 ZXing authors, Journey Mobile
|
||||
|
||||
Licensed 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.
|
||||
|
||||
|
||||
|
||||
[1]: http://journeyapps.com
|
||||
[2]: https://github.com/zxing/zxing/
|
||||
[5]: zxing-android-embedded/src/com/journeyapps/barcodescanner/ScanOptions.java
|
||||
[7]: http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
# Updating ZXing
|
||||
|
||||
This outlines the process to bring this library up to date with the latest changes from the official
|
||||
ZXing project.
|
||||
|
||||
## 1. zxing-android-complete
|
||||
|
||||
This is a "complete" version of the BarcodeScanner project, converted to a library. The first step
|
||||
is to update this.
|
||||
|
||||
1. Clone the zxing project from Github. The scripts assume that zxing-android-minimal and zxing
|
||||
are in the same folder.
|
||||
2. In `zxing-android-complete`, run `ruby update.rb`.
|
||||
3. Inspect the changes with `git diff`, and check that the changes make sense.
|
||||
4. Test that the project can compile and run. A simple way to test is to replace
|
||||
`compile(project(':zxing-android'))` with `compile(project(':zxing-android-complete'))` in
|
||||
[sample/build.gradle](sample/build.gradle), and test the sample project.
|
||||
5. Commit the changes.
|
||||
|
||||
See [zxing-android-complete/Readme.md](zxing-android-complete/Readme.md) for more details on the
|
||||
conversion process.
|
||||
|
||||
## 2. zxing-android
|
||||
|
||||
This is a stripped-down version of zxing-android-complete. Some of the work to produce the
|
||||
stripped-down version is automated, but some is manual.
|
||||
|
||||
The project contain two source folders and two resource folders. `src-orig` and `res-orig` contain
|
||||
sources and resources from zxing-android-complete that are either unmodified, or adapted
|
||||
automatically by the update script. `src` and `res` contains sources and resources that are manually
|
||||
adapted for the library.
|
||||
|
||||
1. Make sure zxing-android-complete is updated (see above).
|
||||
2. In `zxing-android`, run `ruby update.rb`.
|
||||
3. Inspect the changes with `git diff`, and check that the changes make sense.
|
||||
4. Inspect `zxing-android/res.patch` and `zxing-android/sources.patch`. This contains the diff
|
||||
between the files in our `res` and `src` folders, and the ones from zxing-android-complete.
|
||||
Use this, along with the changes between that were made in the zxing-android-complete project
|
||||
to these files, to manually update them.
|
||||
5. Manually update AndroidManifest.xml if required.
|
||||
6. Test!
|
||||
7. Commit and make a pull request.
|
||||
|
||||
Notes:
|
||||
|
||||
* Assets (used for the help section) are not covered by this conversion process at all. We need a
|
||||
better overall plan here on how to handle help files (Use the stock Barcode Scanner help files?
|
||||
Completely remove the help section?).
|
||||
+14
-78
@@ -1,88 +1,24 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:1.0.1'
|
||||
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.0'
|
||||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
// Projects to be published to bintray
|
||||
def PUBLISH_PROJECTS = ['zxing-android', 'zxing-android-legacy', 'integration']
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.0.3'
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
google()
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
version = '2.3.0'
|
||||
version = '4.3.0'
|
||||
group = 'com.journeyapps'
|
||||
apply plugin: 'android-sdk-manager'
|
||||
|
||||
ext.androidBuildTools = '21.1.2'
|
||||
ext.androidTargetSdk = 21
|
||||
ext.zxingCore = 'com.google.zxing:core:3.2.0'
|
||||
|
||||
if (PUBLISH_PROJECTS.contains(project.name)) {
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'com.jfrog.bintray'
|
||||
|
||||
project.ext.artifactId = project.name // Default to subproject name
|
||||
|
||||
|
||||
afterEvaluate {
|
||||
|
||||
task sourceJar(type: Jar) {
|
||||
classifier = 'sources'
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
// We need this check to cover Android Studio gradle sync
|
||||
if(project.tasks.findByPath('bundleRelease') != null) {
|
||||
maven(MavenPublication) {
|
||||
artifact bundleRelease
|
||||
artifactId project.artifactId
|
||||
|
||||
artifact sourceJar
|
||||
|
||||
pom.withXml {
|
||||
// HACK to add dependencies to POM.
|
||||
// When maven-publish can do this automatically for Android projects,
|
||||
// remove this section.
|
||||
def deps = asNode().appendNode('dependencies')
|
||||
|
||||
project.configurations.compile.allDependencies.each { dep ->
|
||||
def node = deps.appendNode('dependency')
|
||||
node.appendNode('groupId', dep.group)
|
||||
node.appendNode('artifactId', dep.name)
|
||||
node.appendNode('version', dep.version)
|
||||
node.appendNode('scope', 'compile')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(project.hasProperty('bintray_user') && project.hasProperty('bintray_key')) {
|
||||
bintray {
|
||||
user = bintray_user
|
||||
key = bintray_key
|
||||
publications = ['maven']
|
||||
publish = true
|
||||
pkg {
|
||||
userOrg = 'journeyapps'
|
||||
repo = 'maven'
|
||||
name = 'zxing-android-embedded'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ext.androidTargetSdk = 30
|
||||
ext.zxingCore = 'com.google.zxing:core:3.4.1'
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
android.enableJetifier=false
|
||||
android.useAndroidX=true
|
||||
org.gradle.jvmargs=-Xmx1536M
|
||||
Vendored
BIN
Binary file not shown.
+1
-2
@@ -1,6 +1,5 @@
|
||||
#Sat Dec 20 18:56:59 SAST 2014
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
|
||||
|
||||
@@ -1,4 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed 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
|
||||
#
|
||||
# https://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.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
@@ -6,47 +22,6 @@
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
fi
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
@@ -61,9 +36,49 @@ while [ -h "$PRG" ] ; do
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >&-
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >&-
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
@@ -90,7 +105,7 @@ location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
@@ -110,10 +125,11 @@ if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
@@ -138,27 +154,30 @@ if $cygwin ; then
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
||||
Vendored
+100
@@ -0,0 +1,100 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1,18 +0,0 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
ext.artifactId = 'zxing-android-integration'
|
||||
|
||||
android {
|
||||
compileSdkVersion project.androidTargetSdk
|
||||
buildToolsVersion project.androidBuildTools
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 8
|
||||
targetSdkVersion project.androidTargetSdk
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Optional dependency.
|
||||
provided 'com.android.support:support-v4:21.0.3'
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.embarkmobile.zxing.integration">
|
||||
|
||||
<application>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,494 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009 ZXing authors
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
package com.google.zxing.integration.android;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Display;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>A utility class which helps ease integration with Barcode Scanner via {@link Intent}s. This is a simple
|
||||
* way to invoke barcode scanning and receive the result, without any need to integrate, modify, or learn the
|
||||
* project's source code.</p>
|
||||
*
|
||||
* <h2>Initiating a barcode scan</h2>
|
||||
*
|
||||
* <p>To integrate, create an instance of {@code IntentIntegrator} and call {@link #initiateScan()} and wait
|
||||
* for the result in your app.</p>
|
||||
*
|
||||
* <p>It does require that the Barcode Scanner (or work-alike) application is installed. The
|
||||
* {@link #initiateScan()} method will prompt the user to download the application, if needed.</p>
|
||||
*
|
||||
* <p>There are a few steps to using this integration. First, your {@link Activity} must implement
|
||||
* the method {@link Activity#onActivityResult(int, int, Intent)} and include a line of code like this:</p>
|
||||
*
|
||||
* <pre>{@code
|
||||
* public void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||
* IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
|
||||
* if (scanResult != null) {
|
||||
* // handle scan result
|
||||
* }
|
||||
* // else continue with any other code you need in the method
|
||||
* ...
|
||||
* }
|
||||
* }</pre>
|
||||
*
|
||||
* <p>This is where you will handle a scan result.</p>
|
||||
*
|
||||
* <p>Second, just call this in response to a user action somewhere to begin the scan process:</p>
|
||||
*
|
||||
* <pre>{@code
|
||||
* IntentIntegrator integrator = new IntentIntegrator(yourActivity);
|
||||
* integrator.initiateScan();
|
||||
* }</pre>
|
||||
*
|
||||
* <p>Finally, you can use {@link #addExtra(String, Object)} to add more parameters to the Intent used
|
||||
* to invoke the scanner. This can be used to set additional options not directly exposed by this
|
||||
* simplified API.</p>
|
||||
*
|
||||
* <h2>Sharing text via barcode</h2>
|
||||
*
|
||||
* <p>Some code, particularly download integration, was contributed from the Anobiit application.</p>
|
||||
*
|
||||
* <h2>Enabling experimental barcode formats</h2>
|
||||
*
|
||||
* <p>Some formats are not enabled by default even when scanning with {@link #ALL_CODE_TYPES}, such as
|
||||
* PDF417. Use {@link #initiateScan(java.util.Collection)} with
|
||||
* a collection containing the names of formats to scan for explicitly, like "PDF_417", to use such
|
||||
* formats.</p>
|
||||
*
|
||||
* @author Sean Owen
|
||||
* @author Fred Lin
|
||||
* @author Isaac Potoczny-Jones
|
||||
* @author Brad Drehmer
|
||||
* @author gcstang
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class IntentIntegrator {
|
||||
|
||||
public static final int REQUEST_CODE = 0x0000c0de; // Only use bottom 16 bits
|
||||
private static final String TAG = IntentIntegrator.class.getSimpleName();
|
||||
|
||||
// supported barcode formats
|
||||
public static final Collection<String> PRODUCT_CODE_TYPES = list("UPC_A", "UPC_E", "EAN_8", "EAN_13", "RSS_14");
|
||||
public static final Collection<String> ONE_D_CODE_TYPES =
|
||||
list("UPC_A", "UPC_E", "EAN_8", "EAN_13", "CODE_39", "CODE_93", "CODE_128",
|
||||
"ITF", "RSS_14", "RSS_EXPANDED");
|
||||
public static final Collection<String> QR_CODE_TYPES = Collections.singleton("QR_CODE");
|
||||
public static final Collection<String> DATA_MATRIX_TYPES = Collections.singleton("DATA_MATRIX");
|
||||
|
||||
public static final Collection<String> ALL_CODE_TYPES = null;
|
||||
|
||||
private final Activity activity;
|
||||
private android.app.Fragment fragment;
|
||||
private android.support.v4.app.Fragment supportFragment;
|
||||
|
||||
private final Map<String,Object> moreExtras = new HashMap<String,Object>(3);
|
||||
|
||||
private Collection<String> desiredBarcodeFormats;
|
||||
|
||||
private static final boolean HAVE_STANDARD_SCANNER;
|
||||
private static final boolean HAVE_LEGACY_SCANNER;
|
||||
|
||||
private static final String STANDARD_PACKAGE_NAME = "com.google.zxing.client.android";
|
||||
private static final String LEGACY_PACKAGE_NAME = "com.google.zxing.client.androidlegacy";
|
||||
|
||||
protected Class<?> getCaptureActivity() {
|
||||
try {
|
||||
return Class.forName(getScannerPackage() + ".CaptureActivity");
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException("Could not find CaptureActivity. Make sure one of the zxing-android libraries are loaded.", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static String getScannerPackage() {
|
||||
if(HAVE_STANDARD_SCANNER && Build.VERSION.SDK_INT >= 15) {
|
||||
return STANDARD_PACKAGE_NAME;
|
||||
} else if(HAVE_LEGACY_SCANNER) {
|
||||
return LEGACY_PACKAGE_NAME;
|
||||
} else {
|
||||
return STANDARD_PACKAGE_NAME;
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
boolean test1 = false;
|
||||
try {
|
||||
Class.forName(STANDARD_PACKAGE_NAME + ".CaptureActivity");
|
||||
test1 = true;
|
||||
} catch (ClassNotFoundException e) {
|
||||
// Ignore
|
||||
}
|
||||
HAVE_STANDARD_SCANNER = test1;
|
||||
|
||||
boolean test2 = false;
|
||||
try {
|
||||
Class.forName(LEGACY_PACKAGE_NAME + ".CaptureActivity");
|
||||
test2 = true;
|
||||
} catch (ClassNotFoundException e) {
|
||||
// Ignore
|
||||
}
|
||||
HAVE_LEGACY_SCANNER = test2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param activity {@link Activity} invoking the integration
|
||||
*/
|
||||
public IntentIntegrator(Activity activity) {
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param fragment {@link Fragment} invoking the integration.
|
||||
* {@link #startActivityForResult(Intent, int)} will be called on the {@link Fragment} instead
|
||||
* of an {@link Activity}
|
||||
*/
|
||||
public static IntentIntegrator forSupportFragment(android.support.v4.app.Fragment fragment) {
|
||||
IntentIntegrator integrator = new IntentIntegrator(fragment.getActivity());
|
||||
integrator.supportFragment = fragment;
|
||||
return integrator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param fragment {@link Fragment} invoking the integration.
|
||||
* {@link #startActivityForResult(Intent, int)} will be called on the {@link Fragment} instead
|
||||
* of an {@link Activity}
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
public static IntentIntegrator forFragment(Fragment fragment) {
|
||||
IntentIntegrator integrator = new IntentIntegrator(fragment.getActivity());
|
||||
integrator.fragment = fragment;
|
||||
return integrator;
|
||||
}
|
||||
|
||||
public Map<String,?> getMoreExtras() {
|
||||
return moreExtras;
|
||||
}
|
||||
|
||||
public final IntentIntegrator addExtra(String key, Object value) {
|
||||
moreExtras.put(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the layout used for scanning in zxing-android.
|
||||
*
|
||||
* @param resourceId the layout resource id to use.
|
||||
*/
|
||||
public final IntentIntegrator setCaptureLayout(int resourceId) {
|
||||
addExtra("ZXING_CAPTURE_LAYOUT_ID_KEY", resourceId);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the layout used for scanning in zxing-android-legacy.
|
||||
*
|
||||
* @param resourceId the layout resource id to use.
|
||||
*/
|
||||
public final IntentIntegrator setLegacyCaptureLayout(int resourceId) {
|
||||
addExtra("ZXINGLEGACY_CAPTURE_LAYOUT_ID_KEY", resourceId);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a prompt to display on the capture screen, instead of using the default.
|
||||
*
|
||||
* @param prompt the prompt to display
|
||||
*/
|
||||
public final IntentIntegrator setPrompt(String prompt) {
|
||||
if (prompt != null) {
|
||||
addExtra("PROMPT_MESSAGE", prompt);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the duration that the result should be displayed after scanning.
|
||||
*
|
||||
* @param ms time to display the result in ms
|
||||
*/
|
||||
public final IntentIntegrator setResultDisplayDuration(long ms) {
|
||||
addExtra("RESULT_DISPLAY_DURATION_MS", ms);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the size of the scanning rectangle.
|
||||
*
|
||||
* @param desiredWidth the desired width in pixels
|
||||
* @param desiredHeight the desired height in pixels
|
||||
*/
|
||||
public final IntentIntegrator setScanningRectangle(int desiredWidth, int desiredHeight) {
|
||||
addExtra("SCAN_WIDTH", desiredWidth);
|
||||
addExtra("SCAN_HEIGHT", desiredHeight);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the activity orientation.
|
||||
*
|
||||
* Warning: This is experimental, and not tested on many devices yet. Please report any issues
|
||||
* on https://github.com/journeyapps/zxing-android-embedded/issues
|
||||
*
|
||||
* @param orientation one of the ActivityInfo.SCREEN_ORIENTATION_* constants
|
||||
*/
|
||||
public void setOrientation(int orientation) {
|
||||
addExtra("SCAN_ORIENTATION", orientation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use a wide scanning rectangle.
|
||||
*
|
||||
* May work better for 1D barcodes.
|
||||
*/
|
||||
public void setWide() {
|
||||
addExtra("SCAN_WIDE", true);
|
||||
|
||||
// For zxing-android-legacy, which doesn't support SCAN_WIDE
|
||||
WindowManager window = activity.getWindowManager();
|
||||
Display display = window.getDefaultDisplay();
|
||||
@SuppressWarnings("deprecation")
|
||||
int displayWidth = display.getWidth();
|
||||
@SuppressWarnings("deprecation")
|
||||
int displayHeight = display.getHeight();
|
||||
if (displayHeight > displayWidth) {
|
||||
// This is portrait dimensions, but the legacy barcode scanner is always in landscape mode.
|
||||
int temp = displayWidth;
|
||||
//noinspection SuspiciousNameCombination
|
||||
displayWidth = displayHeight;
|
||||
displayHeight = temp;
|
||||
}
|
||||
|
||||
int desiredWidth = displayWidth * 9 / 10;
|
||||
int desiredHeight = Math.min(displayHeight * 3 / 4, 400); // Limit to 400px
|
||||
setScanningRectangle(desiredWidth, desiredHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
* Heuristics for whether or not the barcode scanning rectangle should be wide or not.
|
||||
*
|
||||
* Current heuristics make it wide if 1D barcode formats are scanned, and no QR codes.
|
||||
*
|
||||
* @param desiredBarcodeFormats the formats that will be scanned
|
||||
* @return true if it should be wide
|
||||
*/
|
||||
public static boolean shouldBeWide(Collection<String> desiredBarcodeFormats) {
|
||||
boolean scan1d = false;
|
||||
boolean scan2d = false;
|
||||
for (String format : desiredBarcodeFormats) {
|
||||
if(ONE_D_CODE_TYPES.contains(format)) {
|
||||
scan1d = true;
|
||||
}
|
||||
if(QR_CODE_TYPES.contains(format) || DATA_MATRIX_TYPES.contains(format)) {
|
||||
scan2d = true;
|
||||
}
|
||||
}
|
||||
|
||||
return scan1d && !scan2d;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make the scanning rectangle wide if only 1D barcodes are scanned.
|
||||
*
|
||||
* This must be called *after* setting the desired barcode formats.
|
||||
*
|
||||
* @return this
|
||||
*/
|
||||
public IntentIntegrator autoWide() {
|
||||
if(desiredBarcodeFormats != null && shouldBeWide(desiredBarcodeFormats)) {
|
||||
setWide();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the specified camera ID to scan barcodes.
|
||||
*
|
||||
* @param cameraId camera ID of the camera to use. A negative value means "no preference".
|
||||
* @return this
|
||||
*/
|
||||
public IntentIntegrator setCameraId(int cameraId) {
|
||||
if (cameraId >= 0) {
|
||||
addExtra("SCAN_CAMERA_ID", cameraId);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the desired barcode formats to scan.
|
||||
*
|
||||
* @param desiredBarcodeFormats names of {@code BarcodeFormat}s to scan for
|
||||
* @return this
|
||||
*/
|
||||
public IntentIntegrator setDesiredBarcodeFormats(Collection<String> desiredBarcodeFormats) {
|
||||
this.desiredBarcodeFormats = desiredBarcodeFormats;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates a scan for all known barcode types with the default camera.
|
||||
*/
|
||||
public final void initiateScan() {
|
||||
startActivityForResult(createScanIntent(), REQUEST_CODE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an scan intent with the specified options.
|
||||
*
|
||||
* @return the intent
|
||||
*/
|
||||
public Intent createScanIntent() {
|
||||
Intent intentScan = new Intent(activity, getCaptureActivity());
|
||||
intentScan.setAction("com.google.zxing.client.android.SCAN");
|
||||
|
||||
// check which types of codes to scan for
|
||||
if (desiredBarcodeFormats != null) {
|
||||
// set the desired barcode types
|
||||
StringBuilder joinedByComma = new StringBuilder();
|
||||
for (String format : desiredBarcodeFormats) {
|
||||
if (joinedByComma.length() > 0) {
|
||||
joinedByComma.append(',');
|
||||
}
|
||||
joinedByComma.append(format);
|
||||
}
|
||||
intentScan.putExtra("SCAN_FORMATS", joinedByComma.toString());
|
||||
}
|
||||
|
||||
intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
||||
attachMoreExtras(intentScan);
|
||||
return intentScan;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates a scan, only for a certain set of barcode types, given as strings corresponding
|
||||
* to their names in ZXing's {@code BarcodeFormat} class like "UPC_A". You can supply constants
|
||||
* like {@link #PRODUCT_CODE_TYPES} for example.
|
||||
*
|
||||
* @param desiredBarcodeFormats names of {@code BarcodeFormat}s to scan for
|
||||
*/
|
||||
public final void initiateScan(Collection<String> desiredBarcodeFormats) {
|
||||
setDesiredBarcodeFormats(desiredBarcodeFormats);
|
||||
initiateScan();
|
||||
}
|
||||
|
||||
/**
|
||||
* Start an activity. This method is defined to allow different methods of activity starting for
|
||||
* newer versions of Android and for compatibility library.
|
||||
*
|
||||
* @param intent Intent to start.
|
||||
* @param code Request code for the activity
|
||||
* @see android.app.Activity#startActivityForResult(Intent, int)
|
||||
* @see android.app.Fragment#startActivityForResult(Intent, int)
|
||||
*/
|
||||
protected void startActivityForResult(Intent intent, int code) {
|
||||
if (fragment != null) {
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
fragment.startActivityForResult(intent, code);
|
||||
}
|
||||
} else if(supportFragment != null) {
|
||||
supportFragment.startActivityForResult(intent, code);
|
||||
} else {
|
||||
activity.startActivityForResult(intent, code);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void startActivity(Intent intent) {
|
||||
if (fragment != null) {
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
||||
fragment.startActivity(intent);
|
||||
}
|
||||
} else if(supportFragment != null) {
|
||||
supportFragment.startActivity(intent);
|
||||
} else {
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Call this from your {@link Activity}'s
|
||||
* {@link Activity#onActivityResult(int, int, Intent)} method.</p>
|
||||
*
|
||||
* @param requestCode request code from {@code onActivityResult()}
|
||||
* @param resultCode result code from {@code onActivityResult()}
|
||||
* @param intent {@link Intent} from {@code onActivityResult()}
|
||||
* @return null if the event handled here was not related to this class, or
|
||||
* else an {@link IntentResult} containing the result of the scan. If the user cancelled scanning,
|
||||
* the fields will be null.
|
||||
*/
|
||||
public static IntentResult parseActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||
if (requestCode == REQUEST_CODE) {
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
String contents = intent.getStringExtra("SCAN_RESULT");
|
||||
String formatName = intent.getStringExtra("SCAN_RESULT_FORMAT");
|
||||
byte[] rawBytes = intent.getByteArrayExtra("SCAN_RESULT_BYTES");
|
||||
int intentOrientation = intent.getIntExtra("SCAN_RESULT_ORIENTATION", Integer.MIN_VALUE);
|
||||
Integer orientation = intentOrientation == Integer.MIN_VALUE ? null : intentOrientation;
|
||||
String errorCorrectionLevel = intent.getStringExtra("SCAN_RESULT_ERROR_CORRECTION_LEVEL");
|
||||
return new IntentResult(contents,
|
||||
formatName,
|
||||
rawBytes,
|
||||
orientation,
|
||||
errorCorrectionLevel);
|
||||
}
|
||||
return new IntentResult();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static List<String> list(String... values) {
|
||||
return Collections.unmodifiableList(Arrays.asList(values));
|
||||
}
|
||||
|
||||
private void attachMoreExtras(Intent intent) {
|
||||
for (Map.Entry<String,Object> entry : moreExtras.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
// Kind of hacky
|
||||
if (value instanceof Integer) {
|
||||
intent.putExtra(key, (Integer) value);
|
||||
} else if (value instanceof Long) {
|
||||
intent.putExtra(key, (Long) value);
|
||||
} else if (value instanceof Boolean) {
|
||||
intent.putExtra(key, (Boolean) value);
|
||||
} else if (value instanceof Double) {
|
||||
intent.putExtra(key, (Double) value);
|
||||
} else if (value instanceof Float) {
|
||||
intent.putExtra(key, (Float) value);
|
||||
} else if (value instanceof Bundle) {
|
||||
intent.putExtra(key, (Bundle) value);
|
||||
} else {
|
||||
intent.putExtra(key, value.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1,26 +0,0 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
|
||||
android {
|
||||
compileSdkVersion project.androidTargetSdk
|
||||
buildToolsVersion project.androidBuildTools
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 11
|
||||
targetSdkVersion project.androidTargetSdk
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile(project(':zxing-android')) { transitive = true }
|
||||
compile(project(':zxing-android-legacy')) { transitive = true }
|
||||
compile(project(':integration'))
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in /home/ralf/apps/android-studio/sdk/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the ProGuard
|
||||
# include property in project.properties.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="example.zxing" >
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/icon"
|
||||
android:label="@string/app_name" >
|
||||
<activity
|
||||
android:name="example.zxing.MainActivity"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,108 +0,0 @@
|
||||
package example.zxing;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.zxing.integration.android.IntentIntegrator;
|
||||
import com.google.zxing.integration.android.IntentResult;
|
||||
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
}
|
||||
|
||||
public void scanBarcode(View view) {
|
||||
new IntentIntegrator((Activity)this).initiateScan();
|
||||
}
|
||||
|
||||
public void scanBarcodeCustomOptions(View view) {
|
||||
IntentIntegrator integrator = new IntentIntegrator(this);
|
||||
integrator.setDesiredBarcodeFormats(IntentIntegrator.ONE_D_CODE_TYPES);
|
||||
integrator.autoWide();
|
||||
integrator.initiateScan();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
|
||||
if(result != null) {
|
||||
if(result.getContents() == null) {
|
||||
Toast.makeText(this, "Cancelled", Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
Toast.makeText(this, "Scanned: " + result.getContents(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} else {
|
||||
// This is important, otherwise the result will not be passed to the fragment
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sample of scanning from a Fragment
|
||||
*/
|
||||
public static class ScanFragment extends Fragment {
|
||||
private String toast;
|
||||
|
||||
public ScanFragment() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
displayToast();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_scan, container, false);
|
||||
Button scan = (Button) view.findViewById(R.id.scan_from_fragment);
|
||||
scan.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
scanFromFragment();
|
||||
}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
|
||||
public void scanFromFragment() {
|
||||
IntentIntegrator.forFragment(this).initiateScan();
|
||||
}
|
||||
|
||||
private void displayToast() {
|
||||
if(getActivity() != null && toast != null) {
|
||||
Toast.makeText(getActivity(), toast, Toast.LENGTH_LONG).show();
|
||||
toast = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
|
||||
if(result != null) {
|
||||
if(result.getContents() == null) {
|
||||
toast = "Cancelled from fragment";
|
||||
} else {
|
||||
toast = "Scanned from fragment: " + result.getContents();
|
||||
}
|
||||
|
||||
// At this point we may or may not have a reference to the activity
|
||||
displayToast();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.5 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.7 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 24 KiB |
@@ -1,33 +0,0 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:orientation="vertical"
|
||||
tools:context="example.zxing.MainActivity">
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/scan_barcode"
|
||||
android:onClick="scanBarcode"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/custom_options"
|
||||
android:onClick="scanBarcodeCustomOptions"/>
|
||||
|
||||
|
||||
<fragment
|
||||
android:tag="scan_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
android:name="example.zxing.MainActivity$ScanFragment" tools:layout="@layout/fragment_scan" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,16 +0,0 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
tools:context="example.zxing.MainActivity"
|
||||
tools:showIn="@layout/activity_main">
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/scan_from_fragment"
|
||||
android:id="@+id/scan_from_fragment"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,6 +0,0 @@
|
||||
<resources>
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="app_name">ZXing Sample</string>
|
||||
<string name="scan_barcode">Scan Barcode</string>
|
||||
<string name="custom_options">Custom Options</string>
|
||||
<string name="scan_from_fragment">Scan from fragment</string>
|
||||
|
||||
</resources>
|
||||
@@ -1,8 +0,0 @@
|
||||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="android:Theme">
|
||||
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -1 +0,0 @@
|
||||
/build
|
||||
+71
-8
@@ -2,25 +2,88 @@ apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion project.androidTargetSdk
|
||||
buildToolsVersion project.androidBuildTools
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 9
|
||||
multiDexEnabled true
|
||||
minSdkVersion 19
|
||||
targetSdkVersion project.androidTargetSdk
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
versionCode 411
|
||||
versionName "4.1.1"
|
||||
}
|
||||
|
||||
def validConfig
|
||||
def keystoreFile
|
||||
def keystorePassword
|
||||
def keystoreAlias
|
||||
|
||||
try {
|
||||
Properties properties = new Properties()
|
||||
properties.load(project.rootProject.file('local.properties').newDataInputStream())
|
||||
keystoreFile = properties.getProperty('keystore.file')
|
||||
keystorePassword = properties.getProperty('keystore.password')
|
||||
keystoreAlias = properties.getProperty('keystore.alias')
|
||||
validConfig = keystoreFile != null && keystorePassword != null && keystoreAlias != null
|
||||
} catch (error) {
|
||||
validConfig = false
|
||||
}
|
||||
|
||||
if (validConfig) {
|
||||
System.out.println("Release signing configured with " + keystoreFile)
|
||||
signingConfigs {
|
||||
release {
|
||||
storeFile project.rootProject.file(keystoreFile)
|
||||
storePassword keystorePassword
|
||||
keyAlias keystoreAlias
|
||||
keyPassword keystorePassword
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("Specify keystore.file, keystore.alias and keystore.password in local.properties to enable release signing.")
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
if (validConfig) {
|
||||
signingConfig signingConfigs.release
|
||||
}
|
||||
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
coreLibraryDesugaringEnabled true
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
// Error: The lint detector
|
||||
// androidx.appcompat.view.OnClickXmlDetector
|
||||
// called context.getMainProject() during module analysis.
|
||||
disable 'UsingOnClickInXml'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dependencies {
|
||||
compile(project(':zxing-android')) { transitive = true }
|
||||
compile(project(':zxing-android-legacy')) { transitive = true }
|
||||
compile(project(':integration'))
|
||||
compile 'com.android.support:appcompat-v7:21.0.3'
|
||||
// If you use this from an external project, use the following instead:
|
||||
// implementation 'com.journeyapps:zxing-android-embedded:<version>'
|
||||
implementation project(':zxing-android-embedded')
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
|
||||
implementation "androidx.activity:activity:1.3.1"
|
||||
|
||||
// Desugaring and multidex is required for API < 21.
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
|
||||
// leakcanary is for development purposes only
|
||||
// https://github.com/square/leakcanary
|
||||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
|
||||
|
||||
// AboutLibraries
|
||||
implementation 'com.mikepenz:aboutlibraries:6.2.3'
|
||||
}
|
||||
|
||||
@@ -1,21 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="example.zxing" >
|
||||
package="example.zxing">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:name=".SampleApplication"
|
||||
android:allowBackup="false"
|
||||
android:icon="@drawable/icon"
|
||||
android:label="@string/app_name" >
|
||||
android:label="@string/app_name">
|
||||
<activity
|
||||
android:name="example.zxing.MainActivity"
|
||||
android:name=".MainActivity"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme" >
|
||||
android:theme="@style/AppTheme">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".ContinuousCaptureActivity"></activity>
|
||||
<activity
|
||||
android:name=".AnyOrientationCaptureActivity"
|
||||
android:screenOrientation="fullSensor"
|
||||
android:stateNotNeeded="true"
|
||||
android:theme="@style/zxing_CaptureTheme"
|
||||
android:windowSoftInputMode="stateAlwaysHidden"></activity>
|
||||
<activity
|
||||
android:name=".ToolbarCaptureActivity"
|
||||
android:clearTaskOnLaunch="true"
|
||||
android:screenOrientation="portrait"
|
||||
android:stateNotNeeded="true"
|
||||
android:theme="@style/AppCompatCaptureTheme"
|
||||
android:windowSoftInputMode="stateAlwaysHidden"></activity>
|
||||
<activity
|
||||
android:name=".CustomScannerActivity"
|
||||
android:screenOrientation="fullSensor"
|
||||
android:stateNotNeeded="true"
|
||||
android:theme="@style/zxing_CaptureTheme"
|
||||
android:windowSoftInputMode="stateAlwaysHidden"></activity>
|
||||
<activity
|
||||
android:name=".SmallCaptureActivity"
|
||||
android:screenOrientation="fullSensor"
|
||||
android:stateNotNeeded="true"
|
||||
android:theme="@style/zxing_CaptureTheme"
|
||||
android:windowSoftInputMode="stateAlwaysHidden"></activity>
|
||||
<activity
|
||||
android:name=".TabbedScanning"
|
||||
android:theme="@style/Theme.AppCompat"
|
||||
android:label="@string/title_activity_tabbed_scanning"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
</manifest>
|
||||
@@ -0,0 +1,11 @@
|
||||
package example.zxing;
|
||||
|
||||
import com.journeyapps.barcodescanner.CaptureActivity;
|
||||
|
||||
/**
|
||||
* This Activity is exactly the same as CaptureActivity, but has a different orientation
|
||||
* setting in AndroidManifest.xml.
|
||||
*/
|
||||
public class AnyOrientationCaptureActivity extends CaptureActivity {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package example.zxing;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.ResultPoint;
|
||||
import com.google.zxing.client.android.BeepManager;
|
||||
import com.journeyapps.barcodescanner.BarcodeCallback;
|
||||
import com.journeyapps.barcodescanner.BarcodeResult;
|
||||
import com.journeyapps.barcodescanner.DecoratedBarcodeView;
|
||||
import com.journeyapps.barcodescanner.DefaultDecoderFactory;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This sample performs continuous scanning, displaying the barcode and source image whenever
|
||||
* a barcode is scanned.
|
||||
*/
|
||||
public class ContinuousCaptureActivity extends Activity {
|
||||
private DecoratedBarcodeView barcodeView;
|
||||
private BeepManager beepManager;
|
||||
private String lastText;
|
||||
|
||||
private BarcodeCallback callback = new BarcodeCallback() {
|
||||
@Override
|
||||
public void barcodeResult(BarcodeResult result) {
|
||||
if(result.getText() == null || result.getText().equals(lastText)) {
|
||||
// Prevent duplicate scans
|
||||
return;
|
||||
}
|
||||
|
||||
lastText = result.getText();
|
||||
barcodeView.setStatusText(result.getText());
|
||||
|
||||
beepManager.playBeepSoundAndVibrate();
|
||||
|
||||
//Added preview of scanned barcode
|
||||
ImageView imageView = findViewById(R.id.barcodePreview);
|
||||
imageView.setImageBitmap(result.getBitmapWithResultPoints(Color.YELLOW));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void possibleResultPoints(List<ResultPoint> resultPoints) {
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.continuous_scan);
|
||||
|
||||
barcodeView = findViewById(R.id.barcode_scanner);
|
||||
Collection<BarcodeFormat> formats = Arrays.asList(BarcodeFormat.QR_CODE, BarcodeFormat.CODE_39);
|
||||
barcodeView.getBarcodeView().setDecoderFactory(new DefaultDecoderFactory(formats));
|
||||
barcodeView.initializeFromIntent(getIntent());
|
||||
barcodeView.decodeContinuous(callback);
|
||||
|
||||
beepManager = new BeepManager(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
barcodeView.resume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
|
||||
barcodeView.pause();
|
||||
}
|
||||
|
||||
public void pause(View view) {
|
||||
barcodeView.pause();
|
||||
}
|
||||
|
||||
public void resume(View view) {
|
||||
barcodeView.resume();
|
||||
}
|
||||
|
||||
public void triggerScan(View view) {
|
||||
barcodeView.decodeSingle(callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
return barcodeView.onKeyDown(keyCode, event) || super.onKeyDown(keyCode, event);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package example.zxing;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.journeyapps.barcodescanner.CaptureManager;
|
||||
import com.journeyapps.barcodescanner.DecoratedBarcodeView;
|
||||
import com.journeyapps.barcodescanner.ViewfinderView;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Custom Scannner Activity extending from Activity to display a custom layout form scanner view.
|
||||
*/
|
||||
public class CustomScannerActivity extends Activity implements
|
||||
DecoratedBarcodeView.TorchListener {
|
||||
|
||||
private CaptureManager capture;
|
||||
private DecoratedBarcodeView barcodeScannerView;
|
||||
private Button switchFlashlightButton;
|
||||
private ViewfinderView viewfinderView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_custom_scanner);
|
||||
|
||||
barcodeScannerView = findViewById(R.id.zxing_barcode_scanner);
|
||||
barcodeScannerView.setTorchListener(this);
|
||||
|
||||
switchFlashlightButton = findViewById(R.id.switch_flashlight);
|
||||
|
||||
viewfinderView = findViewById(R.id.zxing_viewfinder_view);
|
||||
|
||||
// if the device does not have flashlight in its camera,
|
||||
// then remove the switch flashlight button...
|
||||
if (!hasFlash()) {
|
||||
switchFlashlightButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
capture = new CaptureManager(this, barcodeScannerView);
|
||||
capture.initializeFromIntent(getIntent(), savedInstanceState);
|
||||
capture.setShowMissingCameraPermissionDialog(false);
|
||||
capture.decode();
|
||||
|
||||
changeMaskColor(null);
|
||||
changeLaserVisibility(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
capture.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
capture.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
capture.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
capture.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
return barcodeScannerView.onKeyDown(keyCode, event) || super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the device's camera has a Flashlight.
|
||||
* @return true if there is Flashlight, otherwise false.
|
||||
*/
|
||||
private boolean hasFlash() {
|
||||
return getApplicationContext().getPackageManager()
|
||||
.hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH);
|
||||
}
|
||||
|
||||
public void switchFlashlight(View view) {
|
||||
if (getString(R.string.turn_on_flashlight).equals(switchFlashlightButton.getText())) {
|
||||
barcodeScannerView.setTorchOn();
|
||||
} else {
|
||||
barcodeScannerView.setTorchOff();
|
||||
}
|
||||
}
|
||||
|
||||
public void changeMaskColor(View view) {
|
||||
Random rnd = new Random();
|
||||
int color = Color.argb(100, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));
|
||||
viewfinderView.setMaskColor(color);
|
||||
}
|
||||
|
||||
public void changeLaserVisibility(boolean visible) {
|
||||
viewfinderView.setLaserVisibility(visible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTorchOn() {
|
||||
switchFlashlightButton.setText(R.string.turn_off_flashlight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTorchOff() {
|
||||
switchFlashlightButton.setText(R.string.turn_on_flashlight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
capture.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,43 @@
|
||||
package example.zxing;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.hardware.Camera;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.zxing.integration.android.IntentIntegrator;
|
||||
import com.google.zxing.integration.android.IntentResult;
|
||||
import com.google.zxing.client.android.Intents;
|
||||
import com.journeyapps.barcodescanner.ScanContract;
|
||||
import com.journeyapps.barcodescanner.ScanOptions;
|
||||
import com.mikepenz.aboutlibraries.LibsBuilder;
|
||||
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
|
||||
public class MainActivity extends ActionBarActivity {
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
private final ActivityResultLauncher<ScanOptions> barcodeLauncher = registerForActivityResult(new ScanContract(),
|
||||
result -> {
|
||||
if(result.getContents() == null) {
|
||||
Intent originalIntent = result.getOriginalIntent();
|
||||
if (originalIntent == null) {
|
||||
Log.d("MainActivity", "Cancelled scan");
|
||||
Toast.makeText(MainActivity.this, "Cancelled", Toast.LENGTH_LONG).show();
|
||||
} else if(originalIntent.hasExtra(Intents.Scan.MISSING_CAMERA_PERMISSION)) {
|
||||
Log.d("MainActivity", "Cancelled scan due to missing camera permission");
|
||||
Toast.makeText(MainActivity.this, "Cancelled due to missing camera permission", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} else {
|
||||
Log.d("MainActivity", "Scanned");
|
||||
Toast.makeText(MainActivity.this, "Scanned: " + result.getContents(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -25,95 +46,111 @@ public class MainActivity extends ActionBarActivity {
|
||||
}
|
||||
|
||||
public void scanBarcode(View view) {
|
||||
new IntentIntegrator(this).initiateScan();
|
||||
barcodeLauncher.launch(new ScanOptions());
|
||||
}
|
||||
|
||||
public void scanBarcodeInverted(View view){
|
||||
ScanOptions options = new ScanOptions();
|
||||
options.addExtra(Intents.Scan.SCAN_TYPE, Intents.Scan.INVERTED_SCAN);
|
||||
barcodeLauncher.launch(options);
|
||||
}
|
||||
|
||||
public void scanMixedBarcodes(View view){
|
||||
ScanOptions options = new ScanOptions();
|
||||
options.addExtra(Intents.Scan.SCAN_TYPE, Intents.Scan.MIXED_SCAN);
|
||||
barcodeLauncher.launch(options);
|
||||
}
|
||||
|
||||
public void scanBarcodeCustomLayout(View view) {
|
||||
IntentIntegrator integrator = new IntentIntegrator(this);
|
||||
integrator.setCaptureLayout(R.layout.custom_capture_layout);
|
||||
integrator.setLegacyCaptureLayout(R.layout.custom_legacy_capture_layout);
|
||||
integrator.setDesiredBarcodeFormats(IntentIntegrator.ONE_D_CODE_TYPES);
|
||||
integrator.autoWide();
|
||||
integrator.setOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
|
||||
integrator.initiateScan();
|
||||
ScanOptions options = new ScanOptions();
|
||||
options.setCaptureActivity(AnyOrientationCaptureActivity.class);
|
||||
options.setDesiredBarcodeFormats(ScanOptions.ONE_D_CODE_TYPES);
|
||||
options.setPrompt("Scan something");
|
||||
options.setOrientationLocked(false);
|
||||
options.setBeepEnabled(false);
|
||||
barcodeLauncher.launch(options);
|
||||
}
|
||||
|
||||
public void scanPDF417(View view) {
|
||||
ScanOptions options = new ScanOptions();
|
||||
options.setDesiredBarcodeFormats(ScanOptions.PDF_417);
|
||||
options.setPrompt("Scan something");
|
||||
options.setOrientationLocked(false);
|
||||
options.setBeepEnabled(false);
|
||||
barcodeLauncher.launch(options);
|
||||
}
|
||||
|
||||
|
||||
public void scanBarcodeFrontCamera(View view) {
|
||||
IntentIntegrator integrator = new IntentIntegrator(this);
|
||||
integrator.setCameraId(Camera.CameraInfo.CAMERA_FACING_FRONT);
|
||||
integrator.initiateScan();
|
||||
ScanOptions options = new ScanOptions();
|
||||
options.setCameraId(Camera.CameraInfo.CAMERA_FACING_FRONT);
|
||||
barcodeLauncher.launch(options);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
|
||||
if(result != null) {
|
||||
if(result.getContents() == null) {
|
||||
Toast.makeText(this, "Cancelled", Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
Toast.makeText(this, "Scanned: " + result.getContents(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} else {
|
||||
// This is important, otherwise the result will not be passed to the fragment
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
public void scanContinuous(View view) {
|
||||
Intent intent = new Intent(this, ContinuousCaptureActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
public void scanToolbar(View view) {
|
||||
ScanOptions options = new ScanOptions().setCaptureActivity(ToolbarCaptureActivity.class);
|
||||
barcodeLauncher.launch(options);
|
||||
}
|
||||
|
||||
public void scanCustomScanner(View view) {
|
||||
ScanOptions options = new ScanOptions().setOrientationLocked(false).setCaptureActivity(CustomScannerActivity.class);
|
||||
barcodeLauncher.launch(options);
|
||||
}
|
||||
|
||||
public void scanMarginScanner(View view) {
|
||||
ScanOptions options = new ScanOptions();
|
||||
options.setOrientationLocked(false);
|
||||
options.setCaptureActivity(SmallCaptureActivity.class);
|
||||
barcodeLauncher.launch(options);
|
||||
}
|
||||
|
||||
public void scanWithTimeout(View view) {
|
||||
ScanOptions options = new ScanOptions();
|
||||
options.setTimeout(8000);
|
||||
barcodeLauncher.launch(options);
|
||||
}
|
||||
|
||||
public void tabs(View view) {
|
||||
Intent intent = new Intent(this, TabbedScanning.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
public void about(View view) {
|
||||
new LibsBuilder().start(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sample of scanning from a Fragment
|
||||
*/
|
||||
public static class ScanFragment extends Fragment {
|
||||
private String toast;
|
||||
private final ActivityResultLauncher<ScanOptions> fragmentLauncher = registerForActivityResult(new ScanContract(),
|
||||
result -> {
|
||||
if(result.getContents() == null) {
|
||||
Toast.makeText(getContext(), "Cancelled from fragment", Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
Toast.makeText(getContext(), "Scanned from fragment: " + result.getContents(), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
});
|
||||
|
||||
public ScanFragment() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
displayToast();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_scan, container, false);
|
||||
Button scan = (Button) view.findViewById(R.id.scan_from_fragment);
|
||||
scan.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
scanFromFragment();
|
||||
}
|
||||
});
|
||||
Button scan = view.findViewById(R.id.scan_from_fragment);
|
||||
scan.setOnClickListener(v -> scanFromFragment());
|
||||
return view;
|
||||
}
|
||||
|
||||
public void scanFromFragment() {
|
||||
IntentIntegrator.forSupportFragment(this).initiateScan();
|
||||
}
|
||||
|
||||
private void displayToast() {
|
||||
if(getActivity() != null && toast != null) {
|
||||
Toast.makeText(getActivity(), toast, Toast.LENGTH_LONG).show();
|
||||
toast = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
|
||||
if(result != null) {
|
||||
if(result.getContents() == null) {
|
||||
toast = "Cancelled from fragment";
|
||||
} else {
|
||||
toast = "Scanned from fragment: " + result.getContents();
|
||||
}
|
||||
|
||||
// At this point we may or may not have a reference to the activity
|
||||
displayToast();
|
||||
}
|
||||
fragmentLauncher.launch(new ScanOptions());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package example.zxing;
|
||||
|
||||
import androidx.multidex.MultiDexApplication;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class SampleApplication extends MultiDexApplication {
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package example.zxing;
|
||||
|
||||
import com.journeyapps.barcodescanner.CaptureActivity;
|
||||
import com.journeyapps.barcodescanner.DecoratedBarcodeView;
|
||||
|
||||
/**
|
||||
* This activity has a margin.
|
||||
*/
|
||||
public class SmallCaptureActivity extends CaptureActivity {
|
||||
@Override
|
||||
protected DecoratedBarcodeView initializeContent() {
|
||||
setContentView(R.layout.capture_small);
|
||||
return (DecoratedBarcodeView)findViewById(R.id.zxing_barcode_scanner);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
package example.zxing;
|
||||
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentPagerAdapter;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.legacy.app.FragmentStatePagerAdapter;
|
||||
import androidx.viewpager.widget.PagerAdapter;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.journeyapps.barcodescanner.CameraPreview;
|
||||
import com.journeyapps.barcodescanner.DecoratedBarcodeView;
|
||||
|
||||
public class TabbedScanning extends AppCompatActivity implements ActionBar.TabListener {
|
||||
|
||||
/**
|
||||
* The {@link PagerAdapter} that will provide
|
||||
* fragments for each of the sections. We use a
|
||||
* {@link FragmentPagerAdapter} derivative, which will keep every
|
||||
* loaded fragment in memory. If this becomes too memory intensive, it
|
||||
* may be best to switch to a
|
||||
* {@link FragmentStatePagerAdapter}.
|
||||
*/
|
||||
private SectionsPagerAdapter mSectionsPagerAdapter;
|
||||
|
||||
|
||||
/**
|
||||
* The {@link ViewPager} that will host the section contents.
|
||||
*/
|
||||
private ViewPager mViewPager;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_tabbed_scanning);
|
||||
// Create the adapter that will return a fragment for each of the three
|
||||
// primary sections of the activity.
|
||||
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
|
||||
|
||||
// Set up the ViewPager with the sections adapter.
|
||||
mViewPager = findViewById(R.id.container);
|
||||
mViewPager.setAdapter(mSectionsPagerAdapter);
|
||||
|
||||
// Set up the action bar.
|
||||
final ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
|
||||
|
||||
// When swiping between different sections, select the corresponding
|
||||
// tab. We can also use ActionBar.Tab#select() to do this if we have
|
||||
// a reference to the Tab.
|
||||
mViewPager.setOffscreenPageLimit(0);
|
||||
mViewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
actionBar.setSelectedNavigationItem(position);
|
||||
}
|
||||
});
|
||||
|
||||
// For each of the sections in the app, add a tab to the action bar.
|
||||
for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
|
||||
// Create a tab with text corresponding to the page title defined by
|
||||
// the adapter. Also specify this Activity object, which implements
|
||||
// the TabListener interface, as the callback (listener) for when
|
||||
// this tab is selected.
|
||||
actionBar.addTab(
|
||||
actionBar.newTab()
|
||||
.setText(mSectionsPagerAdapter.getPageTitle(i))
|
||||
.setTabListener(this));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
|
||||
// When the given tab is selected, switch to the corresponding page in
|
||||
// the ViewPager.
|
||||
mViewPager.setCurrentItem(tab.getPosition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
|
||||
}
|
||||
|
||||
/**
|
||||
* A placeholder fragment containing a simple view.
|
||||
*/
|
||||
public static class ScanFragment extends Fragment {
|
||||
DecoratedBarcodeView barcodeView;
|
||||
|
||||
public ScanFragment() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance of this fragment for the given section
|
||||
* number.
|
||||
*/
|
||||
public static ScanFragment newInstance() {
|
||||
return new ScanFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View rootView = inflater.inflate(R.layout.fragment_tabbed_scanning, container, false);
|
||||
barcodeView = rootView.findViewById(R.id.barcode_view);
|
||||
return rootView;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setUserVisibleHint(boolean isVisibleToUser) {
|
||||
super.setUserVisibleHint(isVisibleToUser);
|
||||
if(barcodeView != null) {
|
||||
if (isVisibleToUser) {
|
||||
barcodeView.resume();
|
||||
} else {
|
||||
barcodeView.pauseAndWait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
barcodeView.pauseAndWait();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
barcodeView.resume();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A placeholder fragment containing a simple view.
|
||||
*/
|
||||
public static class CameraFragment extends Fragment {
|
||||
|
||||
private CameraPreview cameraPreview;
|
||||
|
||||
public CameraFragment() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance of this fragment for the given section
|
||||
* number.
|
||||
*/
|
||||
public static CameraFragment newInstance() {
|
||||
return new CameraFragment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View rootView = inflater.inflate(R.layout.fragment_tabbed_camera, container, false);
|
||||
cameraPreview = rootView.findViewById(R.id.camera_preview);
|
||||
return rootView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUserVisibleHint(boolean isVisibleToUser) {
|
||||
super.setUserVisibleHint(isVisibleToUser);
|
||||
|
||||
if (cameraPreview != null) {
|
||||
if (isVisibleToUser) {
|
||||
cameraPreview.resume();
|
||||
} else {
|
||||
cameraPreview.pauseAndWait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
cameraPreview.pauseAndWait();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to
|
||||
* one of the sections/tabs/pages.
|
||||
*/
|
||||
public class SectionsPagerAdapter extends FragmentPagerAdapter {
|
||||
|
||||
public SectionsPagerAdapter(FragmentManager fm) {
|
||||
super(fm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
if(position == 0) {
|
||||
return ScanFragment.newInstance();
|
||||
} else {
|
||||
return CameraFragment.newInstance();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
return "Scan";
|
||||
case 1:
|
||||
return "Camera";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package example.zxing;
|
||||
|
||||
import android.os.Bundle;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
import com.journeyapps.barcodescanner.CaptureManager;
|
||||
import com.journeyapps.barcodescanner.DecoratedBarcodeView;
|
||||
|
||||
/**
|
||||
* Sample Activity extending from ActionBarActivity to display a Toolbar.
|
||||
*/
|
||||
public class ToolbarCaptureActivity extends AppCompatActivity {
|
||||
private CaptureManager capture;
|
||||
private DecoratedBarcodeView barcodeScannerView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.capture_appcompat);
|
||||
Toolbar toolbar = findViewById(R.id.my_awesome_toolbar);
|
||||
toolbar.setTitle("Scan Barcode");
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
barcodeScannerView = findViewById(R.id.zxing_barcode_scanner);
|
||||
|
||||
capture = new CaptureManager(this, barcodeScannerView);
|
||||
capture.initializeFromIntent(getIntent(), savedInstanceState);
|
||||
capture.decode();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
capture.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
capture.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
capture.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
capture.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSupportNavigateUp() {
|
||||
onBackPressed();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
return barcodeScannerView.onKeyDown(keyCode, event) || super.onKeyDown(keyCode, event);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="example.zxing.CustomScannerActivity">
|
||||
|
||||
<com.journeyapps.barcodescanner.DecoratedBarcodeView
|
||||
android:id="@+id/zxing_barcode_scanner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:zxing_scanner_layout="@layout/custom_barcode_scanner">
|
||||
</com.journeyapps.barcodescanner.DecoratedBarcodeView>
|
||||
|
||||
<Button
|
||||
android:id="@+id/switch_flashlight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/turn_on_flashlight"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:onClick="switchFlashlight"/>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -1,38 +1,106 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:orientation="vertical"
|
||||
tools:context="example.zxing.MainActivity">
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/scan_barcode"
|
||||
android:onClick="scanBarcode"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/custom_layout"
|
||||
android:onClick="scanBarcodeCustomLayout"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/front_camera"
|
||||
android:onClick="scanBarcodeFrontCamera"/>
|
||||
|
||||
|
||||
<fragment
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin">
|
||||
|
||||
android:name="example.zxing.MainActivity$ScanFragment" tools:layout="@layout/fragment_scan" />
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/scan_barcode"
|
||||
android:onClick="scanBarcode"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Scan PDF417"
|
||||
android:onClick="scanPDF417"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Scan Inverted"
|
||||
android:onClick="scanBarcodeInverted"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Scan Normal and Inverted"
|
||||
android:onClick="scanMixedBarcodes"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/any_orientation"
|
||||
android:onClick="scanBarcodeCustomLayout"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/front_camera"
|
||||
android:onClick="scanBarcodeFrontCamera"/>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/fragment_scan"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:name="example.zxing.MainActivity$ScanFragment" tools:layout="@layout/fragment_scan" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/custom_activity"
|
||||
android:onClick="scanContinuous"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/toolbar_activity"
|
||||
android:onClick="scanToolbar"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/custom_scanner"
|
||||
android:onClick="scanCustomScanner"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/scanner_with_margin"
|
||||
android:onClick="scanMarginScanner"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/scanner_with_timeout"
|
||||
android:onClick="scanWithTimeout"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/tabs"
|
||||
android:onClick="tabs"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/about"
|
||||
android:onClick="about"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</ScrollView>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<androidx.viewpager.widget.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="example.zxing.TabbedScanning" />
|
||||
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2008 ZXing authors
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/my_awesome_toolbar"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
app:theme="@style/ThemeOverlay.AppCompat.ActionBar"/>
|
||||
|
||||
<com.journeyapps.barcodescanner.DecoratedBarcodeView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_below="@+id/my_awesome_toolbar"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:id="@+id/zxing_barcode_scanner"
|
||||
app:zxing_use_texture_view="true"/>
|
||||
|
||||
|
||||
<!-- Sample for a footer. Also add to DecoratedBarcodeView: android:layout_above="@+id/footer" -->
|
||||
<!-- <TextView
|
||||
android:id="@+id/footer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:text="Footer"
|
||||
android:gravity="center"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"/> -->
|
||||
</RelativeLayout>
|
||||
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2008 ZXing authors
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.journeyapps.barcodescanner.DecoratedBarcodeView
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="50dp"
|
||||
android:layout_marginRight="50dp"
|
||||
android:layout_marginTop="150dp"
|
||||
android:layout_marginBottom="150dp"
|
||||
android:id="@+id/zxing_barcode_scanner"
|
||||
app:zxing_use_texture_view="false"
|
||||
app:zxing_preview_scaling_strategy="fitXY"/>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.journeyapps.barcodescanner.DecoratedBarcodeView
|
||||
android:id="@+id/barcode_scanner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_above="@+id/buttonsLayout"
|
||||
android:layout_alignParentTop="true">
|
||||
|
||||
</com.journeyapps.barcodescanner.DecoratedBarcodeView>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:id="@+id/buttonsLayout"
|
||||
android:layout_toLeftOf="@+id/centerHorizont">
|
||||
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Pause"
|
||||
android:onClick="pause" />
|
||||
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Resume"
|
||||
android:onClick="resume" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:id="@+id/centerHorizont" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@id/centerHorizont"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignTop="@id/buttonsLayout"
|
||||
android:id="@+id/barcodePreview" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<com.journeyapps.barcodescanner.BarcodeView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/zxing_barcode_surface"
|
||||
app:zxing_framing_rect_width="250dp"
|
||||
app:zxing_framing_rect_height="50dp"/>
|
||||
|
||||
<com.journeyapps.barcodescanner.ViewfinderView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/zxing_viewfinder_view"
|
||||
app:zxing_possible_result_points="@color/zxing_custom_possible_result_points"
|
||||
app:zxing_result_view="@color/zxing_custom_result_view"
|
||||
app:zxing_viewfinder_laser="@color/zxing_custom_viewfinder_laser"
|
||||
app:zxing_viewfinder_laser_visibility="true"
|
||||
app:zxing_viewfinder_mask="@color/zxing_custom_viewfinder_mask"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/zxing_status_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:background="@color/zxing_transparent"
|
||||
android:text="@string/zxing_msg_default_status"
|
||||
android:textColor="@color/zxing_status_text"/>
|
||||
|
||||
</merge>
|
||||
@@ -1,221 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2008 ZXing authors
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<SurfaceView android:id="@+id/zxing_preview_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"/>
|
||||
|
||||
<com.google.zxing.client.android.ViewfinderView
|
||||
android:id="@+id/zxing_viewfinder_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"/>
|
||||
|
||||
<LinearLayout android:id="@+id/zxing_result_view"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@color/zxing_result_view"
|
||||
android:visibility="gone"
|
||||
android:baselineAligned="false">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/zxing_standard_padding">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="right|center_vertical">
|
||||
|
||||
<ImageView android:id="@+id/zxing_barcode_image_view"
|
||||
android:layout_width="160dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxWidth="160dip"
|
||||
android:maxHeight="160dip"
|
||||
android:layout_marginBottom="@dimen/zxing_half_padding"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"
|
||||
tools:ignore="ContentDescription"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/zxing_msg_default_format"
|
||||
android:textColor="@color/zxing_result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/zxing_half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/zxing_format_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxing_result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/zxing_msg_default_type"
|
||||
android:textColor="@color/zxing_result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/zxing_half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/zxing_type_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxing_result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/zxing_msg_default_time"
|
||||
android:textColor="@color/zxing_result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/zxing_half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/zxing_time_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxing_result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:id="@+id/zxing_meta_text_view_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/zxing_msg_default_meta"
|
||||
android:textColor="@color/zxing_result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/zxing_half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/zxing_meta_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxing_result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView android:id="@+id/zxing_contents_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxing_result_text"
|
||||
android:textColorLink="@color/zxing_result_text"
|
||||
android:textSize="22sp"
|
||||
android:paddingLeft="12dip"
|
||||
android:autoLink="web"
|
||||
android:textIsSelectable="true"/>
|
||||
|
||||
<TextView android:id="@+id/zxing_contents_supplement_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxing_result_text"
|
||||
android:textColorLink="@color/zxing_result_text"
|
||||
android:paddingLeft="12dip"
|
||||
android:autoLink="web"
|
||||
android:textIsSelectable="true"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/zxing_result_button_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center">
|
||||
|
||||
<Button style="@style/zxing_ResultButton"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button style="@style/zxing_ResultButton"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button style="@style/zxing_ResultButton"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button style="@style/zxing_ResultButton"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView android:id="@+id/zxing_status_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:background="@color/zxing_transparent"
|
||||
android:text="@string/zxing_msg_default_status"
|
||||
android:textColor="@color/zxing_status_text"/>
|
||||
|
||||
<Button android:id="@id/zxing_back_button"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:height="60dp"
|
||||
android:textAlignment="center"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:text="@string/zxing_button_cancel"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</merge>
|
||||
@@ -1,227 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2008 ZXing authors
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<SurfaceView android:id="@+id/zxinglegacy_preview_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"/>
|
||||
|
||||
<com.google.zxing.client.androidlegacy.ViewfinderView
|
||||
android:id="@+id/zxinglegacy_viewfinder_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"/>
|
||||
|
||||
<LinearLayout android:id="@+id/zxinglegacy_result_view"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@color/zxinglegacy_result_view"
|
||||
android:visibility="gone"
|
||||
android:baselineAligned="false">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/zxinglegacy_standard_padding">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:gravity="right|center_vertical">
|
||||
|
||||
<ImageView android:id="@+id/zxinglegacy_barcode_image_view"
|
||||
android:layout_width="160dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxWidth="160dip"
|
||||
android:maxHeight="160dip"
|
||||
android:layout_marginBottom="@dimen/zxinglegacy_half_padding"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"/>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/zxinglegacy_msg_default_format"
|
||||
android:textColor="@color/zxinglegacy_result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/zxinglegacy_half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/format_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxinglegacy_result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/zxinglegacy_msg_default_type"
|
||||
android:textColor="@color/zxinglegacy_result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/zxinglegacy_half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/zxinglegacy_type_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxinglegacy_result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/zxinglegacy_msg_default_time"
|
||||
android:textColor="@color/zxinglegacy_result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/zxinglegacy_half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/zxinglegacy_time_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxinglegacy_result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:id="@+id/meta_text_view_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/zxinglegacy_msg_default_meta"
|
||||
android:textColor="@color/zxinglegacy_result_minor_text"
|
||||
android:textStyle="bold"
|
||||
android:paddingRight="@dimen/zxinglegacy_half_padding"/>
|
||||
|
||||
<TextView android:id="@+id/zxinglegacy_meta_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxinglegacy_result_minor_text"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView android:id="@+id/zxinglegacy_contents_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxinglegacy_result_text"
|
||||
android:textColorLink="@color/zxinglegacy_result_text"
|
||||
android:textSize="22sp"
|
||||
android:paddingLeft="12dip"
|
||||
android:autoLink="web"/>
|
||||
|
||||
<TextView android:id="@+id/zxinglegacy_contents_supplement_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/zxinglegacy_result_text"
|
||||
android:textColorLink="@color/zxinglegacy_result_text"
|
||||
android:paddingLeft="12dip"
|
||||
android:autoLink="web"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/zxinglegacy_result_button_view"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center">
|
||||
|
||||
<Button android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<Button android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView android:id="@+id/zxinglegacy_status_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:background="@color/zxinglegacy_transparent"
|
||||
android:text="@string/zxinglegacy_msg_default_status"
|
||||
android:textColor="@color/zxinglegacy_status_text"/>
|
||||
|
||||
<Button android:id="@id/zxinglegacy_back_button"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:height="60dp"
|
||||
android:textAlignment="center"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:text="@string/zxinglegacy_button_cancel"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
@@ -0,0 +1,17 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context="example.zxing.TabbedScanning$CameraFragment">
|
||||
|
||||
<com.journeyapps.barcodescanner.CameraPreview
|
||||
android:id="@+id/camera_preview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -0,0 +1,18 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
tools:context="example.zxing.TabbedScanning$ScanFragment">
|
||||
|
||||
|
||||
<com.journeyapps.barcodescanner.DecoratedBarcodeView
|
||||
android:id="@+id/barcode_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -0,0 +1,4 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context="example.zxing.TabbedScanning">
|
||||
</menu>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="AppCompatCaptureTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||
<item name="android:statusBarColor">#ffb341</item>
|
||||
<item name="android:windowTranslucentStatus">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,6 @@
|
||||
<resources>
|
||||
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
|
||||
(such as screen margins) for screens with more than 820dp of available width. This
|
||||
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
|
||||
<dimen name="activity_horizontal_margin">64dp</dimen>
|
||||
</resources>
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
|
||||
</resources>
|
||||
</resources>
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
|
||||
|
||||
<string name="app_name">ZXing Sample</string>
|
||||
<string name="scan_barcode">Scan Barcode</string>
|
||||
<string name="custom_layout">Custom Layout / Any Orientation</string>
|
||||
<string name="scan_barcode_with_request_code">Scan Barcode with customized request code</string>
|
||||
<string name="any_orientation">1D Any Orientation</string>
|
||||
<string name="scan_from_fragment">Scan from fragment</string>
|
||||
<string name="front_camera">Front Camera</string>
|
||||
<string name="custom_activity">Continuous Scan</string>
|
||||
<string name="toolbar_activity">Activity with Toolbar</string>
|
||||
<string name="custom_scanner">Custom Scanner Activity</string>
|
||||
<string name="scanner_with_margin">Scanner with Margin</string>
|
||||
<string name="scanner_with_timeout">Finish Scan in 8 Seconds</string>
|
||||
<string name="turn_on_flashlight">Turn on Flashlight</string>
|
||||
<string name="turn_off_flashlight">Turn off Flashlight</string>
|
||||
<string name="title_activity_tabbed_scanning">Tabbed Scanning</string>
|
||||
<string name="tabs">Tabs</string>
|
||||
<string name="about">About</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat">
|
||||
|
||||
</style>
|
||||
|
||||
<style name="AppCompatCaptureTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="android:windowFullscreen">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
<item name="colorPrimary">#ffb341</item>
|
||||
<item name="colorPrimaryDark">#ffb341</item>
|
||||
<item name="colorAccent">#ffb341</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
||||
+1
-5
@@ -1,6 +1,2 @@
|
||||
include ':zxing-android'
|
||||
include ':zxing-android-complete'
|
||||
include ':zxing-android-legacy'
|
||||
include ':integration'
|
||||
include ':zxing-android-embedded'
|
||||
include ':sample'
|
||||
include ':sample-nosupport'
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
target/
|
||||
*.iml
|
||||
bin/
|
||||
gen/
|
||||
libs/
|
||||
local.properties
|
||||
@@ -1,106 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2008 ZXing authors
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.google.zxing.client.android"
|
||||
>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="22"/>
|
||||
|
||||
<!-- Don't require camera, as this requires a rear camera. This allows it to work on the Nexus 7 -->
|
||||
<uses-feature android:name="android.hardware.camera" android:required="false"/>
|
||||
<uses-feature android:name="android.hardware.camera.front" android:required="false"/>
|
||||
<!-- TODO replace above two with next line after Android 4.2 -->
|
||||
<!-- <uses-feature android:name="android.hardware.camera.any"/> -->
|
||||
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
|
||||
<uses-feature android:name="android.hardware.camera.flash" android:required="false"/>
|
||||
<uses-feature android:name="android.hardware.screen.landscape"/>
|
||||
<uses-feature android:name="android.hardware.wifi" android:required="false"/>
|
||||
<!-- This excludes Google TV, which is unfortunately included by virtue of not requiring a camera -->
|
||||
<uses-feature android:name="android.hardware.touchscreen"/>
|
||||
<!-- TODO make this not required again after android.hardware.camera.any is available -->
|
||||
|
||||
|
||||
|
||||
<application android:icon="@drawable/zxing_launcher_icon"
|
||||
android:logo="@drawable/zxing_launcher_icon"
|
||||
android:label="@string/zxing_app_name"
|
||||
android:allowBackup="true">
|
||||
<activity android:name=".CaptureActivity"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:clearTaskOnLaunch="true"
|
||||
android:stateNotNeeded="true"
|
||||
android:theme="@style/zxing_CaptureTheme"
|
||||
android:windowSoftInputMode="stateAlwaysHidden">
|
||||
|
||||
|
||||
<!-- Allow web apps to launch Barcode Scanner by linking to http://zxing.appspot.com/scan. -->
|
||||
|
||||
<!-- We also support a Google Product Search URL. -->
|
||||
|
||||
<!-- And the UK version. -->
|
||||
|
||||
<!-- Support zxing://scan/?... like iPhone app -->
|
||||
|
||||
</activity>
|
||||
<activity android:name=".PreferencesActivity"
|
||||
android:label="@string/zxing_preferences_name"
|
||||
android:stateNotNeeded="true"/>
|
||||
<activity android:name=".encode.EncodeActivity"
|
||||
android:stateNotNeeded="true">
|
||||
|
||||
<!-- This allows us to handle the Share button in Contacts. -->
|
||||
|
||||
<!-- This allows us to handle sharing any plain text . -->
|
||||
|
||||
</activity>
|
||||
<activity android:name=".book.SearchBookContentsActivity"
|
||||
android:label="@string/zxing_sbc_name"
|
||||
android:stateNotNeeded="true"
|
||||
android:screenOrientation="sensorLandscape">
|
||||
|
||||
</activity>
|
||||
<activity android:name=".share.ShareActivity"
|
||||
android:stateNotNeeded="true"
|
||||
android:screenOrientation="user">
|
||||
|
||||
</activity>
|
||||
<activity android:name=".history.HistoryActivity"
|
||||
android:label="@string/zxing_history_title"
|
||||
android:stateNotNeeded="true"/>
|
||||
<activity android:name=".share.BookmarkPickerActivity"
|
||||
android:label="@string/zxing_bookmark_picker_name"
|
||||
android:stateNotNeeded="true"/>
|
||||
<activity android:name=".share.AppPickerActivity"
|
||||
android:label="@string/zxing_app_picker_name"
|
||||
android:stateNotNeeded="true"/>
|
||||
<activity android:name=".HelpActivity"
|
||||
android:label="@string/zxing_menu_help"
|
||||
android:screenOrientation="user"
|
||||
android:stateNotNeeded="true"/>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,16 +0,0 @@
|
||||
# zxing-android-complete
|
||||
|
||||
This is a complete copy of the ZXing Android application, converted to an Android library.
|
||||
|
||||
This is not intended to be used directly, but rather as a starting point to create a stripped-down
|
||||
version.
|
||||
|
||||
`ruby update.rb` script does roughly the following:
|
||||
|
||||
1. Copy the Java source code, resources and assets from the ZXing Android application.
|
||||
2. Prefix all resource files and names with `zxing_`.
|
||||
3. Replace switch statements on resource ids with if statements.
|
||||
4. Place assets in a `zxing` subfolder.
|
||||
5. Update references in the Java code to all the renamed resources and assets.
|
||||
6. Remove unwanted sections from AndroidManifest.xml.
|
||||
7. Set minSdkVersion to 7.
|
||||
-447
@@ -1,447 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 ZXing authors
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
package com.google.zxing.client.android.camera;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.hardware.Camera;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Utility methods for configuring the Android camera.
|
||||
*
|
||||
* @author Sean Owen
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
|
||||
public final class CameraConfigurationUtils {
|
||||
|
||||
private static final String TAG = "CameraConfiguration";
|
||||
|
||||
private static final Pattern SEMICOLON = Pattern.compile(";");
|
||||
|
||||
private static final int MIN_PREVIEW_PIXELS = 480 * 320; // normal screen
|
||||
private static final float MAX_EXPOSURE_COMPENSATION = 1.5f;
|
||||
private static final float MIN_EXPOSURE_COMPENSATION = 0.0f;
|
||||
private static final double MAX_ASPECT_DISTORTION = 0.15;
|
||||
private static final int MIN_FPS = 10;
|
||||
private static final int MAX_FPS = 20;
|
||||
private static final int AREA_PER_1000 = 400;
|
||||
|
||||
private CameraConfigurationUtils() {
|
||||
}
|
||||
|
||||
public static void setFocus(Camera.Parameters parameters,
|
||||
boolean autoFocus,
|
||||
boolean disableContinuous,
|
||||
boolean safeMode) {
|
||||
List<String> supportedFocusModes = parameters.getSupportedFocusModes();
|
||||
String focusMode = null;
|
||||
if (autoFocus) {
|
||||
if (safeMode || disableContinuous) {
|
||||
focusMode = findSettableValue("focus mode",
|
||||
supportedFocusModes,
|
||||
Camera.Parameters.FOCUS_MODE_AUTO);
|
||||
} else {
|
||||
focusMode = findSettableValue("focus mode",
|
||||
supportedFocusModes,
|
||||
Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE,
|
||||
Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO,
|
||||
Camera.Parameters.FOCUS_MODE_AUTO);
|
||||
}
|
||||
}
|
||||
// Maybe selected auto-focus but not available, so fall through here:
|
||||
if (!safeMode && focusMode == null) {
|
||||
focusMode = findSettableValue("focus mode",
|
||||
supportedFocusModes,
|
||||
Camera.Parameters.FOCUS_MODE_MACRO,
|
||||
Camera.Parameters.FOCUS_MODE_EDOF);
|
||||
}
|
||||
if (focusMode != null) {
|
||||
if (focusMode.equals(parameters.getFocusMode())) {
|
||||
Log.i(TAG, "Focus mode already set to " + focusMode);
|
||||
} else {
|
||||
parameters.setFocusMode(focusMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void setTorch(Camera.Parameters parameters, boolean on) {
|
||||
List<String> supportedFlashModes = parameters.getSupportedFlashModes();
|
||||
String flashMode;
|
||||
if (on) {
|
||||
flashMode = findSettableValue("flash mode",
|
||||
supportedFlashModes,
|
||||
Camera.Parameters.FLASH_MODE_TORCH,
|
||||
Camera.Parameters.FLASH_MODE_ON);
|
||||
} else {
|
||||
flashMode = findSettableValue("flash mode",
|
||||
supportedFlashModes,
|
||||
Camera.Parameters.FLASH_MODE_OFF);
|
||||
}
|
||||
if (flashMode != null) {
|
||||
if (flashMode.equals(parameters.getFlashMode())) {
|
||||
Log.i(TAG, "Flash mode already set to " + flashMode);
|
||||
} else {
|
||||
Log.i(TAG, "Setting flash mode to " + flashMode);
|
||||
parameters.setFlashMode(flashMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void setBestExposure(Camera.Parameters parameters, boolean lightOn) {
|
||||
int minExposure = parameters.getMinExposureCompensation();
|
||||
int maxExposure = parameters.getMaxExposureCompensation();
|
||||
float step = parameters.getExposureCompensationStep();
|
||||
if ((minExposure != 0 || maxExposure != 0) && step > 0.0f) {
|
||||
// Set low when light is on
|
||||
float targetCompensation = lightOn ? MIN_EXPOSURE_COMPENSATION : MAX_EXPOSURE_COMPENSATION;
|
||||
int compensationSteps = Math.round(targetCompensation / step);
|
||||
float actualCompensation = step * compensationSteps;
|
||||
// Clamp value:
|
||||
compensationSteps = Math.max(Math.min(compensationSteps, maxExposure), minExposure);
|
||||
if (parameters.getExposureCompensation() == compensationSteps) {
|
||||
Log.i(TAG, "Exposure compensation already set to " + compensationSteps + " / " + actualCompensation);
|
||||
} else {
|
||||
Log.i(TAG, "Setting exposure compensation to " + compensationSteps + " / " + actualCompensation);
|
||||
parameters.setExposureCompensation(compensationSteps);
|
||||
}
|
||||
} else {
|
||||
Log.i(TAG, "Camera does not support exposure compensation");
|
||||
}
|
||||
}
|
||||
|
||||
public static void setBestPreviewFPS(Camera.Parameters parameters) {
|
||||
setBestPreviewFPS(parameters, MIN_FPS, MAX_FPS);
|
||||
}
|
||||
|
||||
public static void setBestPreviewFPS(Camera.Parameters parameters, int minFPS, int maxFPS) {
|
||||
List<int[]> supportedPreviewFpsRanges = parameters.getSupportedPreviewFpsRange();
|
||||
Log.i(TAG, "Supported FPS ranges: " + toString(supportedPreviewFpsRanges));
|
||||
if (supportedPreviewFpsRanges != null && !supportedPreviewFpsRanges.isEmpty()) {
|
||||
int[] suitableFPSRange = null;
|
||||
for (int[] fpsRange : supportedPreviewFpsRanges) {
|
||||
int thisMin = fpsRange[Camera.Parameters.PREVIEW_FPS_MIN_INDEX];
|
||||
int thisMax = fpsRange[Camera.Parameters.PREVIEW_FPS_MAX_INDEX];
|
||||
if (thisMin >= minFPS * 1000 && thisMax <= maxFPS * 1000) {
|
||||
suitableFPSRange = fpsRange;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (suitableFPSRange == null) {
|
||||
Log.i(TAG, "No suitable FPS range?");
|
||||
} else {
|
||||
int[] currentFpsRange = new int[2];
|
||||
parameters.getPreviewFpsRange(currentFpsRange);
|
||||
if (Arrays.equals(currentFpsRange, suitableFPSRange)) {
|
||||
Log.i(TAG, "FPS range already set to " + Arrays.toString(suitableFPSRange));
|
||||
} else {
|
||||
Log.i(TAG, "Setting FPS range to " + Arrays.toString(suitableFPSRange));
|
||||
parameters.setPreviewFpsRange(suitableFPSRange[Camera.Parameters.PREVIEW_FPS_MIN_INDEX],
|
||||
suitableFPSRange[Camera.Parameters.PREVIEW_FPS_MAX_INDEX]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void setFocusArea(Camera.Parameters parameters) {
|
||||
if (parameters.getMaxNumFocusAreas() > 0) {
|
||||
Log.i(TAG, "Old focus areas: " + toString(parameters.getFocusAreas()));
|
||||
List<Camera.Area> middleArea = buildMiddleArea(AREA_PER_1000);
|
||||
Log.i(TAG, "Setting focus area to : " + toString(middleArea));
|
||||
parameters.setFocusAreas(middleArea);
|
||||
} else {
|
||||
Log.i(TAG, "Device does not support focus areas");
|
||||
}
|
||||
}
|
||||
|
||||
public static void setMetering(Camera.Parameters parameters) {
|
||||
if (parameters.getMaxNumMeteringAreas() > 0) {
|
||||
Log.i(TAG, "Old metering areas: " + parameters.getMeteringAreas());
|
||||
List<Camera.Area> middleArea = buildMiddleArea(AREA_PER_1000);
|
||||
Log.i(TAG, "Setting metering area to : " + toString(middleArea));
|
||||
parameters.setMeteringAreas(middleArea);
|
||||
} else {
|
||||
Log.i(TAG, "Device does not support metering areas");
|
||||
}
|
||||
}
|
||||
|
||||
private static List<Camera.Area> buildMiddleArea(int areaPer1000) {
|
||||
return Collections.singletonList(
|
||||
new Camera.Area(new Rect(-areaPer1000, -areaPer1000, areaPer1000, areaPer1000), 1));
|
||||
}
|
||||
|
||||
public static void setVideoStabilization(Camera.Parameters parameters) {
|
||||
if (parameters.isVideoStabilizationSupported()) {
|
||||
if (parameters.getVideoStabilization()) {
|
||||
Log.i(TAG, "Video stabilization already enabled");
|
||||
} else {
|
||||
Log.i(TAG, "Enabling video stabilization...");
|
||||
parameters.setVideoStabilization(true);
|
||||
}
|
||||
} else {
|
||||
Log.i(TAG, "This device does not support video stabilization");
|
||||
}
|
||||
}
|
||||
|
||||
public static void setBarcodeSceneMode(Camera.Parameters parameters) {
|
||||
if (Camera.Parameters.SCENE_MODE_BARCODE.equals(parameters.getSceneMode())) {
|
||||
Log.i(TAG, "Barcode scene mode already set");
|
||||
return;
|
||||
}
|
||||
String sceneMode = findSettableValue("scene mode",
|
||||
parameters.getSupportedSceneModes(),
|
||||
Camera.Parameters.SCENE_MODE_BARCODE);
|
||||
if (sceneMode != null) {
|
||||
parameters.setSceneMode(sceneMode);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setZoom(Camera.Parameters parameters, double targetZoomRatio) {
|
||||
if (parameters.isZoomSupported()) {
|
||||
Integer zoom = indexOfClosestZoom(parameters, targetZoomRatio);
|
||||
if (zoom == null) {
|
||||
return;
|
||||
}
|
||||
if (parameters.getZoom() == zoom) {
|
||||
Log.i(TAG, "Zoom is already set to " + zoom);
|
||||
} else {
|
||||
Log.i(TAG, "Setting zoom to " + zoom);
|
||||
parameters.setZoom(zoom);
|
||||
}
|
||||
} else {
|
||||
Log.i(TAG, "Zoom is not supported");
|
||||
}
|
||||
}
|
||||
|
||||
private static Integer indexOfClosestZoom(Camera.Parameters parameters, double targetZoomRatio) {
|
||||
List<Integer> ratios = parameters.getZoomRatios();
|
||||
Log.i(TAG, "Zoom ratios: " + ratios);
|
||||
int maxZoom = parameters.getMaxZoom();
|
||||
if (ratios == null || ratios.isEmpty() || ratios.size() != maxZoom + 1) {
|
||||
Log.w(TAG, "Invalid zoom ratios!");
|
||||
return null;
|
||||
}
|
||||
double target100 = 100.0 * targetZoomRatio;
|
||||
double smallestDiff = Double.POSITIVE_INFINITY;
|
||||
int closestIndex = 0;
|
||||
for (int i = 0; i < ratios.size(); i++) {
|
||||
double diff = Math.abs(ratios.get(i) - target100);
|
||||
if (diff < smallestDiff) {
|
||||
smallestDiff = diff;
|
||||
closestIndex = i;
|
||||
}
|
||||
}
|
||||
Log.i(TAG, "Chose zoom ratio of " + (ratios.get(closestIndex) / 100.0));
|
||||
return closestIndex;
|
||||
}
|
||||
|
||||
public static void setInvertColor(Camera.Parameters parameters) {
|
||||
if (Camera.Parameters.EFFECT_NEGATIVE.equals(parameters.getColorEffect())) {
|
||||
Log.i(TAG, "Negative effect already set");
|
||||
return;
|
||||
}
|
||||
String colorMode = findSettableValue("color effect",
|
||||
parameters.getSupportedColorEffects(),
|
||||
Camera.Parameters.EFFECT_NEGATIVE);
|
||||
if (colorMode != null) {
|
||||
parameters.setColorEffect(colorMode);
|
||||
}
|
||||
}
|
||||
|
||||
public static Point findBestPreviewSizeValue(Camera.Parameters parameters, Point screenResolution) {
|
||||
|
||||
List<Camera.Size> rawSupportedSizes = parameters.getSupportedPreviewSizes();
|
||||
if (rawSupportedSizes == null) {
|
||||
Log.w(TAG, "Device returned no supported preview sizes; using default");
|
||||
Camera.Size defaultSize = parameters.getPreviewSize();
|
||||
if (defaultSize == null) {
|
||||
throw new IllegalStateException("Parameters contained no preview size!");
|
||||
}
|
||||
return new Point(defaultSize.width, defaultSize.height);
|
||||
}
|
||||
|
||||
// Sort by size, descending
|
||||
List<Camera.Size> supportedPreviewSizes = new ArrayList<>(rawSupportedSizes);
|
||||
Collections.sort(supportedPreviewSizes, new Comparator<Camera.Size>() {
|
||||
@Override
|
||||
public int compare(Camera.Size a, Camera.Size b) {
|
||||
int aPixels = a.height * a.width;
|
||||
int bPixels = b.height * b.width;
|
||||
if (bPixels < aPixels) {
|
||||
return -1;
|
||||
}
|
||||
if (bPixels > aPixels) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
|
||||
if (Log.isLoggable(TAG, Log.INFO)) {
|
||||
StringBuilder previewSizesString = new StringBuilder();
|
||||
for (Camera.Size supportedPreviewSize : supportedPreviewSizes) {
|
||||
previewSizesString.append(supportedPreviewSize.width).append('x')
|
||||
.append(supportedPreviewSize.height).append(' ');
|
||||
}
|
||||
Log.i(TAG, "Supported preview sizes: " + previewSizesString);
|
||||
}
|
||||
|
||||
double screenAspectRatio = (double) screenResolution.x / (double) screenResolution.y;
|
||||
|
||||
// Remove sizes that are unsuitable
|
||||
Iterator<Camera.Size> it = supportedPreviewSizes.iterator();
|
||||
while (it.hasNext()) {
|
||||
Camera.Size supportedPreviewSize = it.next();
|
||||
int realWidth = supportedPreviewSize.width;
|
||||
int realHeight = supportedPreviewSize.height;
|
||||
if (realWidth * realHeight < MIN_PREVIEW_PIXELS) {
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean isCandidatePortrait = realWidth < realHeight;
|
||||
int maybeFlippedWidth = isCandidatePortrait ? realHeight : realWidth;
|
||||
int maybeFlippedHeight = isCandidatePortrait ? realWidth : realHeight;
|
||||
double aspectRatio = (double) maybeFlippedWidth / (double) maybeFlippedHeight;
|
||||
double distortion = Math.abs(aspectRatio - screenAspectRatio);
|
||||
if (distortion > MAX_ASPECT_DISTORTION) {
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (maybeFlippedWidth == screenResolution.x && maybeFlippedHeight == screenResolution.y) {
|
||||
Point exactPoint = new Point(realWidth, realHeight);
|
||||
Log.i(TAG, "Found preview size exactly matching screen size: " + exactPoint);
|
||||
return exactPoint;
|
||||
}
|
||||
}
|
||||
|
||||
// If no exact match, use largest preview size. This was not a great idea on older devices because
|
||||
// of the additional computation needed. We're likely to get here on newer Android 4+ devices, where
|
||||
// the CPU is much more powerful.
|
||||
if (!supportedPreviewSizes.isEmpty()) {
|
||||
Camera.Size largestPreview = supportedPreviewSizes.get(0);
|
||||
Point largestSize = new Point(largestPreview.width, largestPreview.height);
|
||||
Log.i(TAG, "Using largest suitable preview size: " + largestSize);
|
||||
return largestSize;
|
||||
}
|
||||
|
||||
// If there is nothing at all suitable, return current preview size
|
||||
Camera.Size defaultPreview = parameters.getPreviewSize();
|
||||
if (defaultPreview == null) {
|
||||
throw new IllegalStateException("Parameters contained no preview size!");
|
||||
}
|
||||
Point defaultSize = new Point(defaultPreview.width, defaultPreview.height);
|
||||
Log.i(TAG, "No suitable preview sizes, using default: " + defaultSize);
|
||||
return defaultSize;
|
||||
}
|
||||
|
||||
private static String findSettableValue(String name,
|
||||
Collection<String> supportedValues,
|
||||
String... desiredValues) {
|
||||
Log.i(TAG, "Requesting " + name + " value from among: " + Arrays.toString(desiredValues));
|
||||
Log.i(TAG, "Supported " + name + " values: " + supportedValues);
|
||||
if (supportedValues != null) {
|
||||
for (String desiredValue : desiredValues) {
|
||||
if (supportedValues.contains(desiredValue)) {
|
||||
Log.i(TAG, "Can set " + name + " to: " + desiredValue);
|
||||
return desiredValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.i(TAG, "No supported values match");
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String toString(Collection<int[]> arrays) {
|
||||
if (arrays == null || arrays.isEmpty()) {
|
||||
return "[]";
|
||||
}
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append('[');
|
||||
Iterator<int[]> it = arrays.iterator();
|
||||
while (it.hasNext()) {
|
||||
buffer.append(Arrays.toString(it.next()));
|
||||
if (it.hasNext()) {
|
||||
buffer.append(", ");
|
||||
}
|
||||
}
|
||||
buffer.append(']');
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
private static String toString(Iterable<Camera.Area> areas) {
|
||||
if (areas == null) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder result = new StringBuilder();
|
||||
for (Camera.Area area : areas) {
|
||||
result.append(area.rect).append(':').append(area.weight).append(' ');
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public static String collectStats(Camera.Parameters parameters) {
|
||||
return collectStats(parameters.flatten());
|
||||
}
|
||||
|
||||
public static String collectStats(CharSequence flattenedParams) {
|
||||
StringBuilder result = new StringBuilder(1000);
|
||||
|
||||
result.append("BOARD=").append(Build.BOARD).append('\n');
|
||||
result.append("BRAND=").append(Build.BRAND).append('\n');
|
||||
result.append("CPU_ABI=").append(Build.CPU_ABI).append('\n');
|
||||
result.append("DEVICE=").append(Build.DEVICE).append('\n');
|
||||
result.append("DISPLAY=").append(Build.DISPLAY).append('\n');
|
||||
result.append("FINGERPRINT=").append(Build.FINGERPRINT).append('\n');
|
||||
result.append("HOST=").append(Build.HOST).append('\n');
|
||||
result.append("ID=").append(Build.ID).append('\n');
|
||||
result.append("MANUFACTURER=").append(Build.MANUFACTURER).append('\n');
|
||||
result.append("MODEL=").append(Build.MODEL).append('\n');
|
||||
result.append("PRODUCT=").append(Build.PRODUCT).append('\n');
|
||||
result.append("TAGS=").append(Build.TAGS).append('\n');
|
||||
result.append("TIME=").append(Build.TIME).append('\n');
|
||||
result.append("TYPE=").append(Build.TYPE).append('\n');
|
||||
result.append("USER=").append(Build.USER).append('\n');
|
||||
result.append("VERSION.CODENAME=").append(Build.VERSION.CODENAME).append('\n');
|
||||
result.append("VERSION.INCREMENTAL=").append(Build.VERSION.INCREMENTAL).append('\n');
|
||||
result.append("VERSION.RELEASE=").append(Build.VERSION.RELEASE).append('\n');
|
||||
result.append("VERSION.SDK_INT=").append(Build.VERSION.SDK_INT).append('\n');
|
||||
|
||||
if (flattenedParams != null) {
|
||||
String[] params = SEMICOLON.split(flattenedParams);
|
||||
Arrays.sort(params);
|
||||
for (String param : params) {
|
||||
result.append(param).append('\n');
|
||||
}
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>Über 1D-Barcodes (Strichcodes)</title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p>Die altbekannten Strichcodes, wie solche auf Produktverpackungen, werden auch eindimensionale Barcodes genannt. Es gibt einige verbreitete Arten, wie den UPC (Universal Product Code) und den EAN (European Article Number). Die meisten schauen so aus:</p>
|
||||
<p class="imgcenter"><img src="../images/big-1d.png"/></p>
|
||||
<p>Diese Strichcodes enthalten eine einmalige Nummer, welche ein Produkt, wie ein Buch oder eine CD, beschreiben. Man kann nach dieser Nummer im Internet suchen, um Preise oder Beurteilungen zu finden.</p>
|
||||
<p>Wenn man den Code eines Buches einscannt, kann man den Inhalt des Buches nach Wörtern oder Sätzen durchsuchen und alle Seiten finden, in denen dieses Wort vorkam:</p>
|
||||
<p class="imgcenter"><img src="../images/search-book-contents.jpg"/></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,28 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>Über 2D-Barcodes</title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p>Der <strong>Barcode Scanner</strong> kann auch zweidimensionale Barcodes, wie den QR-Code und den DataMatrix-Code einlesen. Die Barcodes in diesem Beispiel enthalten einen Hyperlink auf die Projekt-Homepage von ZXing:</p>
|
||||
<p class="imgcenter">
|
||||
<img src="../images/big-qr.png"/>
|
||||
<img src="../images/big-datamatrix.png"/>
|
||||
<img src="../images/big-pdf417.png"/>
|
||||
<img src="../images/big-aztec.png"/>
|
||||
</p>
|
||||
<p>Ein QR-Code kann auch eine Visitenkarte mit Kontaktinformationen wie Telefonnummern und E-Mail-Adressen enthalten. Wird ein solcher Code eingescannt, dann wird eine Auswahl an Aktionen angezeigt:</p>
|
||||
<p class="imgcenter"><img src="../images/contact-results-screen.jpg"/></p>
|
||||
<p>Neben URLs und Kontaktdaten können QR-Codes auch folgendes enthalten:</p>
|
||||
<ul>
|
||||
<li>Kalendereinträge, die man dem Kalender hinzufügen kann</li>
|
||||
<li>Telefonnummern, die man anrufen oder abspeichern kann</li>
|
||||
<li>SMS-Nachrichten, die man verschicken kann</li>
|
||||
<li>E-Mail-Adressen, denen man eine Nachricht schreiben kann</li>
|
||||
<li>Geographische Koordinaten, die zu der man die Karte öffnen kann</li>
|
||||
<li>Einfachen Text, den man lesen oder in die Zwischenablage kopieren kann</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,23 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>Barcode Scanner-Hilfe</title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p>Dies ist die offizielle Android App des Open-Source-Projekts ZXing:<br/>
|
||||
<a href="http://github.com/zxing/zxing">http://github.com/zxing/zxing</a></p>
|
||||
<p>Der <strong>Barcode Scanner</strong> verwendet die Kamera ihres Handys, um Barcodes zu lesen und Produktinformationen wie Preise und Bewertungen zu suchen.</p>
|
||||
<p class="imgcenter"><img src="../images/scan-example.png"/></p>
|
||||
<p>Er liest auch 2D-Barcodes wie den QR-Code und DataMatrix. Diese Barcodes können z.B. Links zu Webseiten enthalten oder Kontaktinformationen wie Telefonnummern und E-Mail-Adressen.</p>
|
||||
<ul class="touchable">
|
||||
<li><a href="whatsnew.html">Neues in dieser Version</a></li>
|
||||
<li><a href="scanning.html">Tipps fürs scannen</a></li>
|
||||
<li><a href="about1d.html">Mehr über 1D-Barcodes</a></li>
|
||||
<li><a href="about2d.html">Mehr über 2D-Barcodes</a></li>
|
||||
<li><a href="sharing.html">So erstellen Sie QR-Codes</a></li>
|
||||
<li><a href="license.html">Datenschutz-, Rechts- und Lizenzinformationen</a></li>
|
||||
</ul>
|
||||
<p>Übersetzt von Google Translate.</p></body>
|
||||
</html>
|
||||
@@ -1,30 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>Datenschutz-, Rechts- und Lizenzinformationen</title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h3>Datenschutz</h3>
|
||||
|
||||
<p><strong class="notranslate">Barcode Scanner</strong> sammelt, speichert oder übermittelt keine Informationen über seine Nutzer oder die Nutzung der Anwendung. Die Anwendung greift auf persönliche Daten wie Kontakte und Lesezeichen nur zu, um die Funktionalität der Anwendung zu implementieren, wie z.B. QR-Codes von Kontakten und Lesezeichen auf dem Bildschirm anzuzeigen.</p>
|
||||
|
||||
<p>Beachten Sie, dass diese Anwendung auf Dienste von Drittanbietern zugreift, dies sind Google Books, Google Produktsuche und Amazon. Dies geschieht, um weitere Informationen über ein Produkt nach einem Scan abzurufen und anzuzeigen. Diese Drittanbieter erhalten die eingescannten Daten und können diese auch loggen.
|
||||
Auch kann es notwendig sein, die Anfrage an einen Server zu schicken, der von dieser Anwendung betrieben wird, um die Anfrage für einen Drittanbieter passend zu machen, wie z.B. die Unterzeichnung der Anfrage. Neben dem Suchbegriff wird keine weitere Informationen zu den Anfragen hinzugefügt.</p>
|
||||
|
||||
<p>Beachten Sie auch, dass diese Anwendung auf Web-Sites und Anwendungen von Drittanbietern verlinkt, wie z.B. Google Produktsuche. Es werden keine anderen Informationen übertragen, als die eingescannten Daten. Diese Seiten und Anwendungen sind unabhängig und nicht mit dieser Anwendung verbunden, daher werden sie nicht von dieser Datenschutzerklärung abgedeckt.</p>
|
||||
|
||||
<h3>Warenzeichen</h3>
|
||||
|
||||
<p><span class="notranslate">Google, Google Books, Google Product Search,
|
||||
Barcode Scanner, ZXing, QR Code, Data Matrix, Aztec</span> sind Warenzeichen ihrer jeweiligen Eigentümer.</p>
|
||||
|
||||
<h3>Lizenz-und Urheberrecht</h3>
|
||||
|
||||
<p>Dieses Projekt basiert auf der <a class="notranslate" href="http://github.com/zxing/zxing">ZXing</a> Open-Source-Barcode-Scanning-Bibliothek und ist lizenziert unter den Bedingungen der <a class="notranslate" href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache License 2.0</a>:</p>
|
||||
|
||||
<p style="font-size:200%"><a class="notranslate" href="../html/apache-license.txt">Apache License 2.0</a></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,19 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>Tipps fürs scannen</title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p>Der Scanner durchsucht kontinuierlich den rechteckigen Bereich auf dem Bildschirm. Dabei muss der Barcode vollständig im rechteckigen Sucher erscheinen:</p>
|
||||
<p class="imgcenter"><img src="../images/demo-yes.png" style="padding:5px"/><img src="../images/demo-no.png" style="padding:5px"/></p>
|
||||
<p>Für 1D-Barcodes, auch Strichcodes genannt, welche sich auf allen Handelsprodukten befinden, benötigt man ein Handy mit Autofokus. Ohne diesen können nur QR-Codes und DataMatrix-Codes eingescannt werden.</p>
|
||||
<p>Wenn ein Barcode eingelesen wurde, piepst das Handy und es wird das Ergebnis des Scans angezeigt, sowie eine Beschreibung des Barcode-Inhalts, und verschiedene Möglichkeiten wie weiter verfahren werden soll.</p>
|
||||
<p>Falls das Einscannen nicht richtig funktioniert, versuchen Sie das Handy ruhiger zu halten. Wenn das Bild unscharf ist, vergrößern oder verkleinern Sie den Abstand zum Barcode.</p>
|
||||
<ul class="touchable">
|
||||
<li><a href="about1d.html"> Über 1D-Barcodes </a></li>
|
||||
<li><a href="about2d.html"> Über 2D-Barcodes </a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,14 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>So erstellen Sie einen QR-Code</title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p>Der <strong>Barcode Scanner</strong> kann nicht nur QR-Codes einlesen, sondern auch selbst erzeugen und auf dem Bildschirm anzeigen. Diesen QR-Code können Sie dann einem Freund zeigen, der den Code mit seinen Handy einscannen kann.</p>
|
||||
<p class="imgcenter"><img src="../images/scan-from-phone.png"/></p>
|
||||
<p>Um diese Funktion zu nutzen, einfach auf dem Hauptbildschirm auf die Menü-Taste drücken, und auf <em>Senden</em> tippen. Dann wählen, ob Sie einen Kontakt, ein Lesezeichen, eine Anwendung oder den Inhalt der Zwischenablage senden wollen und der QR-Code wird automatisch generiert. Wenn Sie fertig sind, drücken Sie die Zurücktaste.</p>
|
||||
<p>Um QR-Codes auf Ihrem Computer zu erzeugen, testen Sie den ZXing QR Code Generator, er basiert auf dem selben Quelltext wie dieses Programm: <a href="http://zxing.appspot.com/generator/">http://zxing.appspot.com/generator/</a></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,14 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>Neues in dieser Version von Barcode Scanner</title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<ul>
|
||||
<li> Die History-Funktion kann ausgeschaltet werden </li>
|
||||
<li> Bug-Fixes </li>
|
||||
</ul>
|
||||
<p>Übersetzt von Google Translate.</p></body>
|
||||
</html>
|
||||
@@ -1,15 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>About 1D barcodes</title>
|
||||
<link rel="stylesheet" href="../style.css" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p>Traditional barcodes, such as those printed on product packaging, are also known as one dimensional barcodes. There are several types commonly used, including UPC and EAN. Most look similar to this:</p>
|
||||
<p class="imgcenter"><img src="../images/big-1d.png"/></p>
|
||||
<p>These 1D barcodes contain a unique code which typically describes a product, like a CD or a book. You can look this code up on the internet to find prices, reviews, and more.</p>
|
||||
<p>If you scan a book, you can also search the contents of the book for a word or phrase, and find all the pages where it appears:</p>
|
||||
<p class="imgcenter"><img src="../images/search-book-contents.jpg"/></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,28 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>About 2D barcodes</title>
|
||||
<link rel="stylesheet" href="../style.css" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p><strong>Barcode Scanner</strong> also understands how to read two dimensional barcodes, like QR Codes and Data Matrix codes. For example, the codes below contain a hyperlink to the ZXing Project home page:</p>
|
||||
<p class="imgcenter">
|
||||
<img src="../images/big-qr.png"/>
|
||||
<img src="../images/big-datamatrix.png"/>
|
||||
<img src="../images/big-pdf417.png"/>
|
||||
<img src="../images/big-aztec.png"/>
|
||||
</p>
|
||||
<p>You can also represent contact information in a QR Code, and put it on a business card or web site. When you scan it, the results screen provides a choice of actions:</p>
|
||||
<p class="imgcenter"><img src="../images/contact-results-screen.jpg"/></p>
|
||||
<p>Besides URLs and contact info, QR Codes can also contain:</p>
|
||||
<ul>
|
||||
<li>Calendar events, which you can add to your Calendar</li>
|
||||
<li>Phone numbers, which you can dial</li>
|
||||
<li>SMS numbers, which you can text message</li>
|
||||
<li>Email addresses, which you can email</li>
|
||||
<li>Geographic coordinates, which you can open in Maps</li>
|
||||
<li>Plain text, which you can read, then share with a friend</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,23 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>Barcode Scanner Help</title>
|
||||
<link rel="stylesheet" href="../style.css" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p>The official Android app of the open source ZXing project:<br/>
|
||||
<a href="http://github.com/zxing/zxing">http://github.com/zxing/zxing</a></p>
|
||||
<p>Barcode Scanner uses the camera on your phone to read barcodes and look up product information such as prices and reviews.</p>
|
||||
<p class="imgcenter"><img src="../images/scan-example.png"/></p>
|
||||
<p>It also reads 2D barcodes such as QR Codes and Data Matrix. These can contain links to web sites, contact information such as phone numbers and email addresses, and more.</p>
|
||||
<ul class="touchable">
|
||||
<li><a href="whatsnew.html">What's new in this version</a></li>
|
||||
<li><a href="scanning.html">How to scan</a></li>
|
||||
<li><a href="about1d.html">About 1D barcodes</a></li>
|
||||
<li><a href="about2d.html">About 2D barcodes</a></li>
|
||||
<li><a href="sharing.html">How to create QR Codes</a></li>
|
||||
<li><a href="license.html">Privacy Policy, Legal and License Information</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,42 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>Privacy Policy, Legal and License Information</title>
|
||||
<link rel="stylesheet" href="../style.css" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h3>Privacy Policy</h3>
|
||||
|
||||
<p><strong class="notranslate">Barcode Scanner</strong> does not collect, store or transmit information about its
|
||||
users, nor usage of the application. The application accesses personal information such as contacts
|
||||
and bookmarks only in order to implement application functionality, such as sharing contacts and bookmarks
|
||||
by QR Codes on screen.</p>
|
||||
|
||||
<p>Note that this application accesses third-party services, including Google Books, Google Product Search and Amazon,
|
||||
in order to retrieve additional information following a scan. These third parties receive and may log these requests.
|
||||
Also, it may be necessary to send the request to a server operated by this application, in order to transform the
|
||||
request for use with the third-party service, such as signing the request.
|
||||
No additional information is added to the requests besides the query terms.</p>
|
||||
|
||||
<p>Also note that this application links to third-party web sites and applications. Again,
|
||||
no information other than query terms are passed on as part of these links. These sites and applications are
|
||||
separate from and not affiliated with this application, and are not covered by this Privacy Policy.</p>
|
||||
|
||||
<h3>Trademarks</h3>
|
||||
|
||||
<p><span class="notranslate">Google, Google Books, Google Product Search,
|
||||
Barcode Scanner, ZXing, QR Code, Data Matrix, Aztec</span>
|
||||
are all trademarks of their respective owners.</p>
|
||||
|
||||
<h3>License and Copyright</h3>
|
||||
|
||||
<p>This project is based on the <a href="http://github.com/zxing/zxing" class="notranslate">ZXing</a> open source barcode
|
||||
scanning library, and is licensed to you under the terms of the
|
||||
<a href="http://www.apache.org/licenses/LICENSE-2.0.html" class="notranslate">Apache License 2.0</a>:</p>
|
||||
|
||||
<p style="font-size:200%"><a href="../html/apache-license.txt" class="notranslate">Apache License 2.0</a></p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,19 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>How to scan</title>
|
||||
<link rel="stylesheet" href="../style.css" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p>Barcode Scanner continuously scans a square region shown on your screen -- just line up the phone so the barcode is completely inside the viewfinder rectangle:</p>
|
||||
<p class="imgcenter"><img src="../images/demo-yes.png" style="padding:5px"/><img src="../images/demo-no.png" style="padding:5px"/></p>
|
||||
<p>1D barcodes like those found on products require a phone with autofocus. Without it, only 2D formats like QR Codes and Data Matrix codes will be scannable.</p>
|
||||
<p>When a barcode is read, a beep sound will play and you'll see the results of the scan, a description of what the barcode contains, and options to take action on the contents.</p>
|
||||
<p>If you're having trouble scanning, make sure to hold the phone steady. If the camera is unable to focus, try moving the phone further or closer from the barcode.</p>
|
||||
<ul class="touchable">
|
||||
<li><a href="about1d.html">About 1D barcodes</a></li>
|
||||
<li><a href="about2d.html">About 2D barcodes</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,14 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>How to create QR Codes</title>
|
||||
<link rel="stylesheet" href="../style.css" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p>In addition to scanning 2D barcodes, Barcode Scanner can also generate a QR Code and display it on your screen. Then you can show it to a friend, and let them scan the barcode with their phone:</p>
|
||||
<p class="imgcenter"><img src="../images/scan-from-phone.png"/></p>
|
||||
<p>To use this feature, press the Menu button from the main scanning screen, and tap Share. Then choose whether you want to share a contact, a bookmark, an application, or the contents of the clipboard. A QR Code will be generated automatically. When you're done, press Back or Home.</p>
|
||||
<p>To generate QR Codes from your computer, try the ZXing QR Code Generator: <a href="http://zxing.appspot.com/generator/">http://zxing.appspot.com/generator/</a></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,14 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>What's new in Barcode Scanner</title>
|
||||
<link rel="stylesheet" href="../style.css" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<ul>
|
||||
<li>The History feature can be turned off</li>
|
||||
<li>Bug fixes</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,18 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title> Acerca de los códigos de barras 1D </title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p> Códigos de barras tradicionales, tales como las impresas en el embalaje del producto,
|
||||
se conocen también como uno códigos de barras bidimensionales. Existen varios tipos de uso común,
|
||||
incluyendo UPC y EAN. La mayoría de aspecto similar a este: </p>
|
||||
<p class="imgcenter"><img src="../images/big-1d.png"/></p>
|
||||
<p> Estos códigos de barras 1D contiene un código único que generalmente describe un producto, como un CD o un libro.
|
||||
Usted puede ver este código en el Internet para encontrar precios, comentarios y más. </p>
|
||||
<p> Si digitaliza un libro, también puede buscar en el contenido del libro para una palabra o frase, y encontrar todas
|
||||
las páginas en las que aparece: </p>
|
||||
<p class="imgcenter"><img src="../images/search-book-contents.jpg"/></p>
|
||||
</html>
|
||||
@@ -1,30 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title> Acerca de los códigos de barras 2D </title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p><strong> Barcode Scanner </strong> También entiende cómo leer dos códigos de barras bidimensionales,
|
||||
como los códigos QR y códigos Data Matrix. Por ejemplo, los códigos que siguen contienen un hipervínculo a la
|
||||
página principal de Project ZXing: </p>
|
||||
<p class="imgcenter">
|
||||
<img src="../images/big-qr.png"/>
|
||||
<img src="../images/big-datamatrix.png"/>
|
||||
<img src="../images/big-pdf417.png"/>
|
||||
<img src="../images/big-aztec.png"/>
|
||||
</p>
|
||||
<p> También puede representar la información de contacto en un código QR, y usarlo en una tarjeta
|
||||
de visita o en un sitio web. Cuando se escanea, la pantalla de resultados se ofrecen una serie de acciones: </p>
|
||||
<p class="imgcenter"><img src="../images/contact-results-screen.jpg"/></p>
|
||||
<p> Además de las direcciones URL y la información de contacto, los códigos QR también puede contener: </p>
|
||||
<ul>
|
||||
<li> Los eventos del calendario, que se pueden añadir a su calendario </li>
|
||||
<li> Los números de teléfono, que puede marcar </li>
|
||||
<li> SMS números, a los que puede enviar mensaje de texto </li>
|
||||
<li> Direcciones de correo electrónico, a los que se puede enviar por correo electrónico </li>
|
||||
<li> Coordenadas Geográficas, que se puede abrir en Mapas </li>
|
||||
<li> Texto sin formato, que se puede leer, compartir con un amigo </li>
|
||||
</ul>
|
||||
</html>
|
||||
@@ -1,24 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title> Ayuda de Barcode Scanner</title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p> La aplicación oficial de Android del proyecto de código abierto ZXing:<br/>
|
||||
<a href="http://github.com/zxing/zxing"> http://github.com/zxing/zxing </a></p>
|
||||
<p> Barcode Scanner utiliza la cámara de su móvil para leer códigos de barras y buscar información sobre
|
||||
los productos como los precios y las revisiones. </p>
|
||||
<p class="imgcenter"><img src="../images/scan-example.png"/></p>
|
||||
<p> También lee los códigos de barras 2D, como los Códigos QR y Data Matrix. Estos pueden contener enlaces
|
||||
a otros sitios web, información de contacto, como números de teléfono y direcciones de correo electrónico y mucho más. </p>
|
||||
<ul class="touchable">
|
||||
<li><a href="whatsnew.html"> ¿Qué hay de nuevo en esta versión? </a></li>
|
||||
<li><a href="scanning.html"> Cómo escanear </a></li>
|
||||
<li><a href="about1d.html"> Acerca de los códigos de barras 1D </a></li>
|
||||
<li><a href="about2d.html"> Acerca de los códigos de barras 2D </a></li>
|
||||
<li><a href="sharing.html"> Cómo crear códigos QR </a></li>
|
||||
<li><a href="license.html"> Política de Privacidad Información Legal y Licencia </a></li>
|
||||
</ul>
|
||||
</html>
|
||||
@@ -1,39 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title> Política de Privacidad Información Legal y Licencia </title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h3> Política de privacidad </h3>
|
||||
|
||||
<p><strong class="notranslate">Barcode Scanner</strong> no recogerá, almacenará ni transmitirá información sobre sus usuarios,
|
||||
ni de uso de la aplicación. La aplicación tiene acceso a información personal, como contactos y favoritos solo con el fin
|
||||
de implementar la funcionalidad de la aplicación, tales como el intercambio de contactos y favoritos de los códigos QR en
|
||||
la pantalla. </p>
|
||||
|
||||
<p> Tenga en cuenta que esta aplicación tiene acceso a servicios de terceros, como Google Books, Google Product Search
|
||||
y Amazon, con el fin de obtener información adicional después de una exploración. Estos terceros pueden recibir y
|
||||
registrar estas solicitudes. Además, puede ser necesario el envío de la solicitud a un servidor operado por esta
|
||||
aplicación, con el fin de transformar la solicitud para su uso con el servicio de terceros, tales como la firma de
|
||||
la solicitud. No hay información adicional añadida a las peticiones, además de los términos de la consulta. </p>
|
||||
|
||||
<p> También tenga en cuenta que los enlaces de esta solicitud a sitios web de terceros y aplicaciones. Una vez más,
|
||||
hay más información que los términos de consulta se transmiten como parte de estos enlaces. Estos sitios y aplicaciones
|
||||
son independientes y no afiliados a esta solicitud, y no están cubiertos por esta Política de Privacidad. </p>
|
||||
|
||||
<h3> Marcas comerciales </h3>
|
||||
|
||||
<p><span class="notranslate">Google, Google Books, Google Product Search,
|
||||
Barcode Scanner, ZXing, QR Code, Data Matrix, Aztec</span> son marcas comerciales de sus respectivos propietarios. </p>
|
||||
|
||||
<h3> Licencia y Derechos de Autor </h3>
|
||||
|
||||
<p> Este proyecto se basa en la <a class="notranslate" href="http://github.com/zxing/zxing">ZXing</a> código de barras
|
||||
de código abierto biblioteca de exploración, y está disponible para usted bajo los términos de la
|
||||
<a class="notranslate" href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache License 2.0</a> : </p>
|
||||
|
||||
<p style="font-size:200%"><a class="notranslate" href="../html/apache-license.txt">Apache License 2.0</a></p>
|
||||
</html>
|
||||
@@ -1,18 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title> Cómo escanear </title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p> Barcode Scanner escanea continuamente una región cuadrada que aparece en su pantalla - Sólo basta introducir el código de barras es completamente dentro del rectángulo del visor: </p>
|
||||
<p class="imgcenter"><img src="../images/demo-yes.png" style="padding:5px"/><img src="../images/demo-no.png" style="padding:5px"/></p>
|
||||
<p> Códigos de barras 1D, como las que se encuentran en los productos requieren un teléfono con enfoque automático. Sin él, sólo los códigos QR y códigos Data Matrix serán susceptibles de ser analizados. </p>
|
||||
<p> Cuando un código de barras es leído, un sonido será reproducido y podrás ver los resultados del análisis, una descripción de lo que contiene el código de barras, y las distintas opciones ejecutar acciones. </p>
|
||||
<p> Si usted está teniendo problemas de escaneo, asegúrese de sujetar el teléfono estable. Si la cámara no puede enfocar, mueva el teléfono más lejos o más cerca del código de barras. </p>
|
||||
<ul class="touchable">
|
||||
<li><a href="about1d.html"> Acerca de los códigos de barras 1D </a></li>
|
||||
<li><a href="about2d.html"> Acerca de los códigos de barras 2D </a></li>
|
||||
</ul>
|
||||
</html>
|
||||
@@ -1,13 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title> Cómo crear códigos QR </title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p> Además de escanear códigos de barras 2D, Barcode Scanner también puede generar un código QR y lo mostrará en la pantalla. A continuación, lo puede mostrar a un amigo, y dejar que escanear el código de barras con su teléfono: </p>
|
||||
<p class="imgcenter"><img src="../images/scan-from-phone.png"/></p>
|
||||
<p> Para utilizar esta función, presione el botón Menú en la pantalla de exploración principal y presione Compartir. A continuación, seleccione si desea compartir un contacto, un marcador, una aplicación o el contenido del portapapeles. Un código QR se generará automáticamente. Cuando haya terminado, pulse Atrás o Inicio. </p>
|
||||
<p> Para generar códigos QR desde su computadora, pruebe el generador ZXing Código QR: <a href="http://zxing.appspot.com/generator/"> http://zxing.appspot.com/generator/ </a></p>
|
||||
</html>
|
||||
@@ -1,14 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title> ¿Qué hay de nuevo en Barcode Scanner? </title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<ul>
|
||||
<li> La función de Historia se puede apagar </li>
|
||||
<li> Corrección de errores </li>
|
||||
</ul>
|
||||
<p>Traducido por Google Translate.</p></body>
|
||||
</html>
|
||||
@@ -1,15 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title> À propos des codes barres 1D </title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p> Les codes barres traditionnels, tels que ceux imprimés sur l'emballage des produits commerciaux, sont appelés codes barres 1D. Il existe plusieurs types couramment utilisés, par exemple UPC et EAN. La plupart ressemblent à ceci : </p>
|
||||
<p class="imgcenter"><img src="../images/big-1d.png"/></p>
|
||||
<p> Ces codes barres 1D contiennent un code unique qui décrit typiquement un produit, comme un CD ou un livre. Vous pouvez chercher ce code sur Internet pour trouver les prix ou les critiques d'un article. </p>
|
||||
<p> Si vous scannez un livre, vous pouvez également chercher un mot ou une phrase dans le contenu du livre, et trouver toutes les pages où ils apparaissent : </p>
|
||||
<p class="imgcenter"><img src="../images/search-book-contents.jpg"/></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,26 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title> À propos des codes barres 2D </title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p><strong> Barcode Scanner </strong> permet aussi de lire les codes barres à deux dimensions, comme les codes QR et les codes Data Matrix. Par exemple, les codes ci-dessous contiennent un lien hypertexte vers la page d'accueil du projet ZXing : </p>
|
||||
<p class="imgcenter">
|
||||
<img src="../images/big-qr.png"/>
|
||||
<img src="../images/big-datamatrix.png"/>
|
||||
<img src="../images/big-pdf417.png"/>
|
||||
<img src="../images/big-aztec.png"/></p>
|
||||
<p> Il est également possible de fournir des informations de contact dans un code QR, et le mettre sur une carte de visite ou un site Web. Lorsque vous scannez, l'écran de résultat fournit un choix d'actions : </p>
|
||||
<p class="imgcenter"><img src="../images/contact-results-screen.jpg"/></p>
|
||||
<p> En plus d'une URL ou d'informations de contact, les codes QR peuvent aussi contenir : </p>
|
||||
<ul>
|
||||
<li> Des événements/invitations, que vous pouvez ajouter à votre agenda </li>
|
||||
<li> Des numéros de téléphone que vous pouvez appeler, ou à qui vous pouvez envoyer un SMS </li>
|
||||
<li> Des adresses e-mail, à qui vous pouvez écrire </li>
|
||||
<li> Des coordonnées géographiques, que vous pouvez ouvrir dans Maps </li>
|
||||
<li> Du texte, que vous pouvez lire, puis partager avec un ami </li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,23 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title> Aide Barcode Scanner </title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p> L'application officielle Android du projet open-source ZXing :<br/>
|
||||
<a href="http://github.com/zxing/zxing"> http://github.com/zxing/zxing </a></p>
|
||||
<p> Barcode Scanner utilise la caméra de votre téléphone pour lire des codes barres, et rechercher des informations produit, telles que les prix et les critiques. </p>
|
||||
<p class="imgcenter"><img src="../images/scan-example.png"/></p>
|
||||
<p> Il lit également les codes barres 2D tels que les codes QR et Data Matrix. Ceux-ci peuvent contenir des liens vers des sites Web, des informations de contact comme des numéros de téléphone et des adresses e-mail, et plus encore. </p>
|
||||
<ul class="touchable">
|
||||
<li><a href="whatsnew.html"> Quoi de neuf dans cette version </a></li>
|
||||
<li><a href="scanning.html"> Comment numériser </a></li>
|
||||
<li><a href="about1d.html"> À propos de codes à barres 1D </a></li>
|
||||
<li><a href="about2d.html"> À propos de codes-barres 2D </a></li>
|
||||
<li><a href="sharing.html"> Comment créer des codes QR </a></li>
|
||||
<li><a href="license.html"> Politique de confidentialité, Informations légales et licence </a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,30 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title> Politique de confidentialité, Informations légales et licence </title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h3> Politique de confidentialité </h3>
|
||||
|
||||
<p><strong class="notranslate">Barcode Scanner</strong> ne collecte pas, stocke pas ni ne transmet des informations sur ses utilisateurs, ni l'utilisation de l'application. L'application accède à des informations personnelles telles que les contacts et les signets seulement dans le but de mettre en œuvre des fonctionnalités de l'application, tels que le partage des contacts et des signets par les codes QR sur l'écran. </p>
|
||||
|
||||
<p> Notez que cette application accède à des services tiers, y compris Google Books, Google Recherche d'un produit et Amazon, afin de récupérer des informations supplémentaires à la suite d'une analyse. Ces tierces parties reçoivent ces demandes, et peuvent éventuellement les stocker. En outre, il peut être nécessaire d'envoyer la requête à un serveur exploité par cette application, afin de transformer la demande pour une utilisation avec le service tiers, tels que la signature de la demande. Aucune information supplémentaire n'est ajoutée aux demandes en dehors des termes de la requête. </p>
|
||||
|
||||
<p> A noter également que cette application fournit des liens vers des sites et des applications Web de tiers. Encore une fois, aucune information autre que les termes de requête ne sont transmis dans le cadre de ces liens. Ces sites et applications sont séparés et ne sont pas affiliés à cette application, et ne sont pas couverts par la présente Politique de confidentialité. </p>
|
||||
|
||||
<h3> Marques </h3>
|
||||
|
||||
<p><span class="notranslate">Google, Google Books, Google Product Search,
|
||||
Barcode Scanner, ZXing, QR Code, Data Matrix, Aztec</span> sont tous des marques de commerce de leurs propriétaires respectifs. </p>
|
||||
|
||||
<h3> Licence et droits d'auteur </h3>
|
||||
|
||||
<p> Ce projet est basé sur la bibliothèque open source de scanning de codes barres <a class="notranslate" href="http://github.com/zxing/zxing">ZXing</a>, et est publié sous <a class="notranslate" href="http://www.apache.org/licenses/LICENSE-2.0.html">Licence Apache 2.0</a> : </p>
|
||||
|
||||
<p style="font-size:200%"><a class="notranslate" href="../html/apache-license.txt">Licence Apache 2.0</a></p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,19 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title> Comment numériser </title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p> Barcode Scanner scanne en permanence une zone carrée affichée sur votre écran -- tenez le téléphone droit, de sorte que le code barres soit droit et complètement à l'intérieur du rectangle du viseur : </p>
|
||||
<p class="imgcenter"><img src="../images/demo-yes.png" style="padding:5px"/><img src="../images/demo-no.png" style="padding:5px"/></p>
|
||||
<p> Les code barres 1D comme ceux qu'on trouve sur les produits nécessitent un téléphone avec autofocus. Sans autofocus, seuls les codes QR et les codes Data Matrix seront scannables. </p>
|
||||
<p> Quand un code barres est lu, un bip sonore est émis, et le résultat de l'analyse s'affiche : une description de ce que le code barres contient, et ce que vous pouvez faire à partir de ces données. </p>
|
||||
<p> Si vous rencontrez des problèmes pour scanner un code barres, assurez-vous de tenir le téléphone sans trop bouger. Si l'appareil photo n'arrive pas à fournir une image nette, essayez de déplacer le téléphone plus loin ou plus près du code barres. </p>
|
||||
<ul class="touchable">
|
||||
<li><a href="about1d.html"> À propos des codes barres 1D </a></li>
|
||||
<li><a href="about2d.html"> À propos des codes barres 2D </a></li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,14 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title> Comment créer des codes QR </title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p> En plus de scanner des codes barres, Barcode Scanner peut aussi créér un code QR et l'afficher sur votre écran. Ensuite, vous pouvez le montrer à un ami, pour qu'il le scanne avec son téléphone : </p>
|
||||
<p class="imgcenter"><img src="../images/scan-from-phone.png"/></p>
|
||||
<p> Pour utiliser cette fonction, appuyez sur la touche Menu depuis l'écran principal, puis appuyez sur Partager. Ensuite, choisissez si vous voulez partager un contact, un signet, une application ou le contenu du presse-papiers. Un code QR est généré automatiquement. Lorsque vous avez terminé, appuyez sur Retour. </p>
|
||||
<p> Pour générer les codes QR à partir de votre ordinateur, essayez le générateur de code QR ZXing: <a href="http://zxing.appspot.com/generator/"> http://zxing.appspot.com/generator/ </a></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,14 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title> Quoi de neuf dans Barcode Scanner </title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<ul>
|
||||
<li> La fonction Historique peut être désactivée </li>
|
||||
<li> Corrections de bugs </li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,15 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title> A proposito di codici a barre 1D </title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p> Codici a barre tradizionali, come quelle stampate sulla confezione del prodotto, sono noti anche come uno codici a barre bidimensionali. Ci sono diversi tipi di uso comune, tra cui UPC ed EAN. La maggior parte simile al seguente: </p>
|
||||
<p class="imgcenter"><img src="../images/big-1d.png"/></p>
|
||||
<p> Queste barre 1D contengono un codice unico che descrive tipicamente un prodotto, come un CD o un libro. È possibile cercare questo codice su internet per trovare i prezzi, recensioni e altro. </p>
|
||||
<p> Se si esegue la scansione di un libro, è anche possibile cercare i contenuti del libro per una parola o una frase, e trovare tutte le pagine in cui appare: </p>
|
||||
<p class="imgcenter"><img src="../images/search-book-contents.jpg"/></p>
|
||||
<p>Tradotto da Google Translate.</p></body>
|
||||
</html>
|
||||
@@ -1,28 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title> A proposito di codici a barre 2D </title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p><strong> Barcode Scanner </strong> comprende anche come leggere due codici a barre bidimensionali, come i codici QR e codici Data Matrix. Per esempio, i seguenti codici contengono un collegamento ipertestuale alla pagina ZXing principale del progetto: </p>
|
||||
<p class="imgcenter">
|
||||
<img src="../images/big-qr.png"/>
|
||||
<img src="../images/big-datamatrix.png"/>
|
||||
<img src="../images/big-pdf417.png"/>
|
||||
<img src="../images/big-aztec.png"/>
|
||||
</p>
|
||||
<p> È anche possibile rappresentare le informazioni di contatto in un QR Code, e metterlo su un biglietto da visita o un sito web. Quando si esegue la scansione, la schermata dei risultati fornisce una serie di azioni: </p>
|
||||
<p class="imgcenter"><img src="../images/contact-results-screen.jpg"/></p>
|
||||
<p> Oltre URL e informazioni di contatto, i codici QR possono contenere anche: </p>
|
||||
<ul>
|
||||
<li> Eventi del Calendario, che è possibile aggiungere al vostro calendario </li>
|
||||
<li> I numeri di telefono, che possono essere digitati </li>
|
||||
<li> Numeri di SMS, che è possibile il testo del messaggio </li>
|
||||
<li> Indirizzi e-mail, che possono essere inviati per email </li>
|
||||
<li> Coordinate geografiche, che è possibile aprire in Mappe </li>
|
||||
<li> Testo semplice, che si può leggere, quindi condividere con un amico </li>
|
||||
</ul>
|
||||
<p>Tradotto da Google Translate.</p></body>
|
||||
</html>
|
||||
@@ -1,23 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title> Barcode Scanner Aiuto </title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p> L'applicazione ufficiale di Android del progetto aperto ZXing fonte:<br/>
|
||||
<a href="http://github.com/zxing/zxing"> http://github.com/zxing/zxing </a></p>
|
||||
<p> Scanner di codici a barre utilizza la fotocamera del telefono per leggere codici a barre e ricercare informazioni sui prodotti, i prezzi e le recensioni. </p>
|
||||
<p class="imgcenter"><img src="../images/scan-example.png"/></p>
|
||||
<p> Legge anche codici a barre 2D, come i codici QR e Data Matrix. Questi possono contenere link a siti web, informazioni di contatto, quali numeri di telefono e indirizzi e-mail e altro ancora. </p>
|
||||
<ul class="touchable">
|
||||
<li><a href="whatsnew.html"> Cosa c'è di nuovo in questa versione </a></li>
|
||||
<li><a href="scanning.html"> Come eseguire la scansione </a></li>
|
||||
<li><a href="about1d.html"> A proposito di codici a barre 1D </a></li>
|
||||
<li><a href="about2d.html"> A proposito di codici a barre 2D </a></li>
|
||||
<li><a href="sharing.html"> Come creare codici QR </a></li>
|
||||
<li><a href="license.html"> Informazioni legali e di licenza </a></li>
|
||||
</ul>
|
||||
<p>Tradotto da Google Translate.</p></body>
|
||||
</html>
|
||||
@@ -1,30 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title> Privacy, Informazioni legali e di licenza </title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h3> Politica sulla privacy </h3>
|
||||
|
||||
<p><strong class="notranslate">Barcode Scanner</strong> non raccogliere, memorizzare o trasmettere le informazioni sui suoi utenti, né utilizzo dell'applicazione. L'applicazione accede a informazioni personali come contatti e segnalibri solo al fine di implementare la funzionalità dell'applicazione, come la condivisione di contatti e segnalibri da codici QR sullo schermo. </p>
|
||||
|
||||
<p> Si noti che questa applicazione accede a servizi di terze parti, tra cui Google Libri, Google Product Search e Amazon, al fine di recuperare le informazioni aggiuntive a seguito di una scansione. Queste terze parti ricevono e possono registrare queste richieste. Inoltre, può essere necessario inviare la richiesta a un server gestito da questa applicazione, per trasformare la richiesta per l'utilizzo con il servizio di terze parti, come la firma della richiesta. Nessuna informazione aggiuntiva si aggiunge alle richieste oltre i termini di query. </p>
|
||||
|
||||
<p> Si noti inoltre che i collegamenti questa applicazione per i siti Web di terze parti e le applicazioni. Anche in questo caso, nessuna informazione diversa termini di query vengono passati come parte di questi link. Questi siti e le applicazioni sono distinte e non è affiliato con questa applicazione, e non sono coperti da questa Informativa sulla privacy. </p>
|
||||
|
||||
<h3> Marchi di fabbrica </h3>
|
||||
|
||||
<p><span class="notranslate">Google, Google Books, Google Product Search,
|
||||
Barcode Scanner, ZXing, QR Code, Data Matrix, Aztec</span> sono tutti marchi di fabbrica dei rispettivi proprietari. </p>
|
||||
|
||||
<h3> Licenza e Copyright </h3>
|
||||
|
||||
<p> Questo progetto si basa sulla <a class="notranslate" href="http://github.com/zxing/zxing">ZXing</a> barcode open source scansione biblioteca, e viene concesso in licenza sotto i termini della <a class="notranslate" href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache License 2.0</a> : </p>
|
||||
|
||||
<p style="font-size:200%"><a class="notranslate" href="../html/apache-license.txt">Apache License 2.0</a></p>
|
||||
|
||||
<p>Tradotto da Google Translate.</p></body>
|
||||
</html>
|
||||
@@ -1,19 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title> Come eseguire la scansione </title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p> Barcode Scanner analizza continuamente una regione quadrata mostrata sullo schermo - solo linea il telefono in modo che il codice a barre è completamente all'interno del rettangolo del mirino: </p>
|
||||
<p class="imgcenter"><img src="../images/demo-yes.png" style="padding:5px"/><img src="../images/demo-no.png" style="padding:5px"/></p>
|
||||
<p> Codici a barre 1D, come quelle che si trovano sui prodotti richiede un telefono con autofocus. Senza di essa, solo i codici QR e codici Data Matrix sarà leggibile. </p>
|
||||
<p> Quando un codice a barre viene letto, un bip si giocare e vedrete i risultati della scansione, una descrizione di ciò che il codice a barre contiene, e le opzioni per intervenire sui contenuti. </p>
|
||||
<p> Se hai dei problemi di scansione, assicurarsi di tenere il telefono fermo. Se la fotocamera non riesce a mettere a fuoco, provare a spostare il telefono lontano o più vicino dal codice a barre. </p>
|
||||
<ul class="touchable">
|
||||
<li><a href="about1d.html"> A proposito di codici a barre 1D </a></li>
|
||||
<li><a href="about2d.html"> A proposito di codici a barre 2D </a></li>
|
||||
</ul>
|
||||
<p>Tradotto da Google Translate.</p></body>
|
||||
</html>
|
||||
@@ -1,14 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title> Come creare codici QR </title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p> Oltre alla scansione di codici a barre 2D, Barcode Scanner può anche generare un codice QR e visualizzarla sullo schermo. Poi si può mostrare ad un amico, e far loro eseguire la scansione del codice a barre con il proprio telefono: </p>
|
||||
<p class="imgcenter"><img src="../images/scan-from-phone.png"/></p>
|
||||
<p> Per utilizzare questa funzione, premere il tasto Menu dalla schermata di scansione principale, e toccare Condividi. Quindi scegliere se si desidera condividere un contatto, un segnalibro, un'applicazione, o il contenuto degli appunti. Un codice a barre verrà generato automaticamente. Al termine, premere Indietro o Home. </p>
|
||||
<p> Per generare i codici QR dal tuo computer, provare il generatore di ZXing QR Code: <a href="http://zxing.appspot.com/generator/"> http://zxing.appspot.com/generator/ </a></p>
|
||||
<p>Tradotto da Google Translate.</p></body>
|
||||
</html>
|
||||
@@ -1,14 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title> Cosa c'è di nuovo nella Barcode Scanner </title>
|
||||
<link href="../style.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<ul>
|
||||
<li> La funzione Cronologia può essere disattivata </li>
|
||||
<li> Correzioni di bug </li>
|
||||
</ul>
|
||||
<p>Tradotto da Google Translate.</p></body>
|
||||
</html>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user