SparkScan View

Defined in package com.scandit.datacapture.barcode.spark.ui

SparkScanScanningBehavior

Added in version 6.15.0

The capture mode type of the SparkScanView.

SINGLE

Added in version 6.15.0

Barcode capturing session is stopped after each scan.

CONTINUOUS

Added in version 6.15.0

Keeps the barcode capturing session active for longer time.

SparkScanPreviewBehavior

Added in version 6.23.0

The preview behavior type of the SparkScanView.

DEFAULT

Added in version 6.23.0

After a scan with scanning behavior SparkScanScanningBehavior.SINGLE, or stopping scanning with scanning behavior SparkScanScanningBehavior.CONTINUOUS, camera moves to standby state and preview is hidden for maximum efficiency.

PERSISTENT

Added in version 6.23.0

After a scan with scanning behavior SparkScanScanningBehavior.SINGLE, or stopping scanning with scanning behavior SparkScanScanningBehavior.CONTINUOUS, camera stays active and preview is visible for maximum precision.

SparkScanViewHandMode

Added in version 6.15.0

The hand mode type of the SparkScanView.

Deprecated since version 7.0: Hand mode is no longer supported. The trigger button can now be placed anywhere on the screen.

RIGHT

Added in version 6.15.0

Optimizes the layout for right-hand use of the SparkScanView.

LEFT

Added in version 6.15.0

Optimizes the layout for left-hand use of the SparkScanView.

SparkScanMiniPreviewSize

Added in version 7.0.0

The size of the mini preview in SparkScanView. Used in SparkScanViewSettings.defaultMiniPreviewSize.

REGULAR

Added in version 7.0.0

Regular, smaller size of the mini preview.

EXPANDED

Added in version 7.0.0

Expanded, larger size of the mini preview.

SparkScanViewState

Added in version 7.0.0

The view state of SparkScanView.

INITIAL

Added in version 7.0.0

The initial view state for a few moments after SparkScanView is created.

IDLE

Added in version 7.0.0

SparkScan is displaying only the collapsed capture button.

INACTIVE

Added in version 7.0.0

SparkScan is displaying an expanded capture button, and if the SparkScanPreviewBehavior of the current SparkScanScanningMode is SparkScanPreviewBehavior.PERSISTENT, we are also displaying camera feed through the mini preview but no actual scanning is taking place. This state is reachable after scanning or after a SparkScanViewSettings.inactiveStateTimeout timeout.

ACTIVE

Added in version 7.0.0

We are actively recognising barcodes, mini preview and expanded capture button are visible.

ERROR

Added in version 7.0.0

User returns SparkScanBarcodeFeedback.Error from the SparkScanView.feedbackDelegate. Mini preview is visible with a frozen frame and expanded capture button is visible. If capture button is tapped or after a Error.resumeCapturingDelay timeout is reached we move to ACTIVE state.

SparkScanViewUiListener
interface SparkScanViewUiListener

Added in version 6.16.0

onBarcodeFindButtonTap(view)
void onBarcodeFindButtonTap(@NonNull SparkScanView view)

Added in version 6.26.0

Callback method that can be used to define an action that should be performed when barcode find button is tapped from the toolbar. Called from the main thread.

onBarcodeCountButtonTap(view)
void onBarcodeCountButtonTap(@NonNull SparkScanView view)

Added in version 6.16.0

Callback method that can be used to define an action that should be performed when barcode count button is tapped from the toolbar. Called from the main thread.

onLabelCaptureButtonTap(view)
void onLabelCaptureButtonTap(@NonNull SparkScanView view)

Added in version 7.0.0

Callback method that can be used to define an action that should be performed when label capture button is tapped from the toolbar. Called from the main thread.

onScanningModeChange(newScanningMode)
void onScanningModeChange(@NonNull SparkScanScanningMode newScanningMode)

Added in version 6.20.0

Callback method that will be called when the currently used SparkScanScanningMode changes. Called from the main thread.

onViewStateChanged(newState)
void onViewStateChanged(SparkScanViewState newState)

Added in version 7.0.0

Callback method that will be called when SparkScanViewState changes. Called from the main thread.

SparkScanScanningMode
abstract class SparkScanScanningMode

Added in version 6.16.0

The base class for setting a default scanning mode to SparkScanViewSettings. Can be either Target or Default.

