From 30e0238a1505de61c9be8f5017db7cbfe689a6e1 Mon Sep 17 00:00:00 2001 From: Artem Kubiria Date: Tue, 11 Jun 2024 16:27:00 +0200 Subject: [PATCH] Updated doc snippets --- .../doc_code_snippet/barcode/FindAndPickUseCaseSnippet.kt | 5 +++-- .../doc_code_snippet/barcode/ItemMapperConfigSnippet.kt | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ready-to-use-ui-demo/rtu_ui_components/src/main/java/io/scanbot/example/doc_code_snippet/barcode/FindAndPickUseCaseSnippet.kt b/ready-to-use-ui-demo/rtu_ui_components/src/main/java/io/scanbot/example/doc_code_snippet/barcode/FindAndPickUseCaseSnippet.kt index f4cb4a3c..3fca132e 100644 --- a/ready-to-use-ui-demo/rtu_ui_components/src/main/java/io/scanbot/example/doc_code_snippet/barcode/FindAndPickUseCaseSnippet.kt +++ b/ready-to-use-ui-demo/rtu_ui_components/src/main/java/io/scanbot/example/doc_code_snippet/barcode/FindAndPickUseCaseSnippet.kt @@ -52,17 +52,18 @@ fun findAndPickModeUseCaseSnippet() { // Configure other parameters, pertaining to findAndPick-scanning mode as needed. // Set the expected barcodes. + // Don't forget to add Internet permission to your AndroidManifest.xml to load images from the web. expectedBarcodes = listOf( ExpectedBarcode( barcodeValue = "123456", title = " numeric barcode", - image = "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png", + image = "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png", // or [BarcodeMappedDataExtension.barcodeFormatKey] to display barcode image count = 4 ), ExpectedBarcode( barcodeValue = "SCANBOT", title = "value barcode", - image = "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png", + image = "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png", // or [BarcodeMappedDataExtension.barcodeFormatKey] to display barcode image count = 3 ) ) diff --git a/ready-to-use-ui-demo/rtu_ui_components/src/main/java/io/scanbot/example/doc_code_snippet/barcode/ItemMapperConfigSnippet.kt b/ready-to-use-ui-demo/rtu_ui_components/src/main/java/io/scanbot/example/doc_code_snippet/barcode/ItemMapperConfigSnippet.kt index a566da6c..81e5d5d3 100644 --- a/ready-to-use-ui-demo/rtu_ui_components/src/main/java/io/scanbot/example/doc_code_snippet/barcode/ItemMapperConfigSnippet.kt +++ b/ready-to-use-ui-demo/rtu_ui_components/src/main/java/io/scanbot/example/doc_code_snippet/barcode/ItemMapperConfigSnippet.kt @@ -24,6 +24,7 @@ fun itemMappingConfigSnippet() { val config = BarcodeScannerConfiguration().apply { // Configure parameters (use explicit `this.` receiver for better code completion): this.useCase = BarcodeUseCase.singleScanningMode().apply { + this.confirmationSheetEnabled = true class CustomMapper() : BarcodeItemMapper { override fun mapBarcodeItem( @@ -36,9 +37,14 @@ fun itemMappingConfigSnippet() { */ val title = "Some product ${barcodeItem.textWithExtension}" val subtitle = barcodeItem.type?.getName() ?: "Unknown" + + // Don't forget to add Internet permission to your AndroidManifest.xml to load images from the web. val image = "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png" + // or display barcode image: + // val image = BarcodeMappedDataExtension.barcodeFormatKey + /** TODO: call [BarcodeMappingResult.onError()] in case of error during obtaining mapped data. */ if (barcodeItem.textWithExtension == "Error occurred!") { result.onError()