diff options
| author | Andre Ippisch <andre.ippisch@uni-duesseldorf.de> | 2019-10-17 15:21:23 +0300 |
|---|---|---|
| committer | Ralf Kistner <ralf@journeyapps.com> | 2019-10-17 15:21:23 +0300 |
| commit | aa4fca5dae65d8d7789f7519d3ff1287f355d0b6 (patch) | |
| tree | 3caba62bb4dc8f64aa66c95ce1ae78179fd4fcfc /sample/src | |
| parent | d22b581cd303a6e785c4a40263803e867b7f54db (diff) | |
| download | zxing-android-embedded-aa4fca5dae65d8d7789f7519d3ff1287f355d0b6.tar.xz | |
Let visibility of "laser scanner" be set (#503)
* Add laser visibility attribute
* Add laser visibility attribute usage to sample project
- set to true to stick with the current behavior
- included for didactic reasons
* Add laser visibility attribute to ViewfinderView and set it accordingly
* Draw "laser scanner" only if wanted
* Let laser visibility be changed programmatically
* Add sample code to show how laser visibility can be changed programmatically
Diffstat (limited to 'sample/src')
| -rw-r--r-- | sample/src/main/java/example/zxing/CustomScannerActivity.java | 5 | ||||
| -rw-r--r-- | sample/src/main/res/layout/custom_barcode_scanner.xml | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/sample/src/main/java/example/zxing/CustomScannerActivity.java b/sample/src/main/java/example/zxing/CustomScannerActivity.java index 2292e59f..12840733 100644 --- a/sample/src/main/java/example/zxing/CustomScannerActivity.java +++ b/sample/src/main/java/example/zxing/CustomScannerActivity.java @@ -48,6 +48,7 @@ public class CustomScannerActivity extends Activity implements capture.decode(); changeMaskColor(null); + changeLaserVisibility(true); } @Override @@ -102,6 +103,10 @@ public class CustomScannerActivity extends Activity implements viewfinderView.setMaskColor(color); } + public void changeLaserVisibility(boolean visible) { + viewfinderView.setLaserVisibility(visible); + } + @Override public void onTorchOn() { switchFlashlightButton.setText(R.string.turn_off_flashlight); diff --git a/sample/src/main/res/layout/custom_barcode_scanner.xml b/sample/src/main/res/layout/custom_barcode_scanner.xml index 9460630e..8607280f 100644 --- a/sample/src/main/res/layout/custom_barcode_scanner.xml +++ b/sample/src/main/res/layout/custom_barcode_scanner.xml @@ -17,6 +17,7 @@ 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 |