Target
class Target : SparkScanScanningMode

Added in version 6.16.0

Target scanning mode. This is meant and optimized to scan codes further away.

Target()
Target(SparkScanScanningBehavior scanningBehavior,
        SparkScanPreviewBehavior previewBehavior)

Added in version 6.23.0

Constructs a new target scanning mode with the provided capture mode and preview behavior.

scanningBehavior
SparkScanScanningBehavior getScanningBehavior()

Added in version 6.16.0

The scanning mode provided in the constructor.

previewBehavior
SparkScanPreviewBehavior getPreviewBehavior()

Added in version 6.23.0

The preview behavior provided in the constructor.

Default
class Default : SparkScanScanningMode

Added in version 6.16.0

This is the standard scanning mode for SparkScan.

Default()
Default(SparkScanScanningBehavior scanningBehavior,
        SparkScanPreviewBehavior previewBehavior)

Added in version 6.23.0

Constructs a new default scanning mode with the provided capture mode and preview behavior.

scanningBehavior
SparkScanScanningBehavior getScanningBehavior()

Added in version 6.16.0

The scanning mode provided in the constructor.

previewBehavior
SparkScanPreviewBehavior getPreviewBehavior()

Added in version 6.23.0

The preview behavior provided in the constructor.

SparkScanCoordinatorLayout
class SparkScanCoordinatorLayout : FrameLayout

Added in version 6.15.0

SparkScanCoordinatorLayout is a FrameLayout.

SparkScanCoordinatorLayout is intended to be used as a container of your layout and where the SparkScanView will be used.

SparkScanCoordinatorLayout()
SparkScanCoordinatorLayout(@NonNull Context context)

Added in version 6.15.0

Public constructor of the SparkScanCoordinatorLayout.

SparkScanCoordinatorLayout()
SparkScanCoordinatorLayout(@NonNull Context context,
        @Nullable AttributeSet attrs)

Added in version 6.15.0

Public constructor of the SparkScanCoordinatorLayout.

SparkScanCoordinatorLayout()
SparkScanCoordinatorLayout(@NonNull Context context,
        @NonNull AttributeSet attrs,
        int defStyleAttr)

Added in version 6.15.0

Public constructor of the SparkScanCoordinatorLayout.

<com.scandit.datacapture.barcode.spark.ui.SparkScanCoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    // Your layout goes here

</com.scandit.datacapture.barcode.spark.ui.SparkScanCoordinatorLayout>
SparkScanView
class SparkScanView : RelativeLayout

Added in version 6.15.0

SparkScan comes with a ready-to-use UI and scanning modes that are purpose-built to tackle high-volume scanning at close range. The SparkScanView integrates with any app without requiring app redesign or customization. It includes:

  • camera preview screen

  • large-sized scan button

  • quick access toolbar to adjust scanning settings

onPause()
void onPause()

Added in version 6.15.0

Function to call on Fragment/Activity onPause callback. You have to call this for the correct functioning of the SparkScanView.

override fun onPause() {
  super.onPause()
  sparkScanView.onPause()
}
onResume()
void onResume()

Added in version 6.16.0

Function to call on Fragment/Activity onResume callback. You have to call this for the correct functioning of the SparkScanView.

override fun onResume() {
  super.onResume()
  sparkScanView.onResume()
}
feedbackDelegate
@NonNull SparkScanFeedbackDelegate getFeedbackDelegate()
void setFeedbackDelegate(@NonNull SparkScanFeedbackDelegate value)

Added in version 6.23.0

Sets the feedback delegate. If no delegate is set, the default SparkScanBarcodeFeedback.Success feedback is emitted.

hardwareTriggerSupported
boolean getHardwareTriggerSupported()

Added in version 6.16.0

Returns whether the device supports listening for hardware button events. This is true for devices with api >= 28.

newInstance(parentView, dataCaptureContext, sparkScan, settings)
static @NonNull SparkScanView newInstance(@NonNull View parentView,
        @NonNull DataCaptureContext dataCaptureContext,
        @NonNull SparkScan sparkScan,
        @NonNull SparkScanViewSettings settings)

Added in version 6.15.0

Constructs a new SparkScan view and adds it to the provided parentView. When the settings are provided, those will be used to set the default behaviour and look of the view.

