diff --git a/docs/sdks/android/add-sdk.md b/docs/sdks/android/add-sdk.md index eec91cf2..0f22c044 100644 --- a/docs/sdks/android/add-sdk.md +++ b/docs/sdks/android/add-sdk.md @@ -54,7 +54,7 @@ import ExternalDependencies from '../../partials/get-started/_external-deps-andr Add _mavenCentral()_ repository in your _build.gradle_ file: -```java +```gradle repositories { mavenCentral() } @@ -62,7 +62,7 @@ repositories { See [Internal Dependencies](#internal-dependencies) to identify the artifacts needed based on your desired functionality. Then add the necessary dependencies to your app’s _build.gradle_ file: -```java +```gradle dependencies { implementation "com.scandit.datacapture:[dependency]:[version]" } @@ -76,7 +76,7 @@ You can find the latest version on [Sonatype](https://s01.oss.sonatype.org/conte Add the _mavenCentral_ repository in _pom.xml_ file: -```java +```xml @@ -91,7 +91,7 @@ Add the _mavenCentral_ repository in _pom.xml_ file: See [Internal Dependencies](#internal-dependencies) to identify the artifacts needed based on your desired functionality. Then add the necessary dependencies: -```java +```xml ... @@ -115,7 +115,7 @@ Depending on the data capture task, you also need to reference the specific modu If your project already has a local `flatDir` repository, add the AAR files to that folder. If you do not have a `flatDir` repository yet, create a new one in your _build.gradle_ file as illustrated below: -```java +```gradle repositories { flatDir { dirs '/path/to/folder/containing/the/aar/file' @@ -125,7 +125,7 @@ repositories { Add the .aar libraries as dependencies to your `build.gradle` file: -```java +```gradle dependencies { api(name:'ScanditBarcodeCapture', ext:'aar') } diff --git a/docs/sdks/android/agents-android.md b/docs/sdks/android/agents-android.md index 1ee13b39..9075e030 100644 --- a/docs/sdks/android/agents-android.md +++ b/docs/sdks/android/agents-android.md @@ -63,8 +63,7 @@ val dataCaptureContext = DataCaptureContext.forLicenseKey(BuildConfig.SCANDIT_LI Java: ```java -import com.scandit.datacapture.core.DataCaptureContext; - +import com.scandit.datacapture.core.capture.DataCaptureContext; DataCaptureContext dataCaptureContext = DataCaptureContext.forLicenseKey(BuildConfig.SCANDIT_LICENSE_KEY); ``` diff --git a/docs/sdks/android/barcode-capture/get-started.md b/docs/sdks/android/barcode-capture/get-started.md index 57ec064b..68541f02 100644 --- a/docs/sdks/android/barcode-capture/get-started.md +++ b/docs/sdks/android/barcode-capture/get-started.md @@ -89,7 +89,7 @@ public void onBarcodeScanned( @NonNull BarcodeCaptureSession session, @NonNull FrameData frameData ) { - List recognizedBarcodes = session.getNewlyRecognizedBarcode(); + Barcode recognizedBarcode = session.getNewlyRecognizedBarcode(); // Do something with the barcodes. See Rejecting Barcodes, below, for an example. } ``` diff --git a/docs/sdks/android/barcode-generator.md b/docs/sdks/android/barcode-generator.md index 2fd75dcd..a08d367c 100644 --- a/docs/sdks/android/barcode-generator.md +++ b/docs/sdks/android/barcode-generator.md @@ -39,7 +39,7 @@ You can configure the colors used in the resulting image: ```java DataCaptureContext dataCaptureContext = DataCaptureContext.forLicenseKey(licenseKey); -BarcodeGenerator.Code128BarcodeGeneratorBuilder builder = new BarcodeGenerator.code128BarcodeGeneratorBuilder(dataCaptureContext) +BarcodeGenerator.Code128BarcodeGeneratorBuilder builder = BarcodeGenerator.code128BarcodeGeneratorBuilder(dataCaptureContext) .withBackgroundColor(Color.WHITE) .withForegroundColor(Color.BLACK); ``` diff --git a/docs/sdks/android/id-capture/advanced.md b/docs/sdks/android/id-capture/advanced.md index 9899fd38..4afcb173 100644 --- a/docs/sdks/android/id-capture/advanced.md +++ b/docs/sdks/android/id-capture/advanced.md @@ -17,7 +17,7 @@ There are several advanced configurations that can be used to customize the beha By default, ID Capture doesn’t extract data from the table on the back of European Driver Licenses. If you are interested in this data, you may enable the extraction by calling: ```java -settings.decodeBackOfEuropeanDrivingLicenses(); +settings.setDecodeBackOfEuropeanDrivingLicense(true); ``` :::warning @@ -32,16 +32,16 @@ That means certain data from certain fields won’t be returned, even if it’s ```java // Default value: -settings.setAnyonymizationMode(IdAnonymizationMode.FIELDS_ONLY); +settings.setAnonymizationMode(IdAnonymizationMode.FIELDS_ONLY); // Sensitive data is additionally covered with black boxes on returned images: -settings.setAnyonymizationMode(IdAnonymizationMode.FIELDS_AND_IMAGES); +settings.setAnonymizationMode(IdAnonymizationMode.FIELDS_AND_IMAGES); // Only images are anonymized: -settings.setAnyonymizationMode(IdAnonymizationMode.IMAGES_ONLY); +settings.setAnonymizationMode(IdAnonymizationMode.IMAGES_ONLY); // No anonymization: -settings.setAnyonymizationMode(IdAnonymizationMode.NONE); +settings.setAnonymizationMode(IdAnonymizationMode.NONE); ``` ## ID Images @@ -57,13 +57,13 @@ For the full frame of the document, you can use [`setShouldPassImageTypeToResult ```java // Holder's picture as printed on a document: -settings.setShouldPassImageTypeToResult(ImageType.FACE); +settings.setShouldPassImageTypeToResult(IdImageType.FACE, true); // Cropped image of a document: -settings.setShouldPassImageTypeToResult(ImageType.CROPPED_DOCUMENT); +settings.setShouldPassImageTypeToResult(IdImageType.CROPPED_DOCUMENT, true); // Full camera frame that contains the document: -settings.setShouldPassImageTypeToResult(ImageType.FULL_FRAME); +settings.setShouldPassImageTypeToResult(IdImageType.FRAME, true); ``` ## Callbacks and Scanning Workflows diff --git a/docs/sdks/android/id-capture/get-started.md b/docs/sdks/android/id-capture/get-started.md index 685fb19f..04ae4581 100644 --- a/docs/sdks/android/id-capture/get-started.md +++ b/docs/sdks/android/id-capture/get-started.md @@ -101,37 +101,37 @@ By default, [anonymized data](./advanced.md#configure-data-anonymization) is not ::: ```java -List acceptedDocuments = new ArrayList(); -List rejectedDocuments = new ArrayList(); +List acceptedDocuments = new ArrayList<>(); +List rejectedDocuments = new ArrayList<>(); // Documents from any region: -acceptedDocuments.add(new IdCard(Region.AnyRegion)); +acceptedDocuments.add(new IdCard(IdCaptureRegion.ANY)); // Only documents issued by a specific country: -acceptedDocuments.add(new IdCard(Region.Germany)); +acceptedDocuments.add(new IdCard(IdCaptureRegion.GERMANY)); // Regional documents: -acceptedDocuments.add(new RegionSpecific.ApecBusinessTravelCard()); +acceptedDocuments.add(new RegionSpecific(RegionSpecificSubtype.APEC_BUSINESS_TRAVEL_CARD)); // Reject passports from certain regions: -rejectedDocuments.add(new Passport(Region.Cuba)); +rejectedDocuments.add(new Passport(IdCaptureRegion.CUBA)); IdCaptureSettings settings = new IdCaptureSettings(); -settings.acceptedDocuments = acceptedDocuments; -settings.rejectedDocuments = rejectedDocuments; +settings.setAcceptedDocuments(acceptedDocuments); +settings.setRejectedDocuments(rejectedDocuments); // To scan only one-sided documents and a given zone: -settings.scannerType = new SingleSideScanner(barcode = true); -// or -settings.scannerType = new SingleSideScanner(machineReadableZone = true); -// or -settings.scannerType = new SingleSideScanner(visualInspectionZone = true); +settings.setScanner(new IdCaptureScanner(new SingleSideScanner( + true, // barcode + true, // machineReadableZone + true // visualInspectionZone +), null)); // To scan both sides of the document: -settings.scannerType = new FullDocumentScanner(); +settings.setScanner(new IdCaptureScanner(new FullDocumentScanner(), null)); ``` Create a new ID Capture mode with the chosen settings: ```java -IdCapture idCapture = IdCapture.forDataCaptureContext(context, settings); +IdCapture idCapture = IdCapture.forDataCaptureContext(dataCaptureContext, settings); ``` ## Implement a Listener @@ -139,19 +139,19 @@ IdCapture idCapture = IdCapture.forDataCaptureContext(context, settings); To receive scan results, implement and [IdCaptureListener](https://docs.scandit.com/data-capture-sdk/android/id-capture/api/id-capture-listener.html#interface-scandit.datacapture.id.IIdCaptureListener). The listener provides two callbacks: `onIdCaptured` and `onIdRejected`. ```java -IdCaptureListener listener = new IdCaptureListner() { +IdCaptureListener listener = new IdCaptureListener() { @Override - public void onIdCaptured(CapturedId data) { - // Success! Handle extracted data here. -} - + public void onIdCaptured(@NonNull IdCapture idCapture, @NonNull CapturedId capturedId) { + // Success! Handle extracted data here. + } + @Override - public void onIdRejected(CapturedId data, RejectionReason reason) { - // Something went wrong. Inspect the reason to determine the follow-up action. + public void onIdRejected(@NonNull IdCapture idCapture, @Nullable CapturedId capturedId, @NonNull RejectionReason rejectionReason) { + // Something went wrong. Inspect the reason to determine the follow-up action. } -} +}; -idCapture.setListener(listener); +idCapture.addListener(listener); ``` ### Handling Success @@ -164,14 +164,14 @@ On a successful scan you may read the extracted data from `CapturedId`: ```java @Override -public void onIdCaptured(CapturedId data) { - String fullName = data.getFullName(); - DateResult dateOfBirth = data.getDateOfBirth(); - DateResult dateOfExpiry = data.getDateOfExpiry(); - String documentNumber = data.getDocumentNumber(); +public void onIdCaptured(@NonNull IdCapture idCapture, @NonNull CapturedId capturedId) { + String fullName = capturedId.getFullName(); + DateResult dateOfBirth = capturedId.getDateOfBirth(); + DateResult dateOfExpiry = capturedId.getDateOfExpiry(); + String documentNumber = capturedId.getDocumentNumber(); // Process data: - processData(fullName, dateOfBirth, dateOfExpiry, documentNumber); + processData(fullName, dateOfBirth, dateOfExpiry, documentNumber); } ``` :::tip @@ -186,14 +186,14 @@ You may wish to implement the follow-up action based on the reason of failure: ```java @Override -public void onIdRejected(CapturedId data, RejectionReason reason) { - if (reason == RejectionReason.Timeout) { - // Ask the user to retry, or offer alternative input method. - } else if (reason == RejectionReason.DocumentExpired) { - // Ask the user to provide alternative document. - } else if (reason == RejectionReason.HolderUnderage) { - // Reject the process. - } +public void onIdRejected(@NonNull IdCapture idCapture, @Nullable CapturedId capturedId, @NonNull RejectionReason rejectionReason) { + if (rejectionReason == RejectionReason.TIMEOUT) { + // Ask the user to retry, or offer alternative input method. + } else if (rejectionReason == RejectionReason.DOCUMENT_EXPIRED) { + // Ask the user to provide alternative document. + } else if (rejectionReason == RejectionReason.HOLDER_UNDERAGE) { + // Reject the process. + } } ``` diff --git a/docs/sdks/android/label-capture/advanced.md b/docs/sdks/android/label-capture/advanced.md index 9ea7691d..d1932e57 100644 --- a/docs/sdks/android/label-capture/advanced.md +++ b/docs/sdks/android/label-capture/advanced.md @@ -63,29 +63,35 @@ overlay.setListener(new LabelCaptureBasicOverlayListener() { @Nullable @Override public Brush brushForLabel( - @NonNull LabelCaptureBasicOverlay overlay, @NonNull CapturedLabel label) { + @NonNull LabelCaptureBasicOverlay overlay, + @NonNull CapturedLabel label + ) { return null; } + @Nullable @Override - public Brush brushForField(@NonNull LabelCaptureBasicOverlay overlay, - @NonNull CapturedField field, @NonNull CapturedLabel label) { + public Brush brushForField( + @NonNull LabelCaptureBasicOverlay overlay, + @NonNull LabelField field, + @NonNull CapturedLabel label + ) { if (field.getName().equals("")) { return new Brush( - getResources().getColor(R.color.barcode_overlay_fill), - getResources().getColor(R.color.barcode_overlay_stroke), - 0f + getResources().getColor(R.color.barcode_overlay_fill), + getResources().getColor(R.color.barcode_overlay_stroke), + 0f ); - } - + } + if (field.getName().equals("")) { return new Brush( - getResources().getColor(R.color.expiry_date_overlay_fill), - getResources().getColor(R.color.expiry_date_overlay_stroke), - 0f + getResources().getColor(R.color.expiry_date_overlay_fill), + getResources().getColor(R.color.expiry_date_overlay_stroke), + 0f ); - } - + } + return null; } }); @@ -191,40 +197,51 @@ advancedOverlay.listener = object : LabelCaptureAdvancedOverlayListener { // Create an advanced overlay that allows for custom views to be added over detected label fields // This is the key component for implementing Augmented Reality features LabelCaptureAdvancedOverlay advancedOverlay = LabelCaptureAdvancedOverlay.newInstance( - dataCaptureManager.getLabelCapture(), view); + labelCapture, dataCaptureView); // Configure the advanced overlay with a listener that handles AR content creation and positioning advancedOverlay.setListener(new LabelCaptureAdvancedOverlayListener() { @Nullable @Override - public View viewForCapturedLabel(@NonNull LabelCaptureAdvancedOverlay overlay, - @NonNull CapturedLabel capturedLabel) { + public View viewForCapturedLabel( + @NonNull LabelCaptureAdvancedOverlay overlay, + @NonNull CapturedLabel capturedLabel + ) { // We return null since we're only adding AR elements to specific fields, not the entire label return null; } @NonNull @Override - public Anchor anchorForCapturedLabel(@NonNull LabelCaptureAdvancedOverlay overlay, - @NonNull CapturedLabel capturedLabel) { + public Anchor anchorForCapturedLabel( + @NonNull LabelCaptureAdvancedOverlay overlay, + @NonNull CapturedLabel capturedLabel + ) { // This defines where on the detected label the AR view would be anchored return Anchor.CENTER; } @NonNull @Override - public PointWithUnit offsetForCapturedLabel(@NonNull LabelCaptureAdvancedOverlay overlay, - @NonNull CapturedLabel capturedLabel, - @NonNull View view) { + public PointWithUnit offsetForCapturedLabel( + @NonNull LabelCaptureAdvancedOverlay overlay, + @NonNull CapturedLabel capturedLabel, + @NonNull View view + ) { // This defines the offset from the anchor point for the label's AR view - return new PointWithUnit(0f, 0f, MeasureUnit.PIXEL); + return new PointWithUnit( + new FloatWithUnit(0f, MeasureUnit.PIXEL), + new FloatWithUnit(0f, MeasureUnit.PIXEL) + ); } @Nullable @Override - public View viewForCapturedLabelField(@NonNull LabelCaptureAdvancedOverlay overlay, - @NonNull LabelField labelField) { + public View viewForCapturedLabelField( + @NonNull LabelCaptureAdvancedOverlay overlay, + @NonNull LabelField labelField + ) { // We only want to create AR elements for expiry date fields that are text-based if (labelField.getName().toLowerCase().contains("expiry") && labelField.getType() == LabelFieldType.TEXT) { @@ -234,7 +251,7 @@ advancedOverlay.setListener(new LabelCaptureAdvancedOverlayListener() { // // Assume we have a method `daysUntilExpiry()` that returns the days left until expiry - int daysUntilExpiry = daysUntilExpiry(labelField.getValue()); + int daysUntilExpiry = daysUntilExpiry(labelField.getText()); int dayLimit = 3; // Example threshold if (daysUntilExpiry < dayLimit) { @@ -263,19 +280,26 @@ advancedOverlay.setListener(new LabelCaptureAdvancedOverlayListener() { @NonNull @Override - public Anchor anchorForCapturedLabelField(@NonNull LabelCaptureAdvancedOverlay overlay, - @NonNull LabelField labelField) { + public Anchor anchorForCapturedLabelField( + @NonNull LabelCaptureAdvancedOverlay overlay, + @NonNull LabelField labelField + ) { // BOTTOM_CENTER places it right below the expiry date text for better visibility return Anchor.BOTTOM_CENTER; } @NonNull @Override - public PointWithUnit offsetForCapturedLabelField(@NonNull LabelCaptureAdvancedOverlay overlay, - @NonNull LabelField labelField, - @NonNull View view) { + public PointWithUnit offsetForCapturedLabelField( + @NonNull LabelCaptureAdvancedOverlay overlay, + @NonNull LabelField labelField, + @NonNull View view + ) { // This defines the offset from the anchor point - return new PointWithUnit(0f, 22f, MeasureUnit.DIP); + return new PointWithUnit( + new FloatWithUnit(0f, MeasureUnit.DIP), + new FloatWithUnit(22f, MeasureUnit.DIP) + ); } }); ``` @@ -312,8 +336,8 @@ validationFlowOverlay?.listener = this // Create the overlay validationFlowOverlay = LabelCaptureValidationFlowOverlay.newInstance( getContext(), - dataCaptureManager.getLabelCapture(), - view + labelCapture, + dataCaptureView ); // Set the listener to receive validation events validationFlowOverlay.setListener(this); @@ -349,18 +373,12 @@ validationFlowOverlay?.applySettings(validationSettings) // Configure the validation flow with custom settings LabelCaptureValidationFlowSettings validationSettings = LabelCaptureValidationFlowSettings.newInstance(); -validationSettings.setMissingFieldsHintText("Please add this field"); validationSettings.setStandbyHintText("No label detected, camera paused"); validationSettings.setValidationHintText("fields captured"); // X/Y (X fields out of total Y) is shown in front of this string validationSettings.setValidationErrorText("Input not valid"); -validationSettings.setRequiredFieldErrorText("This field is required"); -validationSettings.setManualInputButtonText("Add info manually"); // Apply the settings to the overlay -if (validationFlowOverlay != null) { - validationFlowOverlay.applySettings(validationSettings); -} - +validationFlowOverlay.applySettings(validationSettings); ``` diff --git a/docs/sdks/android/label-capture/get-started.md b/docs/sdks/android/label-capture/get-started.md index 461716c4..7538da03 100644 --- a/docs/sdks/android/label-capture/get-started.md +++ b/docs/sdks/android/label-capture/get-started.md @@ -94,29 +94,29 @@ LabelCaptureSettings settings = LabelCaptureSettings.builder() .addLabel() /* * Add a barcode field with the expected symbologies and pattern. - * You can omit the pattern if the content of the barcode is unknown. + * You can omit the pattern if the content of the barcode is unknown. */ .addCustomBarcode() .setSymbologies(Symbology.EAN13_UPCA, Symbology.CODE128) - .setPattern("\\d{12,14}") .buildFluent("") .buildFluent("") .build(); /* - * Create the label capture mode with the settings and data capture context created earlier. - */ -LabelCapture labelCapture = LabelCapture.forDataCaptureContext(dataCaptureContext, settings) +* Create the label capture mode with the settings and data capture context created earlier. +*/ +LabelCapture labelCapture = LabelCapture.forDataCaptureContext(dataCaptureContext, settings); ``` + @@ -136,33 +136,33 @@ labelCapture.addListener(object : LabelCaptureListener { session: LabelCaptureSession, data: FrameData ) { - /* + /* * The session update callback is called for every processed frame. - * Check if the session contains any captured labels; + * Check if the session contains any captured labels; * if not, continue capturing. */ val capturedLabel = session.capturedLabels.firstOrNull() ?: return - /* - * Given the label capture settings defined above, + /* + * Given the label capture settings defined above, * barcode data will always be present. */ val barcodeData = capturedLabel.fields .find { it.name == "" }?.barcode?.data - /* + /* * The expiry date field is optional. Check for null in your result handling. */ val expiryDate = capturedLabel.fields .find { it.name == "" }?.asDate() - /* + /* * Disable the label capture mode after a label has been captured * to prevent it from capturing the same label multiple times. */ mode.isEnabled = false - - /* + + /* * Consider handling the results in a coroutine to avoid blocking the main thread * when updating the UI. */ @@ -184,20 +184,20 @@ Depending on your app architecture and whether you use dependency injection or n ```java public class LabelCaptureRepository implements LabelCaptureListener { - /* + /* * We use MutableLiveData to post captured labels to the UI thread. * You don't need to use MutableLiveData in your implementation, but it's important good practice to keep the UI thread free from heavy processing. */ private final MutableLiveData capturedLabels = new MutableLiveData<>(); - + // ... other methods - + @Override public void onSessionUpdated( @NonNull LabelCapture labelCapture, @NonNull LabelCaptureSession session, @NonNull FrameData frameData) { - /* + /* * The session update callback is called for every processed frame. * Check if the session contains any captured labels; if not, continue capturing. */ @@ -205,40 +205,40 @@ public class LabelCaptureRepository implements LabelCaptureListener { if (!labels.isEmpty()) { final CapturedLabel label = labels.get(0); - - /* - * Given the label capture settings defined above, + + /* + * Given the label capture settings defined above, * the barcode field would always be present. */ String barcodeData = label.getFields().stream() - .filter(field -> field.getName().equals("")) - .findFirst() - .map(field -> field.getBarcode().getData()) - .orElse(null); + .filter(field -> field.getName().equals("")) + .findFirst() + .map(field -> field.getBarcode().getData()) + .orElse(null); - /* - * The expiry date field is optional. + /* + * The expiry date field is optional. * Check for null in your result handling. */ String expiryDate = label.getFields().stream() - .filter(field -> field.getName().equals("")) - .findFirst() - .map(CapturedField::getText) - .orElse(null); + .filter(field -> field.getName().equals("")) + .findFirst() + .map(LabelField::getText) + .orElse(null); - /* + /* * Disable the label capture mode after a label has been captured * to prevent it from capturing the same label multiple times. */ labelCapture.setEnabled(false); - /* + /* * Post the captured results for further processing. */ capturedLabels.postValue(new CapturedLabelEvent(barcodeData, expiryDate)); - - /* - * Consider communicating a successful scan with audio and vibration feedback. + + /* + * Consider communicating a successful scan with audio and vibration feedback. * See the Feedback section for more information. */ Feedback.defaultFeedback().emit(); @@ -268,12 +268,12 @@ Here is an example of how to add a `LabelCaptureBasicOverlay` to the `DataCaptur ```kotlin -/* +/* * Create the data capture view and attach it to the data capture context created earlier. */ val dataCaptureView = DataCaptureView.newInstance(requireContext(), dataCaptureContext) -/* +/* * Add the data capture view to your view hierarchy, e.g. with setContentView or findViewById. */ val container = /* get your containing view here, e.g. with inflate or findViewById */ @@ -283,7 +283,7 @@ container.addView( ViewGroup.LayoutParams.MATCH_PARENT ) -/* +/* * Create the overlay with the label capture mode and data capture view created earlier. */ val overlay = LabelCaptureBasicOverlay.newInstance(labelCapture, dataCaptureView) @@ -294,21 +294,21 @@ overlay.viewfinder = RectangularViewfinder(RectangularViewfinderStyle.SQUARE) ```java -/* +/* * Create the data capture view and attach it to the data capture context created earlier. */ DataCaptureView dataCaptureView = DataCaptureView.newInstance(this, dataCaptureContext); -/* +/* * Add the data capture view to your view hierarchy, e.g. with setContentView or findViewById. */ -ViewGroup container = /* get your containing view here, e.g. with inflate or findViewById */ +ViewGroup container = findViewById(R.id.container); /* get your containing view here, e.g. with inflate or findViewById */ container.addView( - dataCaptureView, - new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT) + dataCaptureView, + new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT) ); -/* +/* * Create the overlay with the label capture mode and data capture view created earlier. */ LabelCaptureBasicOverlay overlay = LabelCaptureBasicOverlay.newInstance(labelCapture, dataCaptureView); diff --git a/docs/sdks/android/matrixscan-ar/get-started.md b/docs/sdks/android/matrixscan-ar/get-started.md index 3364a7c5..d51f7b24 100644 --- a/docs/sdks/android/matrixscan-ar/get-started.md +++ b/docs/sdks/android/matrixscan-ar/get-started.md @@ -61,7 +61,7 @@ settings.enableSymbology(Symbology.EAN13_UPCA, true); Then create the mode with the previously created settings: ```java -BarcodeAr mode = new BarcodeAr(dataCaptureContext, settings); +BarcodeAr barcodeAr = new BarcodeAr(dataCaptureContext, settings); ``` ## Setup the `BarcodeArView` @@ -143,8 +143,8 @@ public void onPause() { } @Override -public void onDestroyView() { - super.onDestroyView(); +public void onDestroy() { + super.onDestroy(); barcodeArView.onDestroy(); } ``` diff --git a/docs/sdks/android/matrixscan-count/advanced.md b/docs/sdks/android/matrixscan-count/advanced.md index 8ba356d9..e100b18d 100644 --- a/docs/sdks/android/matrixscan-count/advanced.md +++ b/docs/sdks/android/matrixscan-count/advanced.md @@ -65,7 +65,7 @@ For example, you might want to scan only Code 128 barcodes and no PDF417 barcode ```java BarcodeCountSettings settings = new BarcodeCountSettings(); -barcodeCountSettings.enableSymbologies(enabledSymbologies); +settings.enableSymbologies(enabledSymbologies); Set excludedSymbologies = new HashSet<>(); excludedSymbologies.add(Symbology.PDF417); @@ -105,15 +105,13 @@ The methods [BarcodeCountViewListener.brushForRecognizedBarcode()](https://docs. ```java @Nullable @Override -public Brush brushForRecognizedBarcode( - @NonNull BarcodeCountView view, @NonNull TrackedBarcode trackedBarcode) { +public Brush brushForRecognizedBarcode(@NonNull BarcodeCountView view, @NonNull TrackedBarcode trackedBarcode) { // Return a custom brush } @Nullable @Override -public Brush brushForUnrecognizedBarcode( - @NonNull BarcodeCountView view, @NonNull TrackedBarcode trackedBarcode) { +public Brush brushForRecognizedBarcodeNotInList(@NonNull BarcodeCountView view, @NonNull TrackedBarcode trackedBarcode) { // Return a custom brush } ``` @@ -125,13 +123,17 @@ If you want to be notified when a user taps on an overlay, you need to implement ```java @Override public void onRecognizedBarcodeTapped( - @NonNull BarcodeCountView view, @NonNull TrackedBarcode trackedBarcode) { + @NonNull BarcodeCountView view, + @NonNull TrackedBarcode trackedBarcode +) { // Do something with the tapped barcode } @Override -public void onUnrecognizedBarcodeTapped( - @NonNull BarcodeCountView view, @NonNull TrackedBarcode trackedBarcode) { +public void onRecognizedBarcodeNotInListTapped( + @NonNull BarcodeCountView view, + @NonNull TrackedBarcode trackedBarcode +) { // Do something with the tapped barcode } ``` diff --git a/docs/sdks/android/matrixscan-count/get-started.md b/docs/sdks/android/matrixscan-count/get-started.md index 41d7e46e..3aa62c3f 100644 --- a/docs/sdks/android/matrixscan-count/get-started.md +++ b/docs/sdks/android/matrixscan-count/get-started.md @@ -67,7 +67,7 @@ settings.setSymbologyEnabled(Symbology.EAN13_UPCA, true); Next, create a `BarcodeCount` instance with the Data Capture Context and the settings initialized in the previous step: ```java -BarcodeCount barcodeCount = BarcodeCount.forDataCaptureContext(context, settings); +BarcodeCount barcodeCount = BarcodeCount.forDataCaptureContext(dataCaptureContext, settings); ``` ## Camera Instance And Set Frame Source @@ -77,8 +77,7 @@ Our recommended camera settings should be used to achieve the best performance a ```java CameraSettings cameraSettings = BarcodeCount.createRecommendedCameraSettings(); -Camera camera = Camera.getDefaultCamera(); -camera.applySettings(cameraSettings); +Camera camera = Camera.getDefaultCamera(cameraSettings); ``` Because the frame source is configurable the data capture context must be told which frame source to use. This is done with a call to [`DataCaptureContext.setFrameSource()`](https://docs.scandit.com/data-capture-sdk/android/core/api/data-capture-context.html#method-scandit.datacapture.core.DataCaptureContext.SetFrameSourceAsync): @@ -105,7 +104,7 @@ MatrixScan Count’s built-in AR user interface includes buttons and overlays th Add a `BarcodeCountView` to your view hierarchy: ```java -BarcodeCountView view = BarcodeCountView.newInstance(barcodeCount, captureView); +BarcodeCountView view = BarcodeCountView.newInstance(context, dataCaptureView, barcodeCount); ``` ## Configuring the Camera for Scanning View @@ -141,7 +140,7 @@ public void onScan( @NonNull BarcodeCountSession session, @NonNull FrameData data ) { - allRecognizedBarcodes = session.getRecognizedBarcodes().values(); + List allRecognizedBarcodes = session.getRecognizedBarcodes(); } ``` @@ -152,7 +151,7 @@ When the scanning process is over, you need to reset the mode to make it ready f To reset Barcode Count’s scanning process, call the `BarcodeCount.reset` method: ```java -barcodeCount.reset() +barcodeCount.reset(); ``` ## List and Exit Callbacks diff --git a/docs/sdks/android/matrixscan-find/advanced.md b/docs/sdks/android/matrixscan-find/advanced.md index 06211fa5..e5720bba 100644 --- a/docs/sdks/android/matrixscan-find/advanced.md +++ b/docs/sdks/android/matrixscan-find/advanced.md @@ -19,7 +19,7 @@ You may want more fine-grained knowledge over the different events happening dur To do this, you can directly register a [`BarcodeFindListener`](https://docs.scandit.com/data-capture-sdk/android/barcode-capture/api/barcode-find-listener.html#interface-scandit.datacapture.barcode.find.IBarcodeFindListener) on the mode itself, keeping in mind that these listeners are called from a background thread. ```java -mode.addListener(new BarcodeFindListener() { +barcodeFind.addListener(new BarcodeFindListener() { @Override public void onSearchPaused(@NonNull Set foundItems) { // The mode was paused @@ -78,7 +78,7 @@ class Transformer implements BarcodeFindTransformer { Then the transformer needs to be set so it can be used by MatrixScan Find: ```java -barcodeFind.setBarcodeTransformer(new Transformer()) +barcodeFind.setTransformer(new Transformer()); ``` ## UI Customization diff --git a/docs/sdks/android/matrixscan-find/get-started.md b/docs/sdks/android/matrixscan-find/get-started.md index fd5182f3..828a6010 100644 --- a/docs/sdks/android/matrixscan-find/get-started.md +++ b/docs/sdks/android/matrixscan-find/get-started.md @@ -67,24 +67,24 @@ Next, create the list of items that will be actively searched for. We will also ```java Set items = new HashSet<>(); items.add( - new BarcodeFindItem( - new BarcodeFindItemSearchOptions("9783598215438"), - new BarcodeFindItemContent("Mini Screwdriver Set", "(6-Piece)", null) - ) + new BarcodeFindItem( + new BarcodeFindItemSearchOptions("9783598215438"), + new BarcodeFindItemContent("Mini Screwdriver Set", "(6-Piece)", null) + ) ); items.add( - new BarcodeFindItem( - new BarcodeFindItemSearchOptions("9783598215414"), - null // Item information is optional, used for display only - ) + new BarcodeFindItem( + new BarcodeFindItemSearchOptions("9783598215414"), + null // Item information is optional, used for display only + ) ); ``` Finally, create a `BarcodeFind` instance with the Data Capture Context and the settings initialized in the previous step: ```java -BarcodeFind mode = new BarcodeFind(settings); -mode.setItemList(items); +BarcodeFind barcodeFind = new BarcodeFind(settings); +barcodeFind.setItemList(items); ``` ## Setup the `BarcodeFindView` @@ -94,17 +94,18 @@ MatrixScan Find’s built-in AR user interface includes buttons and overlays tha The `BarcodeFindView` appearance can be customized through [`BarcodeFindViewSettings`](https://docs.scandit.com/data-capture-sdk/android/barcode-capture/api/ui/barcode-find-view-settings.html#class-scandit.datacapture.barcode.find.ui.BarcodeFindViewSettings) to match your application’s look and feel. For example, you can change the color of the dots that are overlaid on top of the items that are found and enable sound and haptic alerts. ```java -BarcodeFindViewSettings viewSettings = new BarcodeFindViewSettings(); -viewSettings.inListItemColor = .green -viewSettings.notInListItemColor = .red -viewSettings.soundEnabled = true -viewSettings.hapticEnabled = true +BarcodeFindViewSettings viewSettings = new BarcodeFindViewSettings( + Color.GREEN, // inListItemColor + Color.RED, // notInListItemColor + true, // soundEnabled + true // hapticEnabled +); ``` Next, create a `BarcodeFindView` instance with the Data Capture Context and the settings initialized in the previous step. The `BarcodeFindView` is automatically added to the provided parent view. ```java -BarcodeFindView barcodeFindView = BarcodeFindView.newInstance(parentView, dataCaptureContext, mode, viewSettings); +BarcodeFindView barcodeFindView = BarcodeFindView.newInstance(parentView, dataCaptureContext, barcodeFind, viewSettings); ``` Connect the `BarcodeFindView` to the Android lifecycle. The view is dependent on calling `BarcodeFindView.onPause()` and `BarcodeFindView.onResume()` to set up the camera and its overlays properly. diff --git a/docs/sdks/android/matrixscan-pick/advanced.md b/docs/sdks/android/matrixscan-pick/advanced.md index 51345f18..8665ae52 100644 --- a/docs/sdks/android/matrixscan-pick/advanced.md +++ b/docs/sdks/android/matrixscan-pick/advanced.md @@ -17,7 +17,7 @@ MatrixScan Pick is optimized by default for efficiency, accuracy, and a seamless You can register a [`BarcodePickListener`](https://docs.scandit.com/data-capture-sdk/android/barcode-capture/api/ui/barcode-pick-listener.html) on the mode, which can be used to get updates about the scanned items with each frame. ```java -mode.addListener(new BarcodePickListener() { +barcodePick.addListener(new BarcodePickListener() { @Override public void onSessionUpdated(@NonNull BarcodePick barcodePick, @NonNull BarcodePickSession session) { // This callback will be invoked on a background thread every frame. the session object contains @@ -37,7 +37,7 @@ mode.addListener(new BarcodePickListener() { You can register a [`BarcodePickScanningListener`](https://docs.scandit.com/data-capture-sdk/android/barcode-capture/api/barcode-pick-scanning-listener.html) on the mode, which can be used to listen to every time the pick state changes. ```java -mode.addScanningListener(new BarcodePickScanningListener() { +barcodePick.addScanningListener(new BarcodePickScanningListener() { @Override public void onScanningSessionUpdated(@NonNull BarcodePick barcodePick, @NonNull BarcodePickScanningSession session) { // This callback will be invoked on a background thread every time the picked state of some item changes. diff --git a/docs/sdks/android/matrixscan/advanced.md b/docs/sdks/android/matrixscan/advanced.md index 149d69b8..22725054 100644 --- a/docs/sdks/android/matrixscan/advanced.md +++ b/docs/sdks/android/matrixscan/advanced.md @@ -55,10 +55,11 @@ For this option, keep in mind that: @Nullable @Override public View viewForTrackedBarcode( - @NotNull BarcodeBatchAdvancedOverlay overlay, - @NotNull TrackedBarcode trackedBarcode + @NonNull BarcodeBatchAdvancedOverlay overlay, + @NonNull TrackedBarcode trackedBarcode ) { - // Create and return the view you want to show for this tracked barcode. You can also return null, to have no view for this barcode. + // Create and return the view you want to show for this tracked barcode. + // You can also return null, to have no view for this barcode. TextView textView = new TextView(this); textView.setBackgroundColor(Color.WHITE); textView.setLayoutParams( @@ -71,23 +72,23 @@ public View viewForTrackedBarcode( return textView; } -@NotNull +@NonNull @Override public Anchor anchorForTrackedBarcode( - @NotNull BarcodeBatchAdvancedOverlay overlay, - @NotNull TrackedBarcode trackedBarcode + @NonNull BarcodeBatchAdvancedOverlay overlay, + @NonNull TrackedBarcode trackedBarcode ) { // As we want the view to be above the barcode, we anchor the view's center to the top-center of the barcode quadrilateral. // Use the function 'offsetForTrackedBarcode' below to adjust the position of the view by providing an offset. return Anchor.TOP_CENTER; } -@NotNull +@NonNull @Override public PointWithUnit offsetForTrackedBarcode( - @NotNull BarcodeBatchAdvancedOverlay overlay, - @NotNull TrackedBarcode trackedBarcode, - @NotNull View view + @NonNull BarcodeBatchAdvancedOverlay overlay, + @NonNull TrackedBarcode trackedBarcode, + @NonNull View view ) { // This is the offset that will be applied to the view. // You can use MeasureUnit.FRACTION to give a measure relative to the view itself, the sdk will take care of transforming this into pixel size. @@ -113,38 +114,35 @@ From here you can create the view you want to display, and then call: @Override public void onSessionUpdated( @NonNull BarcodeBatch mode, - @NonNull final BarcodeBatchSession session, + @NonNull BarcodeBatchSession session, @NonNull FrameData data ) { - // Be careful, this function is not invoked on the main thread! - runOnUiThread(new Runnable() { - @Override - public void run() { - for (TrackedBarcode trackedBarcode : session.getAddedTrackedBarcodes()) { - TextView textView = new TextView(this); - textView.setBackgroundColor(Color.WHITE); - textView.setLayoutParams( - new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.WRAP_CONTENT, - ViewGroup.LayoutParams.WRAP_CONTENT - ) - ); - textView.setText(trackedBarcode.getBarcode().getData()); - overlay.setViewForTrackedBarcode(trackedBarcode, textView); - overlay.setAnchorForTrackedBarcode( - trackedBarcode, Anchor.TOP_CENTER - ); - overlay.setOffsetForTrackedBarcode( - trackedBarcode, - new PointWithUnit( - new FloatWithUnit(0f, MeasureUnit.FRACTION), - new FloatWithUnit(-1f, MeasureUnit.FRACTION) - ) - ); - } - } - }); - } + // Be careful, this function is not invoked on the main thread! + runOnUiThread(() -> { + for (TrackedBarcode trackedBarcode : session.getAddedTrackedBarcodes()) { + TextView textView = new TextView(this); + textView.setBackgroundColor(Color.WHITE); + textView.setLayoutParams( + new ViewGroup.LayoutParams( + ViewGroup.LayoutParams.WRAP_CONTENT, + ViewGroup.LayoutParams.WRAP_CONTENT + ) + ); + textView.setText(trackedBarcode.getBarcode().getData()); + overlay.setViewForTrackedBarcode(trackedBarcode, textView); + overlay.setAnchorForTrackedBarcode( + trackedBarcode, Anchor.TOP_CENTER + ); + overlay.setOffsetForTrackedBarcode( + trackedBarcode, + new PointWithUnit( + new FloatWithUnit(0f, MeasureUnit.FRACTION), + new FloatWithUnit(-1f, MeasureUnit.FRACTION) + ) + ); + } + }); +} ``` ## Using Custom Implementations @@ -163,32 +161,28 @@ The frame coordinates from `TrackedBarcode.location` need to be mapped to view c ```java @Override - public void onSessionUpdated( - @NonNull BarcodeBatch mode, - @NonNull final BarcodeBatchSession session, - @NonNull FrameData data - ) { - // Be careful, this function is not invoked on the main thread! - runOnUiThread(new Runnable() { - @Override - public void run() { - - for (int lostTrackIdentifier : session.getRemovedTrackedBarcodes()) { - // You now know the identifier of the tracked barcode that has been lost. Usually here you would remove the views associated. - } - - for (TrackedBarcode trackedBarcode : session.getAddedTrackedBarcodes()) { - - // Fixed identifier for the tracked barcode. - Integer trackingIdentifier = trackedBarcode.getIdentifier(); - - // Current location of the tracked barcode. - Quadrilateral location = trackedBarcode.getLocation(); - Quadrilateral quadrilateral = dataCaptureView.mapFrameQuadrilateralToView(location); - - // You now know this new tracking's identifier and location. Usually here you would create and show the views. - } - } - }); - } +public void onSessionUpdated( + @NonNull BarcodeBatch mode, + @NonNull final BarcodeBatchSession session, + @NonNull FrameData data +) { + // Be careful, this function is not invoked on the main thread! + runOnUiThread(() -> { + for (int lostTrackIdentifier : session.getRemovedTrackedBarcodes()) { + // You now know the identifier of the tracked barcode that has been lost. Usually here you would remove the views associated. + } + + for (TrackedBarcode trackedBarcode : session.getAddedTrackedBarcodes()) { + + // Fixed identifier for the tracked barcode. + Integer trackingIdentifier = trackedBarcode.getIdentifier(); + + // Current location of the tracked barcode. + Quadrilateral location = trackedBarcode.getLocation(); + Quadrilateral quadrilateral = dataCaptureView.mapFrameQuadrilateralToView(location); + + // You now know this new tracking's identifier and location. Usually here you would create and show the views. + } + }); +} ``` diff --git a/docs/sdks/android/matrixscan/get-started.md b/docs/sdks/android/matrixscan/get-started.md index 5d0c1fc6..bd9a75a6 100644 --- a/docs/sdks/android/matrixscan/get-started.md +++ b/docs/sdks/android/matrixscan/get-started.md @@ -128,9 +128,12 @@ BarcodeBatchBasicOverlay overlay = BarcodeBatchBasicOverlay.newInstance(barcodeB Once the overlay has been added, you must conform to the [BarcodeBatchBasicOverlayListener](https://docs.scandit.com/data-capture-sdk/android/barcode-capture/api/ui/barcode-batch-basic-overlay-listener.html#interface-scandit.datacapture.barcode.batch.ui.IBarcodeBatchBasicOverlayListener) interface. The method [BarcodeBatchBasicOverlayListener.brushForTrackedBarcode()](https://docs.scandit.com/data-capture-sdk/android/barcode-capture/api/ui/barcode-batch-basic-overlay-listener.html#method-scandit.datacapture.barcode.batch.ui.IBarcodeBatchBasicOverlayListener.BrushForTrackedBarcode) is invoked every time a new tracked barcode appears and it can be used to set a brush used to highlight that specific barcode in the [overlay](https://docs.scandit.com/data-capture-sdk/android/barcode-capture/api/ui/barcode-batch-basic-overlay.html#class-scandit.datacapture.barcode.batch.ui.BarcodeBatchBasicOverlay). ```java +@Nullable @Override -public Brush brushForTrackedBarcode(@NonNull BarcodeBatchBasicOverlay overlay, - @NonNull TrackedBarcode trackedBarcode) { +public Brush brushForTrackedBarcode( + @NonNull BarcodeBatchBasicOverlay overlay, + @NonNull TrackedBarcode trackedBarcode +) { // Return a custom Brush based on the tracked barcode. } ``` @@ -139,8 +142,10 @@ If you want to make the highlights tappable, you need to implement the [BarcodeB ```java @Override -public void onTap(@NonNull BarcodeBatchBasicOverlay overlay, - @NonNull TrackedBarcode trackedBarcode) { +public void onTrackedBarcodeTapped( + @NonNull BarcodeBatchBasicOverlay overlay, + @NonNull TrackedBarcode trackedBarcode +) { // A tracked barcode was tapped. } ``` @@ -154,33 +159,32 @@ Here, we use the default [Feedback](https://docs.scandit.com/data-capture-sdk/an First, we create a feedback and release it after it is no longer used, to avoid resources being unnecessarily held. ```java -override func viewDidLoad() { - super.viewDidLoad() - feedback = Feedback.default -} +Feedback feedback = Feedback.defaultFeedback(); ``` Next, use this `feedback` in a `BarcodeBatchListener`: ```java public class FeedbackListener implements BarcodeBatchListener { + Feedback feedback = Feedback.defaultFeedback(); + @Override - public void onObservationStarted(@NotNull BarcodeBatch barcodeBatch) { + public void onObservationStarted(@NonNull BarcodeBatch barcodeBatch) { // Called when Barcode Batch is started. // We don't use this callback in this guide. } @Override - public void onObservationStopped(@NotNull BarcodeBatch barcodeBatch) { + public void onObservationStopped(@NonNull BarcodeBatch barcodeBatch) { // Called when Barcode Batch is stopped. // We don't use this callback in this guide. } @Override public void onSessionUpdated( - @NotNull BarcodeBatch mode, - @NotNull BarcodeBatchSession session, - @NotNull FrameData data + @NonNull BarcodeBatch mode, + @NonNull BarcodeBatchSession session, + @NonNull FrameData data ) { if (!session.getAddedTrackedBarcodes().isEmpty()) { feedback.emit(); @@ -194,7 +198,7 @@ public class FeedbackListener implements BarcodeBatchListener { As the last step, register the listener responsible for emitting the feedback with the `BarcodeBatch` instance. ```java -barcodeBatch.addListener(feedbackListener); +barcodeBatch.addListener(new FeedbackListener()); ``` ## Disable Barcode Batch diff --git a/docs/sdks/android/sparkscan/get-started.md b/docs/sdks/android/sparkscan/get-started.md index 9269f21f..688e5b5f 100644 --- a/docs/sdks/android/sparkscan/get-started.md +++ b/docs/sdks/android/sparkscan/get-started.md @@ -129,15 +129,15 @@ public void onBarcodeScanned( @NonNull SparkScan sparkScan, @NonNull SparkScanSession session, @Nullable FrameData data ) { // Gather the recognized barcode - Barcode barcode = session.getNewlyRecognizedBarcode().get(0); + Barcode barcode = session.getNewlyRecognizedBarcode(); // This method is invoked from a recognition internal thread. // Run the specified action in the UI thread to update the internal barcode list. runOnUiThread(() -> { // Update the internal list and the UI with the barcode retrieved above - this.latestBarcode = barcode + this.latestBarcode = barcode; }); - } +} ``` ## Scan Some Barcodes diff --git a/versioned_docs/version-7.6.7/sdks/android/add-sdk.md b/versioned_docs/version-7.6.7/sdks/android/add-sdk.md index eec91cf2..97ee0653 100644 --- a/versioned_docs/version-7.6.7/sdks/android/add-sdk.md +++ b/versioned_docs/version-7.6.7/sdks/android/add-sdk.md @@ -54,15 +54,15 @@ import ExternalDependencies from '../../partials/get-started/_external-deps-andr Add _mavenCentral()_ repository in your _build.gradle_ file: -```java +```gradle repositories { mavenCentral() } ``` -See [Internal Dependencies](#internal-dependencies) to identify the artifacts needed based on your desired functionality. Then add the necessary dependencies to your app’s _build.gradle_ file: +See [Internal Dependencies](#internal-dependencies) to identify the artifacts needed based on your desired functionality. Then add the necessary dependencies to your app's _build.gradle_ file: -```java +```gradle dependencies { implementation "com.scandit.datacapture:[dependency]:[version]" } @@ -76,7 +76,7 @@ You can find the latest version on [Sonatype](https://s01.oss.sonatype.org/conte Add the _mavenCentral_ repository in _pom.xml_ file: -```java +```xml @@ -91,7 +91,7 @@ Add the _mavenCentral_ repository in _pom.xml_ file: See [Internal Dependencies](#internal-dependencies) to identify the artifacts needed based on your desired functionality. Then add the necessary dependencies: -```java +```xml ... @@ -115,7 +115,7 @@ Depending on the data capture task, you also need to reference the specific modu If your project already has a local `flatDir` repository, add the AAR files to that folder. If you do not have a `flatDir` repository yet, create a new one in your _build.gradle_ file as illustrated below: -```java +```gradle repositories { flatDir { dirs '/path/to/folder/containing/the/aar/file' @@ -125,7 +125,7 @@ repositories { Add the .aar libraries as dependencies to your `build.gradle` file: -```java +```gradle dependencies { api(name:'ScanditBarcodeCapture', ext:'aar') } diff --git a/versioned_docs/version-7.6.7/sdks/android/agents-android.md b/versioned_docs/version-7.6.7/sdks/android/agents-android.md index 1ee13b39..9075e030 100644 --- a/versioned_docs/version-7.6.7/sdks/android/agents-android.md +++ b/versioned_docs/version-7.6.7/sdks/android/agents-android.md @@ -63,8 +63,7 @@ val dataCaptureContext = DataCaptureContext.forLicenseKey(BuildConfig.SCANDIT_LI Java: ```java -import com.scandit.datacapture.core.DataCaptureContext; - +import com.scandit.datacapture.core.capture.DataCaptureContext; DataCaptureContext dataCaptureContext = DataCaptureContext.forLicenseKey(BuildConfig.SCANDIT_LICENSE_KEY); ``` diff --git a/versioned_docs/version-7.6.7/sdks/android/barcode-capture/get-started.md b/versioned_docs/version-7.6.7/sdks/android/barcode-capture/get-started.md index 30f2dad1..aaa12845 100644 --- a/versioned_docs/version-7.6.7/sdks/android/barcode-capture/get-started.md +++ b/versioned_docs/version-7.6.7/sdks/android/barcode-capture/get-started.md @@ -89,7 +89,7 @@ public void onBarcodeScanned( @NonNull BarcodeCaptureSession session, @NonNull FrameData frameData ) { - List recognizedBarcodes = session.getNewlyRecognizedBarcode(); + Barcode recognizedBarcode = session.getNewlyRecognizedBarcode(); // Do something with the barcodes. See Rejecting Barcodes, below, for an example. } ``` diff --git a/versioned_docs/version-7.6.7/sdks/android/barcode-generator.md b/versioned_docs/version-7.6.7/sdks/android/barcode-generator.md index 0e5a4027..e0b9fa1c 100644 --- a/versioned_docs/version-7.6.7/sdks/android/barcode-generator.md +++ b/versioned_docs/version-7.6.7/sdks/android/barcode-generator.md @@ -38,7 +38,7 @@ You can configure the colors used in the resulting image: ```java DataCaptureContext dataCaptureContext = DataCaptureContext.forLicenseKey(licenseKey); -BarcodeGenerator.Code128BarcodeGeneratorBuilder builder = new BarcodeGenerator.code128BarcodeGeneratorBuilder(dataCaptureContext) +BarcodeGenerator.Code128BarcodeGeneratorBuilder builder = BarcodeGenerator.code128BarcodeGeneratorBuilder(dataCaptureContext) .withBackgroundColor(Color.WHITE) .withForegroundColor(Color.BLACK); ``` diff --git a/versioned_docs/version-7.6.7/sdks/android/id-capture/advanced.md b/versioned_docs/version-7.6.7/sdks/android/id-capture/advanced.md index 3e5d896a..d9b6b824 100644 --- a/versioned_docs/version-7.6.7/sdks/android/id-capture/advanced.md +++ b/versioned_docs/version-7.6.7/sdks/android/id-capture/advanced.md @@ -17,7 +17,7 @@ There are several advanced configurations that can be used to customize the beha By default, ID Capture doesn’t extract data from the table on the back of European Driver Licenses. If you are interested in this data, you may enable the extraction by calling: ```java -settings.decodeBackOfEuropeanDrivingLicenses(); +settings.setDecodeBackOfEuropeanDrivingLicense(true); ``` :::warning @@ -32,16 +32,16 @@ That means certain data from certain fields won’t be returned, even if it’s ```java // Default value: -settings.setAnyonymizationMode(IdAnonymizationMode.FIELDS_ONLY); +settings.setAnonymizationMode(IdAnonymizationMode.FIELDS_ONLY); // Sensitive data is additionally covered with black boxes on returned images: -settings.setAnyonymizationMode(IdAnonymizationMode.FIELDS_AND_IMAGES); +settings.setAnonymizationMode(IdAnonymizationMode.FIELDS_AND_IMAGES); // Only images are anonymized: -settings.setAnyonymizationMode(IdAnonymizationMode.IMAGES_ONLY); +settings.setAnonymizationMode(IdAnonymizationMode.IMAGES_ONLY); // No anonymization: -settings.setAnyonymizationMode(IdAnonymizationMode.NONE); +settings.setAnonymizationMode(IdAnonymizationMode.NONE); ``` ## ID Images @@ -57,13 +57,13 @@ For the full frame of the document, you can use [`setShouldPassImageTypeToResult ```java // Holder's picture as printed on a document: -settings.setShouldPassImageTypeToResult(ImageType.FACE); +settings.setShouldPassImageTypeToResult(IdImageType.FACE, true); // Cropped image of a document: -settings.setShouldPassImageTypeToResult(ImageType.CROPPED_DOCUMENT); +settings.setShouldPassImageTypeToResult(IdImageType.CROPPED_DOCUMENT, true); // Full camera frame that contains the document: -settings.setShouldPassImageTypeToResult(ImageType.FULL_FRAME); +settings.setShouldPassImageTypeToResult(IdImageType.FRAME, true); ``` ## Callbacks and Scanning Workflows diff --git a/versioned_docs/version-7.6.7/sdks/android/id-capture/get-started.md b/versioned_docs/version-7.6.7/sdks/android/id-capture/get-started.md index 0ae21a81..adb1a37d 100644 --- a/versioned_docs/version-7.6.7/sdks/android/id-capture/get-started.md +++ b/versioned_docs/version-7.6.7/sdks/android/id-capture/get-started.md @@ -101,37 +101,37 @@ By default, [anonymized data](./advanced.md#configure-data-anonymization) is not ::: ```java -List acceptedDocuments = new ArrayList(); -List rejectedDocuments = new ArrayList(); +List acceptedDocuments = new ArrayList<>(); +List rejectedDocuments = new ArrayList<>(); // Documents from any region: -acceptedDocuments.add(new IdCard(Region.AnyRegion)); +acceptedDocuments.add(new IdCard(IdCaptureRegion.ANY)); // Only documents issued by a specific country: -acceptedDocuments.add(new IdCard(Region.Germany)); +acceptedDocuments.add(new IdCard(IdCaptureRegion.GERMANY)); // Regional documents: -acceptedDocuments.add(new RegionSpecific.ApecBusinessTravelCard()); +acceptedDocuments.add(new RegionSpecific(RegionSpecificSubtype.APEC_BUSINESS_TRAVEL_CARD)); // Reject passports from certain regions: -rejectedDocuments.add(new Passport(Region.Cuba)); +rejectedDocuments.add(new Passport(IdCaptureRegion.CUBA)); IdCaptureSettings settings = new IdCaptureSettings(); -settings.acceptedDocuments = acceptedDocuments; -settings.rejectedDocuments = rejectedDocuments; +settings.setAcceptedDocuments(acceptedDocuments); +settings.setRejectedDocuments(rejectedDocuments); // To scan only one-sided documents and a given zone: -settings.scannerType = new SingleSideScanner(barcode = true); -// or -settings.scannerType = new SingleSideScanner(machineReadableZone = true); -// or -settings.scannerType = new SingleSideScanner(visualInspectionZone = true); +settings.setScannerType(new SingleSideScanner( + true, // barcode + true, // machineReadableZone + true // visualInspectionZone +)); // To scan both sides of the document: -settings.scannerType = new FullDocumentScanner(); +settings.setScannerType(new FullDocumentScanner()); ``` Create a new ID Capture mode with the chosen settings: ```java -IdCapture idCapture = IdCapture.forDataCaptureContext(context, settings); +IdCapture idCapture = IdCapture.forDataCaptureContext(dataCaptureContext, settings); ``` ## Implement a Listener @@ -139,19 +139,19 @@ IdCapture idCapture = IdCapture.forDataCaptureContext(context, settings); To receive scan results, implement and [IdCaptureListener](https://docs.scandit.com/7.6/data-capture-sdk/android/id-capture/api/id-capture-listener.html#interface-scandit.datacapture.id.IIdCaptureListener). The listener provides two callbacks: `onIdCaptured` and `onIdRejected`. ```java -IdCaptureListener listener = new IdCaptureListner() { +IdCaptureListener listener = new IdCaptureListener() { @Override - public void onIdCaptured(CapturedId data) { - // Success! Handle extracted data here. -} + public void onIdCaptured(@NonNull IdCapture idCapture, @NonNull CapturedId capturedId) { + // Success! Handle extracted data here. + } @Override - public void onIdRejected(CapturedId data, RejectionReason reason) { - // Something went wrong. Inspect the reason to determine the follow-up action. + public void onIdRejected(@NonNull IdCapture idCapture, @Nullable CapturedId capturedId, @NonNull RejectionReason rejectionReason) { + // Something went wrong. Inspect the reason to determine the follow-up action. } -} +}; -idCapture.setListener(listener); +idCapture.addListener(listener); ``` ### Handling Success @@ -164,14 +164,14 @@ On a successful scan you may read the extracted data from `CapturedId`: ```java @Override -public void onIdCaptured(CapturedId data) { - String fullName = data.getFullName(); - DateResult dateOfBirth = data.getDateOfBirth(); - DateResult dateOfExpiry = data.getDateOfExpiry(); - String documentNumber = data.getDocumentNumber(); +public void onIdCaptured(@NonNull IdCapture idCapture, @NonNull CapturedId capturedId) { + String fullName = capturedId.getFullName(); + DateResult dateOfBirth = capturedId.getDateOfBirth(); + DateResult dateOfExpiry = capturedId.getDateOfExpiry(); + String documentNumber = capturedId.getDocumentNumber(); // Process data: - processData(fullName, dateOfBirth, dateOfExpiry, documentNumber); + processData(fullName, dateOfBirth, dateOfExpiry, documentNumber); } ``` :::tip @@ -186,14 +186,14 @@ You may wish to implement the follow-up action based on the reason of failure: ```java @Override -public void onIdRejected(CapturedId data, RejectionReason reason) { - if (reason == RejectionReason.Timeout) { - // Ask the user to retry, or offer alternative input method. - } else if (reason == RejectionReason.DocumentExpired) { - // Ask the user to provide alternative document. - } else if (reason == RejectionReason.HolderUnderage) { - // Reject the process. - } +public void onIdRejected(@NonNull IdCapture idCapture, @Nullable CapturedId capturedId, @NonNull RejectionReason rejectionReason) { + if (rejectionReason == RejectionReason.TIMEOUT) { + // Ask the user to retry, or offer alternative input method. + } else if (rejectionReason == RejectionReason.DOCUMENT_EXPIRED) { + // Ask the user to provide alternative document. + } else if (rejectionReason == RejectionReason.HOLDER_UNDERAGE) { + // Reject the process. + } } ``` diff --git a/versioned_docs/version-7.6.7/sdks/android/label-capture/advanced.md b/versioned_docs/version-7.6.7/sdks/android/label-capture/advanced.md index b05dd74d..a2654bc0 100644 --- a/versioned_docs/version-7.6.7/sdks/android/label-capture/advanced.md +++ b/versioned_docs/version-7.6.7/sdks/android/label-capture/advanced.md @@ -63,29 +63,35 @@ overlay.setListener(new LabelCaptureBasicOverlayListener() { @Nullable @Override public Brush brushForLabel( - @NonNull LabelCaptureBasicOverlay overlay, @NonNull CapturedLabel label) { + @NonNull LabelCaptureBasicOverlay overlay, + @NonNull CapturedLabel label + ) { return null; } + @Nullable @Override - public Brush brushForField(@NonNull LabelCaptureBasicOverlay overlay, - @NonNull CapturedField field, @NonNull CapturedLabel label) { + public Brush brushForField( + @NonNull LabelCaptureBasicOverlay overlay, + @NonNull LabelField field, + @NonNull CapturedLabel label + ) { if (field.getName().equals("")) { return new Brush( - getResources().getColor(R.color.barcode_overlay_fill), - getResources().getColor(R.color.barcode_overlay_stroke), - 0f + getResources().getColor(R.color.barcode_overlay_fill), + getResources().getColor(R.color.barcode_overlay_stroke), + 0f ); - } - + } + if (field.getName().equals("")) { return new Brush( - getResources().getColor(R.color.expiry_date_overlay_fill), - getResources().getColor(R.color.expiry_date_overlay_stroke), - 0f + getResources().getColor(R.color.expiry_date_overlay_fill), + getResources().getColor(R.color.expiry_date_overlay_stroke), + 0f ); - } - + } + return null; } }); @@ -191,40 +197,51 @@ advancedOverlay.listener = object : LabelCaptureAdvancedOverlayListener { // Create an advanced overlay that allows for custom views to be added over detected label fields // This is the key component for implementing Augmented Reality features LabelCaptureAdvancedOverlay advancedOverlay = LabelCaptureAdvancedOverlay.newInstance( - dataCaptureManager.getLabelCapture(), view); + labelCapture, dataCaptureView); // Configure the advanced overlay with a listener that handles AR content creation and positioning advancedOverlay.setListener(new LabelCaptureAdvancedOverlayListener() { @Nullable @Override - public View viewForCapturedLabel(@NonNull LabelCaptureAdvancedOverlay overlay, - @NonNull CapturedLabel capturedLabel) { + public View viewForCapturedLabel( + @NonNull LabelCaptureAdvancedOverlay overlay, + @NonNull CapturedLabel capturedLabel + ) { // We return null since we're only adding AR elements to specific fields, not the entire label return null; } @NonNull @Override - public Anchor anchorForCapturedLabel(@NonNull LabelCaptureAdvancedOverlay overlay, - @NonNull CapturedLabel capturedLabel) { + public Anchor anchorForCapturedLabel( + @NonNull LabelCaptureAdvancedOverlay overlay, + @NonNull CapturedLabel capturedLabel + ) { // This defines where on the detected label the AR view would be anchored return Anchor.CENTER; } @NonNull @Override - public PointWithUnit offsetForCapturedLabel(@NonNull LabelCaptureAdvancedOverlay overlay, - @NonNull CapturedLabel capturedLabel, - @NonNull View view) { + public PointWithUnit offsetForCapturedLabel( + @NonNull LabelCaptureAdvancedOverlay overlay, + @NonNull CapturedLabel capturedLabel, + @NonNull View view + ) { // This defines the offset from the anchor point for the label's AR view - return new PointWithUnit(0f, 0f, MeasureUnit.PIXEL); + return new PointWithUnit( + new FloatWithUnit(0f, MeasureUnit.PIXEL), + new FloatWithUnit(0f, MeasureUnit.PIXEL) + ); } @Nullable @Override - public View viewForCapturedLabelField(@NonNull LabelCaptureAdvancedOverlay overlay, - @NonNull LabelField labelField) { + public View viewForCapturedLabelField( + @NonNull LabelCaptureAdvancedOverlay overlay, + @NonNull LabelField labelField + ) { // We only want to create AR elements for expiry date fields that are text-based if (labelField.getName().toLowerCase().contains("expiry") && labelField.getType() == LabelFieldType.TEXT) { @@ -234,7 +251,7 @@ advancedOverlay.setListener(new LabelCaptureAdvancedOverlayListener() { // // Assume we have a method `daysUntilExpiry()` that returns the days left until expiry - int daysUntilExpiry = daysUntilExpiry(labelField.getValue()); + int daysUntilExpiry = daysUntilExpiry(labelField.getText()); int dayLimit = 3; // Example threshold if (daysUntilExpiry < dayLimit) { @@ -263,19 +280,26 @@ advancedOverlay.setListener(new LabelCaptureAdvancedOverlayListener() { @NonNull @Override - public Anchor anchorForCapturedLabelField(@NonNull LabelCaptureAdvancedOverlay overlay, - @NonNull LabelField labelField) { + public Anchor anchorForCapturedLabelField( + @NonNull LabelCaptureAdvancedOverlay overlay, + @NonNull LabelField labelField + ) { // BOTTOM_CENTER places it right below the expiry date text for better visibility return Anchor.BOTTOM_CENTER; } @NonNull @Override - public PointWithUnit offsetForCapturedLabelField(@NonNull LabelCaptureAdvancedOverlay overlay, - @NonNull LabelField labelField, - @NonNull View view) { + public PointWithUnit offsetForCapturedLabelField( + @NonNull LabelCaptureAdvancedOverlay overlay, + @NonNull LabelField labelField, + @NonNull View view + ) { // This defines the offset from the anchor point - return new PointWithUnit(0f, 22f, MeasureUnit.DIP); + return new PointWithUnit( + new FloatWithUnit(0f, MeasureUnit.DIP), + new FloatWithUnit(22f, MeasureUnit.DIP) + ); } }); ``` @@ -312,8 +336,8 @@ validationFlowOverlay?.listener = this // Create the overlay validationFlowOverlay = LabelCaptureValidationFlowOverlay.newInstance( getContext(), - dataCaptureManager.getLabelCapture(), - view + labelCapture, + dataCaptureView ); // Set the listener to receive validation events validationFlowOverlay.setListener(this); @@ -349,18 +373,12 @@ validationFlowOverlay?.applySettings(validationSettings) // Configure the validation flow with custom settings LabelCaptureValidationFlowSettings validationSettings = LabelCaptureValidationFlowSettings.newInstance(); -validationSettings.setMissingFieldsHintText("Please add this field"); validationSettings.setStandbyHintText("No label detected, camera paused"); validationSettings.setValidationHintText("fields captured"); // X/Y (X fields out of total Y) is shown in front of this string validationSettings.setValidationErrorText("Input not valid"); -validationSettings.setRequiredFieldErrorText("This field is required"); -validationSettings.setManualInputButtonText("Add info manually"); // Apply the settings to the overlay -if (validationFlowOverlay != null) { - validationFlowOverlay.applySettings(validationSettings); -} - +validationFlowOverlay.applySettings(validationSettings); ``` diff --git a/versioned_docs/version-7.6.7/sdks/android/label-capture/get-started.md b/versioned_docs/version-7.6.7/sdks/android/label-capture/get-started.md index fe670fea..9c12d5c3 100644 --- a/versioned_docs/version-7.6.7/sdks/android/label-capture/get-started.md +++ b/versioned_docs/version-7.6.7/sdks/android/label-capture/get-started.md @@ -94,28 +94,27 @@ LabelCaptureSettings settings = LabelCaptureSettings.builder() .addLabel() /* * Add a barcode field with the expected symbologies and pattern. - * You can omit the pattern if the content of the barcode is unknown. + * You can omit the pattern if the content of the barcode is unknown. */ .addCustomBarcode() .setSymbologies(Symbology.EAN13_UPCA, Symbology.CODE128) - .setPattern("\\d{12,14}") .buildFluent("") .buildFluent("") .build(); /* - * Create the label capture mode with the settings and data capture context created earlier. - */ -LabelCapture labelCapture = LabelCapture.forDataCaptureContext(dataCaptureContext, settings) +* Create the label capture mode with the settings and data capture context created earlier. +*/ +LabelCapture labelCapture = LabelCapture.forDataCaptureContext(dataCaptureContext, settings); ``` diff --git a/versioned_docs/version-7.6.7/sdks/android/matrixscan-count/advanced.md b/versioned_docs/version-7.6.7/sdks/android/matrixscan-count/advanced.md index d14dfe6f..61f9266d 100644 --- a/versioned_docs/version-7.6.7/sdks/android/matrixscan-count/advanced.md +++ b/versioned_docs/version-7.6.7/sdks/android/matrixscan-count/advanced.md @@ -65,7 +65,7 @@ For example, you might want to scan only Code 128 barcodes and no PDF417 barcode ```java BarcodeCountSettings settings = new BarcodeCountSettings(); -barcodeCountSettings.enableSymbologies(enabledSymbologies); +settings.enableSymbologies(enabledSymbologies); Set excludedSymbologies = new HashSet<>(); excludedSymbologies.add(Symbology.PDF417); @@ -105,15 +105,13 @@ The methods [BarcodeCountViewListener.brushForRecognizedBarcode()](https://docs. ```java @Nullable @Override -public Brush brushForRecognizedBarcode( - @NonNull BarcodeCountView view, @NonNull TrackedBarcode trackedBarcode) { +public Brush brushForRecognizedBarcode(@NonNull BarcodeCountView view, @NonNull TrackedBarcode trackedBarcode) { // Return a custom brush } @Nullable @Override -public Brush brushForUnrecognizedBarcode( - @NonNull BarcodeCountView view, @NonNull TrackedBarcode trackedBarcode) { +public Brush brushForRecognizedBarcodeNotInList(@NonNull BarcodeCountView view, @NonNull TrackedBarcode trackedBarcode) { // Return a custom brush } ``` @@ -125,13 +123,17 @@ If you want to be notified when a user taps on an overlay, you need to implement ```java @Override public void onRecognizedBarcodeTapped( - @NonNull BarcodeCountView view, @NonNull TrackedBarcode trackedBarcode) { + @NonNull BarcodeCountView view, + @NonNull TrackedBarcode trackedBarcode +) { // Do something with the tapped barcode } @Override -public void onUnrecognizedBarcodeTapped( - @NonNull BarcodeCountView view, @NonNull TrackedBarcode trackedBarcode) { +public void onRecognizedBarcodeNotInListTapped( + @NonNull BarcodeCountView view, + @NonNull TrackedBarcode trackedBarcode +) { // Do something with the tapped barcode } ``` diff --git a/versioned_docs/version-7.6.7/sdks/android/matrixscan-count/get-started.md b/versioned_docs/version-7.6.7/sdks/android/matrixscan-count/get-started.md index 20174d2e..26059010 100644 --- a/versioned_docs/version-7.6.7/sdks/android/matrixscan-count/get-started.md +++ b/versioned_docs/version-7.6.7/sdks/android/matrixscan-count/get-started.md @@ -67,7 +67,7 @@ settings.setSymbologyEnabled(Symbology.EAN13_UPCA, true); Next, create a `BarcodeCount` instance with the Data Capture Context and the settings initialized in the previous step: ```java -BarcodeCount barcodeCount = BarcodeCount.forDataCaptureContext(context, settings); +BarcodeCount barcodeCount = BarcodeCount.forDataCaptureContext(dataCaptureContext, settings); ``` ## Camera Instance And Set Frame Source @@ -77,8 +77,7 @@ Our recommended camera settings should be used to achieve the best performance a ```java CameraSettings cameraSettings = BarcodeCount.createRecommendedCameraSettings(); -Camera camera = Camera.getDefaultCamera(); -camera.applySettings(cameraSettings); +Camera camera = Camera.getDefaultCamera(cameraSettings); ``` Because the frame source is configurable the data capture context must be told which frame source to use. This is done with a call to [`DataCaptureContext.setFrameSource()`](https://docs.scandit.com/7.6/data-capture-sdk/android/core/api/data-capture-context.html#method-scandit.datacapture.core.DataCaptureContext.SetFrameSourceAsync): @@ -105,7 +104,7 @@ MatrixScan Count’s built-in AR user interface includes buttons and overlays th Add a `BarcodeCountView` to your view hierarchy: ```java -BarcodeCountView view = BarcodeCountView.newInstance(barcodeCount, captureView); +BarcodeCountView view = BarcodeCountView.newInstance(context, dataCaptureView, barcodeCount); ``` ## Configuring the Camera for Scanning View @@ -141,7 +140,7 @@ public void onScan( @NonNull BarcodeCountSession session, @NonNull FrameData data ) { - allRecognizedBarcodes = session.getRecognizedBarcodes().values(); + List allRecognizedBarcodes = session.getRecognizedBarcodes(); } ``` @@ -152,7 +151,7 @@ When the scanning process is over, you need to reset the mode to make it ready f To reset Barcode Count’s scanning process, call the `BarcodeCount.reset` method: ```java -barcodeCount.reset() +barcodeCount.reset(); ``` ## List and Exit Callbacks diff --git a/versioned_docs/version-7.6.7/sdks/android/matrixscan-find/advanced.md b/versioned_docs/version-7.6.7/sdks/android/matrixscan-find/advanced.md index 02bfc162..17412f3f 100644 --- a/versioned_docs/version-7.6.7/sdks/android/matrixscan-find/advanced.md +++ b/versioned_docs/version-7.6.7/sdks/android/matrixscan-find/advanced.md @@ -19,7 +19,7 @@ You may want more fine-grained knowledge over the different events happening dur To do this, you can directly register a [`BarcodeFindListener`](https://docs.scandit.com/7.6/data-capture-sdk/android/barcode-capture/api/barcode-find-listener.html#interface-scandit.datacapture.barcode.find.IBarcodeFindListener) on the mode itself, keeping in mind that these listeners are called from a background thread. ```java -mode.addListener(new BarcodeFindListener() { +barcodeFind.addListener(new BarcodeFindListener() { @Override public void onSearchPaused(@NonNull Set foundItems) { // The mode was paused @@ -55,7 +55,7 @@ class Transformer implements BarcodeFindTransformer { Then the transformer needs to be set so it can be used by MatrixScan Find: ```java -barcodeFind.setBarcodeTransformer(new Transformer()) +barcodeFind.setTransformer(new Transformer()); ``` ## UI Customization diff --git a/versioned_docs/version-7.6.7/sdks/android/matrixscan-find/get-started.md b/versioned_docs/version-7.6.7/sdks/android/matrixscan-find/get-started.md index 56c0ed5e..1b1b7195 100644 --- a/versioned_docs/version-7.6.7/sdks/android/matrixscan-find/get-started.md +++ b/versioned_docs/version-7.6.7/sdks/android/matrixscan-find/get-started.md @@ -67,24 +67,24 @@ Next, create the list of items that will be actively searched for. We will also ```java Set items = new HashSet<>(); items.add( - new BarcodeFindItem( - new BarcodeFindItemSearchOptions("9783598215438"), - new BarcodeFindItemContent("Mini Screwdriver Set", "(6-Piece)", null) - ) + new BarcodeFindItem( + new BarcodeFindItemSearchOptions("9783598215438"), + new BarcodeFindItemContent("Mini Screwdriver Set", "(6-Piece)", null) + ) ); items.add( - new BarcodeFindItem( - new BarcodeFindItemSearchOptions("9783598215414"), - null // Item information is optional, used for display only - ) + new BarcodeFindItem( + new BarcodeFindItemSearchOptions("9783598215414"), + null // Item information is optional, used for display only + ) ); ``` Finally, create a `BarcodeFind` instance with the Data Capture Context and the settings initialized in the previous step: ```java -BarcodeFind mode = new BarcodeFind(settings); -mode.setItemList(items); +BarcodeFind barcodeFind = new BarcodeFind(settings); +barcodeFind.setItemList(items); ``` ## Setup the `BarcodeFindView` @@ -94,17 +94,18 @@ MatrixScan Find’s built-in AR user interface includes buttons and overlays tha The `BarcodeFindView` appearance can be customized through [`BarcodeFindViewSettings`](https://docs.scandit.com/7.6/data-capture-sdk/android/barcode-capture/api/ui/barcode-find-view-settings.html#class-scandit.datacapture.barcode.find.ui.BarcodeFindViewSettings) to match your application’s look and feel. For example, you can change the color of the dots that are overlaid on top of the items that are found and enable sound and haptic alerts. ```java -BarcodeFindViewSettings viewSettings = new BarcodeFindViewSettings(); -viewSettings.inListItemColor = .green -viewSettings.notInListItemColor = .red -viewSettings.soundEnabled = true -viewSettings.hapticEnabled = true +BarcodeFindViewSettings viewSettings = new BarcodeFindViewSettings( + Color.GREEN, // inListItemColor + Color.RED, // notInListItemColor + true, // soundEnabled + true // hapticEnabled +); ``` Next, create a `BarcodeFindView` instance with the Data Capture Context and the settings initialized in the previous step. The `BarcodeFindView` is automatically added to the provided parent view. ```java -BarcodeFindView barcodeFindView = BarcodeFindView.newInstance(parentView, dataCaptureContext, mode, viewSettings); +BarcodeFindView barcodeFindView = BarcodeFindView.newInstance(parentView, dataCaptureContext, barcodeFind, viewSettings); ``` Connect the `BarcodeFindView` to the Android lifecycle. The view is dependent on calling `BarcodeFindView.onPause()` and `BarcodeFindView.onResume()` to set up the camera and its overlays properly. diff --git a/versioned_docs/version-7.6.7/sdks/android/matrixscan-pick/advanced.md b/versioned_docs/version-7.6.7/sdks/android/matrixscan-pick/advanced.md index e669730f..653ac122 100644 --- a/versioned_docs/version-7.6.7/sdks/android/matrixscan-pick/advanced.md +++ b/versioned_docs/version-7.6.7/sdks/android/matrixscan-pick/advanced.md @@ -17,7 +17,7 @@ MatrixScan Pick is optimized by default for efficiency, accuracy, and a seamless You can register a [`BarcodePickListener`](https://docs.scandit.com/7.6/data-capture-sdk/android/barcode-capture/api/ui/barcode-pick-listener.html) on the mode, which can be used to get updates about the scanned items with each frame. ```java -mode.addListener(new BarcodePickListener() { +barcodePick.addListener(new BarcodePickListener() { @Override public void onSessionUpdated(@NonNull BarcodePick barcodePick, @NonNull BarcodePickSession session) { // This callback will be invoked on a background thread every frame. the session object contains @@ -37,7 +37,7 @@ mode.addListener(new BarcodePickListener() { You can register a [`BarcodePickScanningListener`](https://docs.scandit.com/7.6/data-capture-sdk/android/barcode-capture/api/barcode-pick-scanning-listener.html) on the mode, which can be used to listen to every time the pick state changes. ```java -mode.addScanningListener(new BarcodePickScanningListener() { +barcodePick.addScanningListener(new BarcodePickScanningListener() { @Override public void onScanningSessionUpdated(@NonNull BarcodePick barcodePick, @NonNull BarcodePickScanningSession session) { // This callback will be invoked on a background thread every time the picked state of some item changes. diff --git a/versioned_docs/version-7.6.7/sdks/android/matrixscan/advanced.md b/versioned_docs/version-7.6.7/sdks/android/matrixscan/advanced.md index 09f6ddcf..d5066258 100644 --- a/versioned_docs/version-7.6.7/sdks/android/matrixscan/advanced.md +++ b/versioned_docs/version-7.6.7/sdks/android/matrixscan/advanced.md @@ -55,10 +55,11 @@ For this option, keep in mind that: @Nullable @Override public View viewForTrackedBarcode( - @NotNull BarcodeBatchAdvancedOverlay overlay, - @NotNull TrackedBarcode trackedBarcode + @NonNull BarcodeBatchAdvancedOverlay overlay, + @NonNull TrackedBarcode trackedBarcode ) { - // Create and return the view you want to show for this tracked barcode. You can also return null, to have no view for this barcode. + // Create and return the view you want to show for this tracked barcode. + // You can also return null, to have no view for this barcode. TextView textView = new TextView(this); textView.setBackgroundColor(Color.WHITE); textView.setLayoutParams( @@ -71,23 +72,23 @@ public View viewForTrackedBarcode( return textView; } -@NotNull +@NonNull @Override public Anchor anchorForTrackedBarcode( - @NotNull BarcodeBatchAdvancedOverlay overlay, - @NotNull TrackedBarcode trackedBarcode + @NonNull BarcodeBatchAdvancedOverlay overlay, + @NonNull TrackedBarcode trackedBarcode ) { // As we want the view to be above the barcode, we anchor the view's center to the top-center of the barcode quadrilateral. // Use the function 'offsetForTrackedBarcode' below to adjust the position of the view by providing an offset. return Anchor.TOP_CENTER; } -@NotNull +@NonNull @Override public PointWithUnit offsetForTrackedBarcode( - @NotNull BarcodeBatchAdvancedOverlay overlay, - @NotNull TrackedBarcode trackedBarcode, - @NotNull View view + @NonNull BarcodeBatchAdvancedOverlay overlay, + @NonNull TrackedBarcode trackedBarcode, + @NonNull View view ) { // This is the offset that will be applied to the view. // You can use MeasureUnit.FRACTION to give a measure relative to the view itself, the sdk will take care of transforming this into pixel size. @@ -113,38 +114,35 @@ From here you can create the view you want to display, and then call: @Override public void onSessionUpdated( @NonNull BarcodeBatch mode, - @NonNull final BarcodeBatchSession session, + @NonNull BarcodeBatchSession session, @NonNull FrameData data ) { - // Be careful, this function is not invoked on the main thread! - runOnUiThread(new Runnable() { - @Override - public void run() { - for (TrackedBarcode trackedBarcode : session.getAddedTrackedBarcodes()) { - TextView textView = new TextView(this); - textView.setBackgroundColor(Color.WHITE); - textView.setLayoutParams( - new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.WRAP_CONTENT, - ViewGroup.LayoutParams.WRAP_CONTENT - ) - ); - textView.setText(trackedBarcode.getBarcode().getData()); - overlay.setViewForTrackedBarcode(trackedBarcode, textView); - overlay.setAnchorForTrackedBarcode( - trackedBarcode, Anchor.TOP_CENTER - ); - overlay.setOffsetForTrackedBarcode( - trackedBarcode, - new PointWithUnit( - new FloatWithUnit(0f, MeasureUnit.FRACTION), - new FloatWithUnit(-1f, MeasureUnit.FRACTION) - ) - ); - } - } - }); - } + // Be careful, this function is not invoked on the main thread! + runOnUiThread(() -> { + for (TrackedBarcode trackedBarcode : session.getAddedTrackedBarcodes()) { + TextView textView = new TextView(this); + textView.setBackgroundColor(Color.WHITE); + textView.setLayoutParams( + new ViewGroup.LayoutParams( + ViewGroup.LayoutParams.WRAP_CONTENT, + ViewGroup.LayoutParams.WRAP_CONTENT + ) + ); + textView.setText(trackedBarcode.getBarcode().getData()); + overlay.setViewForTrackedBarcode(trackedBarcode, textView); + overlay.setAnchorForTrackedBarcode( + trackedBarcode, Anchor.TOP_CENTER + ); + overlay.setOffsetForTrackedBarcode( + trackedBarcode, + new PointWithUnit( + new FloatWithUnit(0f, MeasureUnit.FRACTION), + new FloatWithUnit(-1f, MeasureUnit.FRACTION) + ) + ); + } + }); +} ``` ## Using Custom Implementations @@ -163,32 +161,28 @@ The frame coordinates from `TrackedBarcode.location` need to be mapped to view c ```java @Override - public void onSessionUpdated( - @NonNull BarcodeBatch mode, - @NonNull final BarcodeBatchSession session, - @NonNull FrameData data - ) { - // Be careful, this function is not invoked on the main thread! - runOnUiThread(new Runnable() { - @Override - public void run() { - - for (int lostTrackIdentifier : session.getRemovedTrackedBarcodes()) { - // You now know the identifier of the tracked barcode that has been lost. Usually here you would remove the views associated. - } - - for (TrackedBarcode trackedBarcode : session.getAddedTrackedBarcodes()) { - - // Fixed identifier for the tracked barcode. - Integer trackingIdentifier = trackedBarcode.getIdentifier(); - - // Current location of the tracked barcode. - Quadrilateral location = trackedBarcode.getLocation(); - Quadrilateral quadrilateral = dataCaptureView.mapFrameQuadrilateralToView(location); - - // You now know this new tracking's identifier and location. Usually here you would create and show the views. - } - } - }); - } +public void onSessionUpdated( + @NonNull BarcodeBatch mode, + @NonNull final BarcodeBatchSession session, + @NonNull FrameData data +) { + // Be careful, this function is not invoked on the main thread! + runOnUiThread(() -> { + for (int lostTrackIdentifier : session.getRemovedTrackedBarcodes()) { + // You now know the identifier of the tracked barcode that has been lost. Usually here you would remove the views associated. + } + + for (TrackedBarcode trackedBarcode : session.getAddedTrackedBarcodes()) { + + // Fixed identifier for the tracked barcode. + Integer trackingIdentifier = trackedBarcode.getIdentifier(); + + // Current location of the tracked barcode. + Quadrilateral location = trackedBarcode.getLocation(); + Quadrilateral quadrilateral = dataCaptureView.mapFrameQuadrilateralToView(location); + + // You now know this new tracking's identifier and location. Usually here you would create and show the views. + } + }); +} ``` diff --git a/versioned_docs/version-7.6.7/sdks/android/matrixscan/get-started.md b/versioned_docs/version-7.6.7/sdks/android/matrixscan/get-started.md index 8d299830..1d474e62 100644 --- a/versioned_docs/version-7.6.7/sdks/android/matrixscan/get-started.md +++ b/versioned_docs/version-7.6.7/sdks/android/matrixscan/get-started.md @@ -128,9 +128,12 @@ BarcodeBatchBasicOverlay overlay = BarcodeBatchBasicOverlay.newInstance(barcodeB Once the overlay has been added, you must conform to the [BarcodeBatchBasicOverlayListener](https://docs.scandit.com/7.6/data-capture-sdk/android/barcode-capture/api/ui/barcode-batch-basic-overlay-listener.html#interface-scandit.datacapture.barcode.batch.ui.IBarcodeBatchBasicOverlayListener) interface. The method [BarcodeBatchBasicOverlayListener.brushForTrackedBarcode()](https://docs.scandit.com/7.6/data-capture-sdk/android/barcode-capture/api/ui/barcode-batch-basic-overlay-listener.html#method-scandit.datacapture.barcode.batch.ui.IBarcodeBatchBasicOverlayListener.BrushForTrackedBarcode) is invoked every time a new tracked barcode appears and it can be used to set a brush used to highlight that specific barcode in the [overlay](https://docs.scandit.com/7.6/data-capture-sdk/android/barcode-capture/api/ui/barcode-batch-basic-overlay.html#class-scandit.datacapture.barcode.batch.ui.BarcodeBatchBasicOverlay). ```java +@Nullable @Override -public Brush brushForTrackedBarcode(@NonNull BarcodeBatchBasicOverlay overlay, - @NonNull TrackedBarcode trackedBarcode) { +public Brush brushForTrackedBarcode( + @NonNull BarcodeBatchBasicOverlay overlay, + @NonNull TrackedBarcode trackedBarcode +) { // Return a custom Brush based on the tracked barcode. } ``` @@ -139,8 +142,10 @@ If you want to make the highlights tappable, you need to implement the [BarcodeB ```java @Override -public void onTap(@NonNull BarcodeBatchBasicOverlay overlay, - @NonNull TrackedBarcode trackedBarcode) { +public void onTrackedBarcodeTapped( + @NonNull BarcodeBatchBasicOverlay overlay, + @NonNull TrackedBarcode trackedBarcode +) { // A tracked barcode was tapped. } ``` @@ -154,33 +159,32 @@ Here, we use the default [Feedback](https://docs.scandit.com/7.6/data-capture-sd First, we create a feedback and release it after it is no longer used, to avoid resources being unnecessarily held. ```java -override func viewDidLoad() { - super.viewDidLoad() - feedback = Feedback.default -} +Feedback feedback = Feedback.defaultFeedback(); ``` Next, use this `feedback` in a `BarcodeBatchListener`: ```java public class FeedbackListener implements BarcodeBatchListener { + Feedback feedback = Feedback.defaultFeedback(); + @Override - public void onObservationStarted(@NotNull BarcodeBatch barcodeBatch) { + public void onObservationStarted(@NonNull BarcodeBatch barcodeBatch) { // Called when Barcode Batch is started. // We don't use this callback in this guide. } @Override - public void onObservationStopped(@NotNull BarcodeBatch barcodeBatch) { + public void onObservationStopped(@NonNull BarcodeBatch barcodeBatch) { // Called when Barcode Batch is stopped. // We don't use this callback in this guide. } @Override public void onSessionUpdated( - @NotNull BarcodeBatch mode, - @NotNull BarcodeBatchSession session, - @NotNull FrameData data + @NonNull BarcodeBatch mode, + @NonNull BarcodeBatchSession session, + @NonNull FrameData data ) { if (!session.getAddedTrackedBarcodes().isEmpty()) { feedback.emit(); @@ -194,7 +198,7 @@ public class FeedbackListener implements BarcodeBatchListener { As the last step, register the listener responsible for emitting the feedback with the `BarcodeBatch` instance. ```java -barcodeBatch.addListener(feedbackListener); +barcodeBatch.addListener(new FeedbackListener()); ``` ## Disable Barcode Batch diff --git a/versioned_docs/version-7.6.7/sdks/android/sparkscan/get-started.md b/versioned_docs/version-7.6.7/sdks/android/sparkscan/get-started.md index 04d95ba4..bc698ac2 100644 --- a/versioned_docs/version-7.6.7/sdks/android/sparkscan/get-started.md +++ b/versioned_docs/version-7.6.7/sdks/android/sparkscan/get-started.md @@ -129,15 +129,15 @@ public void onBarcodeScanned( @NonNull SparkScan sparkScan, @NonNull SparkScanSession session, @Nullable FrameData data ) { // Gather the recognized barcode - Barcode barcode = session.getNewlyRecognizedBarcode().get(0); + Barcode barcode = session.getNewlyRecognizedBarcode(); // This method is invoked from a recognition internal thread. // Run the specified action in the UI thread to update the internal barcode list. runOnUiThread(() -> { // Update the internal list and the UI with the barcode retrieved above - this.latestBarcode = barcode + this.latestBarcode = barcode; }); - } +} ``` ## Scan Some Barcodes