Class DocumentScannerConfiguration
-
- All Implemented Interfaces:
public final class DocumentScannerConfiguration
Class which is used to configure io.scanbot.sdk.ui.view.camera.DocumentScannerActivity Contains settings indicating views Behaviour, Texts and Appearance
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
DocumentScannerConfiguration.Companion
-
Field Summary
Fields Modifier and Type Field Description private final DocumentScannerJsonConfiguration
config
private final DocumentScannerNativeConfiguration
nativeParams
public final static DocumentScannerConfiguration.Companion
Companion
-
Constructor Summary
Constructors Constructor Description DocumentScannerConfiguration()
-
Method Summary
Modifier and Type Method Description final DocumentScannerJsonConfiguration
getConfig()
final DocumentScannerNativeConfiguration
getNativeParams()
final Unit
setPhotoQualityPrioritization(CapturePhotoQualityPrioritization value)
The prioritization of still image quality and capturing speed. final Unit
setImageFilterType(ImageFilterType imageFilterType)
Add default filtration for scanned document for given ImageFilterType final Unit
setParametricFilter(ParametricFilter parametricFilter)
Add default filtration for scanned document for given ParametricFilter final Unit
setDelayAfterFocusCompleteMs(Long delay)
Delay that camera will took before snap on auto focus complete called from camera core in ms. final Unit
setAutoSnappingEnabled(Boolean autoSnappingEnabled)
When auto-snapping is enabled the document scanner will take a photo automatically when a document is detected, conditions are good and the auto-snapping time-out elapses. final Unit
setFlashEnabled(Boolean flashEnabled)
Controls whether the flash should be initially enabled. final Unit
setMultiPageEnabled(Boolean multiPageEnabled)
Controls multi-page mode. final Unit
setMaxNumberOfPages(Integer maxNumberOfPages)
Defines max number of scanned pages. final Unit
setAutoSnappingSensitivity(Float autoSnappingSensitivity)
Controls the auto-snapping speed. final Unit
setCameraPreviewMode(CameraPreviewMode cameraPreviewMode)
Preview mode of the camera: Fit-In or Fill-In. final Unit
setOrientationLockMode(CameraOrientationMode cameraOrientationMode)
Orientation lock mode of the camera: PORTRAIT or LANDSCAPE. final Unit
setCameraModule(CameraModule cameraModule)
Set supported camera module: CameraModule.BACK, CameraModule.FRONT or others. final Unit
enableHardwareSnapButton(Integer key)
Enable pressing hardware button to make snap on this screen. final Unit
setIgnoreBadAspectRatio(Boolean ignoreBadAspectRatio)
Sets whether to ignore the DetectionResult. final Unit
setAcceptedAngleScore(Double acceptedAngleScore)
The minimum score in percent (0 - 100) of the perspective distortion to accept a detected document. final Unit
setAcceptedSizeScore(Double acceptedSizeScore)
The minimum document width or height in percent (0 - 100) of the screen size to accept a detected document. final Unit
setAcceptedBrightnessThreshold(Double acceptedBrightnessThreshold)
The brightness threshold to accept a detected document in the range of 0 (very dark) to 255 (very bright). final Unit
setImageScale(Float imageScale)
The image scaling factor. final Unit
setDocumentImageSizeLimit(Integer documentImageHeightLimit, Integer documentImageWidthLimit)
Document image size limit. final Unit
setPolygonColor(Integer polygonColor)
The color of the detected document outline when the document's angle, size or aspect ratio is not yet sufficiently good. final Unit
setPolygonColorOK(Integer polygonColorOK)
The color of the detected document outline when we are ready to snap io.scanbot.sdk.core.contourdetector.DetectionStatus. final Unit
setPolygonLineWidth(Integer polygonLineWidth)
Width of the detected document outline in Px. final Unit
setPolygonAutoSnapProgressColor(Integer polygonAutoSnapProgressColor)
The color of the outline progress animation before the snap being taken after the successful document detection io.scanbot.sdk.core.contourdetector.DetectionStatus. final Unit
setPolygonAutoSnapProgressLineWidth(Integer polygonProgressLineWidth)
Width of the document autoSnap animation outline. final Unit
setPolygonAutoSnapProgressEnabled(Boolean enabled)
Enable/disable polygon autoSnap progress animation final Unit
setPolygonCornerRadius(Integer polygonCornerRadius)
Radius of corners of the detected document outline. final Unit
setPolygonBackgroundColor(Integer polygonBackgroundColor)
The background color of the detected document outline when the document's angle, size or aspect ratio is not yet sufficiently good. final Unit
setPolygonBackgroundColorOK(Integer polygonBackgroundColorOK)
The background color of the detected document outline when we are ready to snap io.scanbot.sdk.core.contourdetector.DetectionStatus. final Unit
setDrawPolygonShadows(Boolean drawPolygonShadows)
Draw shadows under polygon stroke if polygon background color is transparent final Unit
setShutterButtonAutoOuterColor(Integer shutterButtonAutoOuterColor)
The background color of the shutter button in auto-snapping mode. final Unit
setShutterButtonAutoInnerColor(Integer shutterButtonAutoInnerColor)
The foreground color of the shutter button in auto-snapping mode. final Unit
setShutterButtonManualOuterColor(Integer shutterButtonManualOuterColor)
The background color of the shutter button in manual mode. final Unit
setShutterButtonManualInnerColor(Integer shutterButtonManualInnerColor)
The foreground color of the shutter button in manual mode. final Unit
setShutterSoundEnabled(Boolean shutterSoundEnabled)
Set camera shutter sound state. final Unit
setUserGuidanceBackgroundColor(Integer userGuidanceBackgroundColor)
The background color of the user guidance hints. final Unit
setUserGuidanceTextColor(Integer userGuidanceTextColor)
The text color of the user guidance hints. final Unit
setTopBarBackgroundColor(Integer topBarBackgroundColor)
The background color of the top toolbar. final Unit
setTopBarButtonsActiveColor(Integer topBarButtonsActiveColor)
The color of all active toggle buttons in the toolbar. final Unit
setTopBarButtonsInactiveColor(Integer topBarButtonsInactiveColor)
The color of all inactive toggle buttons in the toolbar. final Unit
setBottomBarBackgroundColor(Integer bottomBarBackgroundColor)
The background color of the bottom shutter-bar. final Unit
setBottomBarButtonsColor(Integer bottomBarButtonsColor)
The color of the title of all buttons in the bottom shutter-bar (Cancel button, etc.), as well as the camera permission prompt button. final Unit
setCameraBackgroundColor(Integer cameraBackgroundColor)
The color of the camera background (relevant only when the camera preview mode is CameraPreviewMode.FIT_IN). final Unit
setMultiPageButtonHidden(Boolean multiPageButtonHidden)
Controls whether the multi-page toggle button is hidden or not. final Unit
setFlashButtonHidden(Boolean flashButtonHidden)
Controls whether the flash toggle button is hidden or not. final Unit
setAutoSnappingButtonHidden(Boolean autoSnappingButtonHidden)
Controls whether the auto-snapping toggle button is hidden or not. final Unit
setShutterButtonHidden(Boolean shutterButtonHidden)
Controls whether the shutter button is hidden or not. final Unit
setCancelButtonTitle(String cancelButtonTitle)
Title of the cancel button. final Unit
setPageCounterButtonTitle(String pageCounterButtonTitle)
Title suffix of the button that finishes the document scanning when multi-page scanning is enabled. final Unit
setTextHintOK(String textHintOK)
Text hint that will be shown when the current detection status is io.scanbot.sdk.core.contourdetector.DetectionStatus. final Unit
setTextHintTooSmall(String textHintTooSmall)
Text hint that will be shown when the current detection status is io.scanbot.sdk.core.contourdetector.DetectionStatus. final Unit
setTextHintBadAngles(String textBadAngles)
Text hint that will be shown when the current detection status is io.scanbot.sdk.core.contourdetector.DetectionStatus. final Unit
setTextHintBadAspectRatio(String textHintBadAspectRatio)
Text hint that will be shown when the current detection status is io.scanbot.sdk.core.contourdetector.DetectionStatus. final Unit
setTextHintNothingDetected(String textHintNothingDetected)
Text hint that will be shown when the current detection status is io.scanbot.sdk.core.contourdetector.DetectionStatus. final Unit
setTextHintTooNoisy(String textHintTooNoisy)
Text hint that will be shown when the current detection status is io.scanbot.sdk.core.contourdetector.DetectionStatus. final Unit
setTextHintTooDark(String textHintTooDark)
Text hint that will be shown when the current detection status is io.scanbot.sdk.core.contourdetector.DetectionStatus. final Unit
setMultiPageButtonTitle(String multiPageButtonTitle)
Title of the multi-page mode toggle button. final Unit
setFlashButtonTitle(String flashButtonTitle)
Title of the flash toggle button. final Unit
setAutoSnappingButtonTitle(String autoSnappingButtonTitle)
Title of the auto-snapping toggle button. final Unit
setEnableCameraExplanationText(String enableCameraExplanationText)
Text that will be displayed when the app is not allowed to use the camera, prompting the user to enable the usage of the camera. final Unit
setEnableCameraButtonTitle(String enableCameraButtonTitle)
Title of the button that opens the screen where the user can allow the usage of the camera by the app. final Unit
setUseButtonsAllCaps(Boolean allCaps)
Controls whether buttons should use all capitals style final Unit
setAccessibilityConfiguration(DocumentScannerAccessibilityConfiguration accessibilityConfiguration)
A configuration with accessibility texts settings. final Unit
setForceMaxSnappingSize(Boolean enabled)
Set whether camera should force maximum possible size of snapped picture or use maximum size that available with the same aspect ratio as preview by default set to false
This parameter works only withScanbotCameraXView
enabledfinal Unit
setForceUserGuidance(Boolean enabled)
Force of showing PolygonView and user guiding when autosnapping is disabled final Unit
setRequiredAspectRatios(ArrayList<AspectRatio> requiredAspectRatios)
Allowed aspect ratios of the document. final Unit
setTouchToFocusEnabled(Boolean enabled)
Controls whether the touch to focus feature should be enabled. -
-
Method Detail
-
getConfig
final DocumentScannerJsonConfiguration getConfig()
-
getNativeParams
final DocumentScannerNativeConfiguration getNativeParams()
-
setPhotoQualityPrioritization
final Unit setPhotoQualityPrioritization(CapturePhotoQualityPrioritization value)
The prioritization of still image quality and capturing speed. Defaults to CapturePhotoQualityPrioritization.BALANCED. If you experience lots of blurry still images try to set this property to CapturePhotoQualityPrioritization.QUALITY
-
setImageFilterType
@Deprecated(message = "Use setParametricFilter(parametricFilter: ParametricFilter) instead.", replaceWith = @ReplaceWith(imports = {}, expression = "setParametricFilter(LegacyFilter(imageFilterType.code))")) final Unit setImageFilterType(ImageFilterType imageFilterType)
Add default filtration for scanned document for given ImageFilterType
-
setParametricFilter
final Unit setParametricFilter(ParametricFilter parametricFilter)
Add default filtration for scanned document for given ParametricFilter
-
setDelayAfterFocusCompleteMs
final Unit setDelayAfterFocusCompleteMs(Long delay)
Delay that camera will took before snap on auto focus complete called from camera core in ms. For some devices this callback could call even before real auto focus completed, so we need to take some delay before snapping. Usually you can set 500ms. By default it is set to 20ms.
-
setAutoSnappingEnabled
final Unit setAutoSnappingEnabled(Boolean autoSnappingEnabled)
When auto-snapping is enabled the document scanner will take a photo automatically when a document is detected, conditions are good and the auto-snapping time-out elapses. In this mode the user can still tap the shutter button to snap a document.
When auto-snapping is disabled, the user must manually take a photo by tapping the shutter button.
The default value is TRUE.
-
setFlashEnabled
final Unit setFlashEnabled(Boolean flashEnabled)
Controls whether the flash should be initially enabled. The default value is FALSE.
-
setMultiPageEnabled
final Unit setMultiPageEnabled(Boolean multiPageEnabled)
Controls multi-page mode. When enabled, the user can take multiple document photos before closing the screen by tapping the page counter button. When disabled, the screen will be closed immediately after the first document photo is made. The default value is FALSE.
-
setMaxNumberOfPages
final Unit setMaxNumberOfPages(Integer maxNumberOfPages)
Defines max number of scanned pages. This parameter works only if the “multipage” feature is enabled. Once the number of scanned pages was reached, the Document Scanner will be closed.
-
setAutoSnappingSensitivity
final Unit setAutoSnappingSensitivity(Float autoSnappingSensitivity)
Controls the auto-snapping speed. Sensitivity must be within the 0..1 range. A value of 1.0 triggers automatic capturing immediately, a value of 0.0 delays the automatic by 3 seconds. The default value is 0.66 (2 seconds)
-
setCameraPreviewMode
final Unit setCameraPreviewMode(CameraPreviewMode cameraPreviewMode)
Preview mode of the camera: Fit-In or Fill-In. Optional, default is Fill-In.
-
setOrientationLockMode
final Unit setOrientationLockMode(CameraOrientationMode cameraOrientationMode)
Orientation lock mode of the camera: PORTRAIT or LANDSCAPE. By default the camera orientation is not locked.
-
setCameraModule
final Unit setCameraModule(CameraModule cameraModule)
Set supported camera module: CameraModule.BACK, CameraModule.FRONT or others. Optional. By default is CameraModule.BACK.
-
enableHardwareSnapButton
final Unit enableHardwareSnapButton(Integer key)
Enable pressing hardware button to make snap on this screen. Pass KeyEvent.KEYCODE_VOLUME_DOWN or any other KeyEvent.KEYCODE that is supported by the device. By default for kotlin KeyEvent.KEYCODE_VOLUME_DOWN code being used.
-
setIgnoreBadAspectRatio
final Unit setIgnoreBadAspectRatio(Boolean ignoreBadAspectRatio)
Sets whether to ignore the DetectionResult.OK_BUT_BAD_ASPECT_RATIO detection status. By default BadAspectRatio is not ignored.
-
setAcceptedAngleScore
final Unit setAcceptedAngleScore(Double acceptedAngleScore)
The minimum score in percent (0 - 100) of the perspective distortion to accept a detected document. Default is 75.0.
-
setAcceptedSizeScore
final Unit setAcceptedSizeScore(Double acceptedSizeScore)
The minimum document width or height in percent (0 - 100) of the screen size to accept a detected document. Default is 80.0.
-
setAcceptedBrightnessThreshold
final Unit setAcceptedBrightnessThreshold(Double acceptedBrightnessThreshold)
The brightness threshold to accept a detected document in the range of 0 (very dark) to 255 (very bright). If the average brightness value of the detectors input image is below this value, the status of the detection will be set to ERROR_TOO_DARK. Default is 50.0.
-
setImageScale
final Unit setImageScale(Float imageScale)
The image scaling factor. The factor must be within the 0..1 range. A factor of 1 means that the resulting images retain their original size. When the factor is less than 1, resulting images will be made smaller by that factor. By default the scale is 1.
-
setDocumentImageSizeLimit
final Unit setDocumentImageSizeLimit(Integer documentImageHeightLimit, Integer documentImageWidthLimit)
Document image size limit. Should be positives Ints. Means that if the document size will be bigger than a limit, then it will be downscaled with aspectRatio kept. By default the limit is Int.MAX_VALUE, so there are no scaling.
-
setPolygonColor
final Unit setPolygonColor(Integer polygonColor)
The color of the detected document outline when the document's angle, size or aspect ratio is not yet sufficiently good. (All detection statuses in io.scanbot.sdk.core.contourdetector.DetectionStatus that have the OK_BUT_XXX prefix).
-
setPolygonColorOK
final Unit setPolygonColorOK(Integer polygonColorOK)
The color of the detected document outline when we are ready to snap io.scanbot.sdk.core.contourdetector.DetectionStatus.OK.
-
setPolygonLineWidth
final Unit setPolygonLineWidth(Integer polygonLineWidth)
Width of the detected document outline in Px.
-
setPolygonAutoSnapProgressColor
final Unit setPolygonAutoSnapProgressColor(Integer polygonAutoSnapProgressColor)
The color of the outline progress animation before the snap being taken after the successful document detection io.scanbot.sdk.core.contourdetector.DetectionStatus.OK.
-
setPolygonAutoSnapProgressLineWidth
final Unit setPolygonAutoSnapProgressLineWidth(Integer polygonProgressLineWidth)
Width of the document autoSnap animation outline.
-
setPolygonAutoSnapProgressEnabled
final Unit setPolygonAutoSnapProgressEnabled(Boolean enabled)
Enable/disable polygon autoSnap progress animation
-
setPolygonCornerRadius
final Unit setPolygonCornerRadius(Integer polygonCornerRadius)
Radius of corners of the detected document outline.
-
setPolygonBackgroundColor
final Unit setPolygonBackgroundColor(Integer polygonBackgroundColor)
The background color of the detected document outline when the document's angle, size or aspect ratio is not yet sufficiently good. (All io.scanbot.sdk.core.contourdetector.DetectionStatus with OK_BUT_XXX).
-
setPolygonBackgroundColorOK
final Unit setPolygonBackgroundColorOK(Integer polygonBackgroundColorOK)
The background color of the detected document outline when we are ready to snap io.scanbot.sdk.core.contourdetector.DetectionStatus.OK.
-
setDrawPolygonShadows
final Unit setDrawPolygonShadows(Boolean drawPolygonShadows)
Draw shadows under polygon stroke if polygon background color is transparent
-
setShutterButtonAutoOuterColor
final Unit setShutterButtonAutoOuterColor(Integer shutterButtonAutoOuterColor)
The background color of the shutter button in auto-snapping mode.
-
setShutterButtonAutoInnerColor
final Unit setShutterButtonAutoInnerColor(Integer shutterButtonAutoInnerColor)
The foreground color of the shutter button in auto-snapping mode.
-
setShutterButtonManualOuterColor
final Unit setShutterButtonManualOuterColor(Integer shutterButtonManualOuterColor)
The background color of the shutter button in manual mode.
-
setShutterButtonManualInnerColor
final Unit setShutterButtonManualInnerColor(Integer shutterButtonManualInnerColor)
The foreground color of the shutter button in manual mode.
-
setShutterSoundEnabled
final Unit setShutterSoundEnabled(Boolean shutterSoundEnabled)
Set camera shutter sound state. {@code true} if a sound should be played when taking a picture, {@code false} - otherwise By default, the camera plays the system-defined camera shutter sound when taking a picture.
<p> Note that devices may not always allow disabling the camera shutter sound. If the shutter sound state cannot be set to the desired value, this value will be ignored. <p> This value is always {@code true} for pre-JELLY_BEAN_MR1- Parameters:
shutterSoundEnabled
- if shutter sound should be enabled
-
setUserGuidanceBackgroundColor
final Unit setUserGuidanceBackgroundColor(Integer userGuidanceBackgroundColor)
The background color of the user guidance hints.
-
setUserGuidanceTextColor
final Unit setUserGuidanceTextColor(Integer userGuidanceTextColor)
The text color of the user guidance hints.
-
setTopBarBackgroundColor
final Unit setTopBarBackgroundColor(Integer topBarBackgroundColor)
The background color of the top toolbar.
-
setTopBarButtonsActiveColor
final Unit setTopBarButtonsActiveColor(Integer topBarButtonsActiveColor)
The color of all active toggle buttons in the toolbar.
-
setTopBarButtonsInactiveColor
final Unit setTopBarButtonsInactiveColor(Integer topBarButtonsInactiveColor)
The color of all inactive toggle buttons in the toolbar.
-
setBottomBarBackgroundColor
final Unit setBottomBarBackgroundColor(Integer bottomBarBackgroundColor)
The background color of the bottom shutter-bar.
-
setBottomBarButtonsColor
final Unit setBottomBarButtonsColor(Integer bottomBarButtonsColor)
The color of the title of all buttons in the bottom shutter-bar (Cancel button, etc.), as well as the camera permission prompt button.
-
setCameraBackgroundColor
final Unit setCameraBackgroundColor(Integer cameraBackgroundColor)
The color of the camera background (relevant only when the camera preview mode is CameraPreviewMode.FIT_IN).
-
setMultiPageButtonHidden
final Unit setMultiPageButtonHidden(Boolean multiPageButtonHidden)
Controls whether the multi-page toggle button is hidden or not.
-
setFlashButtonHidden
final Unit setFlashButtonHidden(Boolean flashButtonHidden)
Controls whether the flash toggle button is hidden or not.
-
setAutoSnappingButtonHidden
final Unit setAutoSnappingButtonHidden(Boolean autoSnappingButtonHidden)
Controls whether the auto-snapping toggle button is hidden or not.
-
setShutterButtonHidden
final Unit setShutterButtonHidden(Boolean shutterButtonHidden)
Controls whether the shutter button is hidden or not. If true - enable auto-snapping mode and hides the auto-snapping toggle button.
-
setCancelButtonTitle
final Unit setCancelButtonTitle(String cancelButtonTitle)
Title of the cancel button.
-
setPageCounterButtonTitle
final Unit setPageCounterButtonTitle(String pageCounterButtonTitle)
Title suffix of the button that finishes the document scanning when multi-page scanning is enabled. The button's title has the format "# Pages", where # shows the number of images captured up to now and the suffix "Pages" is set using this method.
-
setTextHintOK
final Unit setTextHintOK(String textHintOK)
Text hint that will be shown when the current detection status is io.scanbot.sdk.core.contourdetector.DetectionStatus.OK
-
setTextHintTooSmall
final Unit setTextHintTooSmall(String textHintTooSmall)
Text hint that will be shown when the current detection status is io.scanbot.sdk.core.contourdetector.DetectionStatus.OK_BUT_TOO_SMALL
-
setTextHintBadAngles
final Unit setTextHintBadAngles(String textBadAngles)
Text hint that will be shown when the current detection status is io.scanbot.sdk.core.contourdetector.DetectionStatus.OK_BUT_BAD_ANGLES
-
setTextHintBadAspectRatio
final Unit setTextHintBadAspectRatio(String textHintBadAspectRatio)
Text hint that will be shown when the current detection status is io.scanbot.sdk.core.contourdetector.DetectionStatus.OK_BUT_BAD_ASPECT_RATIO
-
setTextHintNothingDetected
final Unit setTextHintNothingDetected(String textHintNothingDetected)
Text hint that will be shown when the current detection status is io.scanbot.sdk.core.contourdetector.DetectionStatus.ERROR_NOTHING_DETECTED
-
setTextHintTooNoisy
final Unit setTextHintTooNoisy(String textHintTooNoisy)
Text hint that will be shown when the current detection status is io.scanbot.sdk.core.contourdetector.DetectionStatus.ERROR_TOO_NOISY
-
setTextHintTooDark
final Unit setTextHintTooDark(String textHintTooDark)
Text hint that will be shown when the current detection status is io.scanbot.sdk.core.contourdetector.DetectionStatus.ERROR_TOO_DARK
-
setMultiPageButtonTitle
final Unit setMultiPageButtonTitle(String multiPageButtonTitle)
Title of the multi-page mode toggle button.
-
setFlashButtonTitle
final Unit setFlashButtonTitle(String flashButtonTitle)
Title of the flash toggle button.
-
setAutoSnappingButtonTitle
final Unit setAutoSnappingButtonTitle(String autoSnappingButtonTitle)
Title of the auto-snapping toggle button.
-
setEnableCameraExplanationText
final Unit setEnableCameraExplanationText(String enableCameraExplanationText)
Text that will be displayed when the app is not allowed to use the camera, prompting the user to enable the usage of the camera.
-
setEnableCameraButtonTitle
final Unit setEnableCameraButtonTitle(String enableCameraButtonTitle)
Title of the button that opens the screen where the user can allow the usage of the camera by the app.
-
setUseButtonsAllCaps
final Unit setUseButtonsAllCaps(Boolean allCaps)
Controls whether buttons should use all capitals style
-
setAccessibilityConfiguration
final Unit setAccessibilityConfiguration(DocumentScannerAccessibilityConfiguration accessibilityConfiguration)
A configuration with accessibility texts settings.
-
setForceMaxSnappingSize
final Unit setForceMaxSnappingSize(Boolean enabled)
Set whether camera should force maximum possible size of snapped picture or use maximum size that available with the same aspect ratio as preview by default set to
false
This parameter works only withScanbotCameraXView
enabled
-
setForceUserGuidance
final Unit setForceUserGuidance(Boolean enabled)
Force of showing PolygonView and user guiding when autosnapping is disabled
-
setRequiredAspectRatios
final Unit setRequiredAspectRatios(ArrayList<AspectRatio> requiredAspectRatios)
Allowed aspect ratios of the document.
-
setTouchToFocusEnabled
final Unit setTouchToFocusEnabled(Boolean enabled)
Controls whether the touch to focus feature should be enabled. Default is
true
.
-
-
-
-