newInstance(parentView, dataCaptureContext, sparkScan)
static @NonNull SparkScanView newInstance(@NonNull View parentView,
        @NonNull DataCaptureContext dataCaptureContext,
        @NonNull SparkScan sparkScan)

Added in version 6.15.0

Constructs a new SparkScan view and adds it to the provided parentView.

sparkScanView = SparkScanView.newInstance(
      rootView, // Preferably SparkScanCoordinatorLayout instance
      dataCaptureContext,
      sparkScan, // SparkScan mode instance
  )
startScanning()
void startScanning()

Added in version 6.15.0

Starts the scanning process. You can call this method if you want to trigger the scanning process without any user interaction.

pauseScanning()
void pauseScanning()

Added in version 6.15.0

Pauses the scanning process. You can call this method if you want to trigger pausing the scanning process without any user interaction.

setListener(listener)
void setListener(@Nullable SparkScanViewUiListener listener)

Added in version 6.16.0

Sets the listener which is called whenever a barcode find button or barcode count button is tapped from the toolbar.

showToast(text)
void showToast(@NonNull String text)

Added in version 6.18.0

Shows a toast with text inside the mini preview.

getScanningMode()
@NonNull SparkScanScanningMode getScanningMode()

Added in version 6.20.0

Returns the currently used SparkScanScanningMode.

setTriggerButtonImage(resourceId)
void setTriggerButtonImage(int resourceId)

Added in version 7.0.0

Sets the resource to use for the trigger button image.

barcodeCountButtonVisible
boolean getBarcodeCountButtonVisible()
void setBarcodeCountButtonVisible(boolean value)

Added in version 6.16.0

Indicates whether the barcode count button should be shown to the user.

Default is false.

barcodeFindButtonVisible
boolean getBarcodeFindButtonVisible()
void setBarcodeFindButtonVisible(boolean value)

Added in version 6.26.0

Indicates whether the barcode find button should be shown to the user.

Default is false.

labelCaptureButtonVisible
boolean getLabelCaptureButtonVisible()
void setLabelCaptureButtonVisible(boolean value)

Added in version 7.0.0

Indicates whether the label capture button should be shown to the user.

Default is false.

targetModeButtonVisible
boolean getTargetModeButtonVisible()
void setTargetModeButtonVisible(boolean value)

Added in version 6.16.0

Indicates whether the target mode button should be shown to the user.

Default is false.

scanningBehaviorButtonVisible
boolean getScanningBehaviorButtonVisible()
void setScanningBehaviorButtonVisible(boolean value)

Added in version 6.15.0

Indicates whether the scanning behavior button should be shown to the user.

Default is false.

torchButtonVisible
boolean getTorchButtonVisible()
void setTorchButtonVisible(boolean value)

Added in version 6.15.0

Indicates whether the torch button should be shown to the user.

Default is true.

Deprecated since version 7.0: The torch button has been moved to the mini preview. Use torchControlVisible instead.

handModeButtonVisible
boolean getHandModeButtonVisible()
void setHandModeButtonVisible(boolean value)

Added in version 6.15.0

Indicates whether the hand mode button should be shown to the user.

Default is false.

Deprecated since version 7.0: Hand mode is no longer supported. The trigger button can now be placed anywhere on the screen.

zoomSwitchControlVisible
boolean getZoomSwitchControlVisible()
void setZoomSwitchControlVisible(boolean value)

Added in version 6.18.0

Indicates whether the zoom switch control should be shown to the user.

Default is true.

triggerButtonVisible
boolean getTriggerButtonVisible()
void setTriggerButtonVisible(boolean value)

Added in version 7.0.0

Indicates whether the trigger button should be shown to the user.

Default is true.

previewSizeControlVisible
boolean getPreviewSizeControlVisible()
void setPreviewSizeControlVisible(boolean value)

Added in version 6.23.0

Indicates whether the mini preview size control should be shown to the user.

Default is true.

torchControlVisible
boolean getTorchControlVisible()
void setTorchControlVisible(boolean value)

Added in version 7.0.0

Indicates whether the torch control should be shown to the user.

Default is true.

Note

If SparkScanViewSettings.defaultTorchState is set to TorchState.AUTO, torch control is hidden.

previewCloseControlVisible
boolean getPreviewCloseControlVisible()
void setPreviewCloseControlVisible(boolean value)

Added in version 7.0.0

Indicates whether the mini preview close control should be shown to the user.

