Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated doc snippets #374

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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()
Expand Down