public class DocumentCaptureOverlayController extends BaseOverlayController implements DocumentCaptureContract.OverlayController
errorDialog, handler, overlayState, recognizerRunnerFragment, recognizerRunnerView, scanResultListener, scanSoundPlayer, torchController
Constructor and Description |
---|
DocumentCaptureOverlayController(DocumentCaptureOverlaySettings overlaySettings,
ScanResultListener scanResultListener,
DocumentCaptureContract.OverlayView overlayView)
Pass in your own implementation of
DocumentCaptureContract.OverlayView to customise UI,
or use our overlay view DetectionOverlayView . |
Modifier and Type | Method and Description |
---|---|
protected int |
getBeepSoundResourceId() |
protected int |
getSplashScreenLayoutId() |
void |
onBackButtonClicked()
Called when back button is clicked in the view.
|
protected void |
onCameraAutofocusFailed() |
void |
onCaptureButtonClicked()
Called when image capture button is clicked in the view.
|
protected void |
onFragmentConfigurationChanged(android.content.res.Configuration newConfig) |
protected void |
onFragmentDestroyed() |
protected void |
onFragmentResumed() |
protected void |
onFragmentSaveInstanceState(android.os.Bundle outState) |
void |
onRecognizerRunnerViewCreated(RecognizerRunnerFragment recognizerRunnerFragment)
Called when
RecognizerRunnerView has been created within given
RecognizerRunnerFragment . |
void |
onScanningDone(RecognitionSuccessType recognitionSuccessType)
This method is called when recognition is done.
|
void |
onTorchButtonClicked()
Called when torch button is clicked in the view.
|
void |
resumeScanningAfterScanningDone() |
void |
setTorchStateListener(OverlayTorchStateListener torchStateListener)
Sets the torch state listener that will be notified when torch state is changed.
|
protected boolean |
shouldResetStateOnRecognizerResume() |
getContext, onFragmentCreated, onFragmentPaused, onFragmentStarted, onFragmentStopped, onFrameRecognitionDone, onRecognizerRunnerFragmentAttached, onUnrecoverableError, pauseScanning, resumeScanning, setMeteringAreas
public DocumentCaptureOverlayController(@NonNull DocumentCaptureOverlaySettings overlaySettings, @NonNull ScanResultListener scanResultListener, @NonNull DocumentCaptureContract.OverlayView overlayView)
DocumentCaptureContract.OverlayView
to customise UI,
or use our overlay view DetectionOverlayView
.overlaySettings
- overlay settingsscanResultListener
- listener to be notified when scanning is doneoverlayView
- custom UI implementationpublic void onRecognizerRunnerViewCreated(@NonNull RecognizerRunnerFragment recognizerRunnerFragment)
ScanningOverlay
RecognizerRunnerView
has been created within given
RecognizerRunnerFragment
. You can use RecognizerRunnerFragment.getRecognizerRunnerView()
to get the created RecognizerRunnerView
and configure it.
The most important thing you should do in this method is to set RecognizerBundle
to
created RecognizerRunnerView
using RecognizerRunnerView.setRecognizerBundle(RecognizerBundle)
.
You can also register various callbacks to RecognizerRunnerView
, except CameraEventsListener
(using BaseCameraView.setCameraEventsListener(CameraEventsListener)
) and ScanResultListener
(using RecognizerRunnerView.setScanResultListener(ScanResultListener)
- those two listeners will be set
to RecognizerRunnerView
within RecognizerRunnerFragment
after calling this method - if you
need to observe camera events within RecognizerRunnerFragment
, you can set your own BaseCameraEventsListener
to it with RecognizerRunnerFragment.setCameraEventsListener(BaseCameraEventsListener)
.
In this method, you can also access RecognizerRunnerFragment
's content layout with method
RecognizerRunnerFragment.getContentLayout()
and add your views to it.onRecognizerRunnerViewCreated
in interface ScanningOverlay
onRecognizerRunnerViewCreated
in class BaseOverlayController
recognizerRunnerFragment
- RecognizerRunnerFragment
within which RecognizerRunnerView
has been created.protected boolean shouldResetStateOnRecognizerResume()
shouldResetStateOnRecognizerResume
in class BaseOverlayController
protected int getBeepSoundResourceId()
getBeepSoundResourceId
in class BaseOverlayController
protected int getSplashScreenLayoutId()
getSplashScreenLayoutId
in class BaseOverlayController
public void onScanningDone(@NonNull RecognitionSuccessType recognitionSuccessType)
ScanResultListener
onScanningDone
in interface ScanResultListener
recognitionSuccessType
- indicates the success type of recognitionprotected void onFragmentResumed()
onFragmentResumed
in class BaseOverlayController
protected void onFragmentDestroyed()
onFragmentDestroyed
in class BaseOverlayController
protected void onFragmentConfigurationChanged(@NonNull android.content.res.Configuration newConfig)
onFragmentConfigurationChanged
in class BaseOverlayController
protected void onFragmentSaveInstanceState(@Nullable android.os.Bundle outState)
onFragmentSaveInstanceState
in class BaseOverlayController
protected void onCameraAutofocusFailed()
onCameraAutofocusFailed
in class BaseOverlayController
public void setTorchStateListener(OverlayTorchStateListener torchStateListener)
torchStateListener
- torch state listener that will be notified when torch state
is changed.public void onCaptureButtonClicked()
DocumentCaptureContract.OverlayController
onCaptureButtonClicked
in interface DocumentCaptureContract.OverlayController
public void resumeScanningAfterScanningDone()
public void onBackButtonClicked()
DocumentCaptureContract.OverlayController
onBackButtonClicked
in interface DocumentCaptureContract.OverlayController
public void onTorchButtonClicked()
DocumentCaptureContract.OverlayController
onTorchButtonClicked
in interface DocumentCaptureContract.OverlayController