Default is true.

cameraSwitchButtonVisible
boolean getCameraSwitchButtonVisible()
void setCameraSwitchButtonVisible(boolean value)

Added in version 6.24.0

Indicates whether the camera switch button should be shown to the user.

Default is false.

Note

This API is still in beta and may change in future versions of Scandit Data Capture SDK.

stopCapturingText
@Nullable String getStopCapturingText()
void setStopCapturingText(@Nullable String value)

Added in version 6.15.0

Sets the default text to display in the button for the stop capturing action.

Default is null.

Deprecated since version 7.0: The trigger button no longer displays text.

startCapturingText
@Nullable String getStartCapturingText()
void setStartCapturingText(@Nullable String value)

Added in version 6.15.0

Sets the default text to display in the button for the start capturing action.

Default is null.

Deprecated since version 7.0: The trigger button no longer displays text.

resumeCapturingText
@Nullable String getResumeCapturingText()
void setResumeCapturingText(@Nullable String value)

Added in version 6.15.0

Sets the default text to display in the button for the resume capturing action.

Default is null.

Deprecated since version 7.0: The trigger button no longer displays text.

scanningCapturingText
@Nullable String getScanningCapturingText()
void setScanningCapturingText(@Nullable String value)

Added in version 6.16.0

Sets the default text to display in the button when scanning in SparkScanScanningBehavior.SINGLE.

Default is null.

Deprecated since version 7.0: The trigger button no longer displays text.

triggerButtonCollapsedColor
@Nullable Integer getTriggerButtonCollapsedColor()
void setTriggerButtonCollapsedColor(@Nullable Integer value)

Added in version 7.0.0

Sets the background color of the trigger button when button is collapsed.

triggerButtonExpandedColor
@Nullable Integer getTriggerButtonExpandedColor()
void setTriggerButtonExpandedColor(@Nullable Integer value)

Added in version 7.0.0

Sets the background color of the trigger button when button is expanded.

triggerButtonAnimationColor
@Nullable Integer getTriggerButtonAnimationColor()
void setTriggerButtonAnimationColor(@Nullable Integer value)

Added in version 7.0.0

Sets the color of the pulsing animation around the trigger button, which is shown when the scanner is active.

triggerButtonTintColor
@Nullable Integer getTriggerButtonTintColor()
void setTriggerButtonTintColor(@Nullable Integer value)

Added in version 7.0.0

Sets the trigger button tint color.

captureButtonBackgroundColor
@Nullable Integer getCaptureButtonBackgroundColor()
void setCaptureButtonBackgroundColor(@Nullable Integer value)

Added in version 6.15.0

Sets the background color of the capture button.

Default is null.

Deprecated since version 7.0: Use triggerButtonCollapsedColor and triggerButtonExpandedColor instead.

captureButtonActiveBackgroundColor
@Nullable Integer getCaptureButtonActiveBackgroundColor()
void setCaptureButtonActiveBackgroundColor(
        @Nullable Integer value)

Added in version 6.16.0

Sets the background color of the capture button when scanning.

Default is null.

Deprecated since version 7.0: This property is not relevant anymore.

captureButtonTintColor
@Nullable Integer getCaptureButtonTintColor()
void setCaptureButtonTintColor(@Nullable Integer value)

Added in version 6.16.0

Sets the capture button icon and text color.

Default is null.

Deprecated since version 7.0: Use triggerButtonTintColor instead.

toolbarBackgroundColor
@Nullable Integer getToolbarBackgroundColor()
void setToolbarBackgroundColor(@Nullable Integer value)

Added in version 6.16.0

Sets the toolbar background color.

Default is null.

toolbarIconActiveTintColor
@Nullable Integer getToolbarIconActiveTintColor()
void setToolbarIconActiveTintColor(@Nullable Integer value)

Added in version 6.16.0

Sets the toolbar icon active color.

Default is null.

toolbarIconInactiveTintColor
@Nullable Integer getToolbarIconInactiveTintColor()
void setToolbarIconInactiveTintColor(@Nullable Integer value)

Added in version 6.16.0

Sets the toolbar icon inactive color.

Default is null.

triggerButtonImage
@Nullable Bitmap getTriggerButtonImage()
void setTriggerButtonImage(@Nullable Bitmap value)

Added in version 7.0.0

The image displayed in the trigger button.