Class DocumentScannerCameraViewModel
-
- All Implemented Interfaces:
-
io.scanbot.sdk.ui.utils.Router
,io.scanbot.sdk.ui.view.camera.ICameraView.ViewModel
public final class DocumentScannerCameraViewModel implements ICameraView.ViewModel, Router
ViewModel for DocumentScannerCameraView.
-
-
Field Summary
Fields Modifier and Type Field Description public final static Double
DEFAULT_ACCEPTED_ANGLE_SCORE
public final static Double
DEFAULT_ACCEPTED_SIZE_SCORE
private Integer
hardwareButtonKeyCode
private final <Error class: unknown class><Boolean>
cameraOpened
private final <Error class: unknown class><Boolean>
stopNewFrames
private final <Error class: unknown class><Boolean>
flash
private final <Error class: unknown class><List<Page>>
snappedPages
private final <Error class: unknown class><Boolean>
autoSnapping
private final <Error class: unknown class><DocumentDetectionStatus>
detectionStatus
private final <Error class: unknown class><Boolean>
forceUserGuidance
private final <Error class: unknown class><List<AspectRatio>>
requiredAspectRatio
private final <Error class: unknown class><Boolean>
shutterSoundEnabled
private final <Error class: unknown class><Boolean>
pictureProcessing
private final <Error class: unknown class><Boolean>
multiPage
private final <Error class: unknown class><Boolean>
ignoreBadAspectRatio
private Boolean
shutterButtonHidden
private final <Error class: unknown class><Integer>
snappedPagesCount
private final <Error class: unknown class><ParametricFilter>
parametricFilter
private final <Error class: unknown class><Float>
autosnapSensitivity
private final <Error class: unknown class><Unit>
snapEvent
private final ContourDetector
scanner
-
Constructor Summary
Constructors Constructor Description DocumentScannerCameraViewModel(ContourDetector scanner, SaveTakenPictureUseCase saveTakenPictureUseCase, FilterDraftDocumentPageUseCase filterDraftDocumentPageUseCase, RemoveDraftPageUseCase removeDraftPageUseCase, FinalizePagesUseCase finalizePagesUseCase, IDispatchersProvider dispatchersProvider)
-
Method Summary
Modifier and Type Method Description Integer
getHardwareButtonKeyCode()
Unit
setHardwareButtonKeyCode(Integer hardwareButtonKeyCode)
<Error class: unknown class><Boolean>
getCameraOpened()
<Error class: unknown class><Boolean>
getStopNewFrames()
<Error class: unknown class><Boolean>
getFlash()
<Error class: unknown class><List<Page>>
getSnappedPages()
<Error class: unknown class><Boolean>
getAutoSnapping()
<Error class: unknown class><DocumentDetectionStatus>
getDetectionStatus()
<Error class: unknown class><Boolean>
getForceUserGuidance()
<Error class: unknown class><List<AspectRatio>>
getRequiredAspectRatio()
<Error class: unknown class><Boolean>
getShutterSoundEnabled()
<Error class: unknown class><Boolean>
getPictureProcessing()
<Error class: unknown class><Boolean>
getMultiPage()
<Error class: unknown class><Boolean>
getIgnoreBadAspectRatio()
Boolean
getShutterButtonHidden()
Unit
setShutterButtonHidden(Boolean shutterButtonHidden)
<Error class: unknown class><Integer>
getSnappedPagesCount()
<Error class: unknown class><ParametricFilter>
getParametricFilter()
<Error class: unknown class><Float>
getAutosnapSensitivity()
<Error class: unknown class><Unit>
getSnapEvent()
ContourDetector
getScanner()
final Unit
pause()
Unit
onCameraOpened()
Camera has been opened. Unit
onCancelClicked()
User wants to cancel snapping. Unit
onLicenseInvalid()
License is now invalid. Unit
onAutoSnappingClicked()
User wants to change auto snapping mode. Unit
onMultiPageClicked()
User wants to change multi page mode. Unit
onFlashClicked()
User wants to change flash mode. Unit
onSavePagesClicked()
User wants to snapped pages. Unit
onFinishCurrentState()
Triggered when the signal to finish was received from outside. Unit
pageSnapped(ByteArray image, CaptureInfo captureInfo)
User have snapped an image. final Unit
setAutoSnappingEnabled(Boolean autoSnappingEnabled)
Enables/Disables autosnapping final Unit
setForceUserGuidance(Boolean forceUserGuidance)
Enables/Disables forceUserGuidance final Unit
setParametricFilter(ParametricFilter parametricFilter)
Enables pages filtration for given ParametricFilter final Unit
setFlashEnabled(Boolean flashEnabled)
Enables/Disables flash final Unit
setShutterSoundEnabled(Boolean shutterSoundEnabled)
Set camera shutter sound state. final Unit
setMultiPageEnabled(Boolean multiPageEnabled)
Enables/Disables multipage final Unit
setMaxNumberOfPages(Integer maxNumberOfPages)
Set max number of scanned pages final Unit
setImageScale(Float imageScale)
Sets imageScale final Unit
setDocumentImageSizeLimit(PageStorageProcessor.Configuration.Size documentImageSizeLimit)
Sets documentImageSizeLimit 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 size 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
setRequiredAspectRatio(List<AspectRatio> requiredPageAspectRatios)
Set required PageAspectRatio. final Unit
setAutosnappingSensitivity(Float sensitivity)
final Boolean
onKeyEvent(Integer keyCode)
Unit
setIgnoreBadAspectRatio(Boolean ignoreBadAspectRatio)
Sets flag which enables/disables BadAspectRatio detection ignoring. Unit
updateDetectionStatus(DocumentDetectionStatus status)
Update status of polygon detection from contour detector. -
-
Constructor Detail
-
DocumentScannerCameraViewModel
DocumentScannerCameraViewModel(ContourDetector scanner, SaveTakenPictureUseCase saveTakenPictureUseCase, FilterDraftDocumentPageUseCase filterDraftDocumentPageUseCase, RemoveDraftPageUseCase removeDraftPageUseCase, FinalizePagesUseCase finalizePagesUseCase, IDispatchersProvider dispatchersProvider)
-
-
Method Detail
-
getHardwareButtonKeyCode
Integer getHardwareButtonKeyCode()
-
setHardwareButtonKeyCode
Unit setHardwareButtonKeyCode(Integer hardwareButtonKeyCode)
-
getCameraOpened
<Error class: unknown class><Boolean> getCameraOpened()
-
getStopNewFrames
<Error class: unknown class><Boolean> getStopNewFrames()
-
getSnappedPages
<Error class: unknown class><List<Page>> getSnappedPages()
-
getAutoSnapping
<Error class: unknown class><Boolean> getAutoSnapping()
-
getDetectionStatus
<Error class: unknown class><DocumentDetectionStatus> getDetectionStatus()
-
getForceUserGuidance
<Error class: unknown class><Boolean> getForceUserGuidance()
-
getRequiredAspectRatio
<Error class: unknown class><List<AspectRatio>> getRequiredAspectRatio()
-
getShutterSoundEnabled
<Error class: unknown class><Boolean> getShutterSoundEnabled()
-
getPictureProcessing
<Error class: unknown class><Boolean> getPictureProcessing()
-
getMultiPage
<Error class: unknown class><Boolean> getMultiPage()
-
getIgnoreBadAspectRatio
<Error class: unknown class><Boolean> getIgnoreBadAspectRatio()
-
getShutterButtonHidden
Boolean getShutterButtonHidden()
-
setShutterButtonHidden
Unit setShutterButtonHidden(Boolean shutterButtonHidden)
-
getSnappedPagesCount
<Error class: unknown class><Integer> getSnappedPagesCount()
-
getParametricFilter
<Error class: unknown class><ParametricFilter> getParametricFilter()
-
getAutosnapSensitivity
<Error class: unknown class><Float> getAutosnapSensitivity()
-
getSnapEvent
<Error class: unknown class><Unit> getSnapEvent()
-
getScanner
ContourDetector getScanner()
-
onCameraOpened
Unit onCameraOpened()
Camera has been opened.
-
onCancelClicked
Unit onCancelClicked()
User wants to cancel snapping.
-
onLicenseInvalid
Unit onLicenseInvalid()
License is now invalid.
-
onAutoSnappingClicked
Unit onAutoSnappingClicked()
User wants to change auto snapping mode.
-
onMultiPageClicked
Unit onMultiPageClicked()
User wants to change multi page mode.
-
onFlashClicked
Unit onFlashClicked()
User wants to change flash mode.
-
onSavePagesClicked
Unit onSavePagesClicked()
User wants to snapped pages.
-
onFinishCurrentState
Unit onFinishCurrentState()
Triggered when the signal to finish was received from outside.
-
pageSnapped
Unit pageSnapped(ByteArray image, CaptureInfo captureInfo)
User have snapped an image.
- Parameters:
image
- snapped imagecaptureInfo
- additional information about the picture
-
setAutoSnappingEnabled
final Unit setAutoSnappingEnabled(Boolean autoSnappingEnabled)
Enables/Disables autosnapping
-
setForceUserGuidance
final Unit setForceUserGuidance(Boolean forceUserGuidance)
Enables/Disables forceUserGuidance
-
setParametricFilter
final Unit setParametricFilter(ParametricFilter parametricFilter)
Enables pages filtration for given ParametricFilter
-
setFlashEnabled
final Unit setFlashEnabled(Boolean flashEnabled)
Enables/Disables flash
-
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
- Parameters:
shutterSoundEnabled
- if shutter sound should be enabled
-
setMultiPageEnabled
final Unit setMultiPageEnabled(Boolean multiPageEnabled)
Enables/Disables multipage
-
setMaxNumberOfPages
final Unit setMaxNumberOfPages(Integer maxNumberOfPages)
Set max number of scanned pages
-
setImageScale
final Unit setImageScale(Float imageScale)
Sets imageScale
-
setDocumentImageSizeLimit
final Unit setDocumentImageSizeLimit(PageStorageProcessor.Configuration.Size documentImageSizeLimit)
Sets documentImageSizeLimit
-
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. Set lower values to accept more perspective distortion.
Warning: Lower values result in more blurred document images.
-
setAcceptedSizeScore
final Unit setAcceptedSizeScore(Double acceptedSizeScore)
The minimum size in percent (0 - 100) of the screen size to accept a detected document. It is sufficient that height or width match the score. Default is 80.0.
Warning: Lower values result in low resolution document images.
-
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). Default is 50.
-
setRequiredAspectRatio
final Unit setRequiredAspectRatio(List<AspectRatio> requiredPageAspectRatios)
Set required PageAspectRatio.
-
setAutosnappingSensitivity
final Unit setAutosnappingSensitivity(Float sensitivity)
-
onKeyEvent
final Boolean onKeyEvent(Integer keyCode)
-
setIgnoreBadAspectRatio
Unit setIgnoreBadAspectRatio(Boolean ignoreBadAspectRatio)
Sets flag which enables/disables BadAspectRatio detection ignoring. Default value is
false
.
-
updateDetectionStatus
Unit updateDetectionStatus(DocumentDetectionStatus status)
Update status of polygon detection from contour detector.
-
-
-
-