Class BaseOverlayController
java.lang.Object
com.microblink.blinkid.fragment.overlay.BaseOverlayController
- All Implemented Interfaces:
ScanningOverlay
,ScanResultListener
- Direct Known Subclasses:
BlinkIdOverlayController
-
Field Summary
Modifier and TypeFieldDescriptionprotected android.app.AlertDialog
protected android.os.Handler
protected OverlayState
protected RecognizerRunnerFragment
protected RecognizerRunnerView
protected ScanResultListener
protected ScanSoundPlayer
protected TorchController
-
Constructor Summary
ModifierConstructorDescriptionprotected
BaseOverlayController
(ScanResultListener scanResultListener) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract int
android.content.Context
Returns context of the parent activity, after the RecognizerRunnerFragment is attached.protected abstract int
protected void
protected void
onFragmentConfigurationChanged
(android.content.res.Configuration newConfig) protected void
onFragmentCreated
(android.os.Bundle savedInstanceState) protected void
protected void
protected void
protected void
onFragmentSaveInstanceState
(android.os.Bundle outState) protected void
protected void
void
onFrameRecognitionDone
(RecognitionSuccessType recognitionSuccessType) Called for each camera frame, after the recognition has been completed.void
onRecognizerRunnerFragmentAttached
(RecognizerRunnerFragment recognizerRunnerFragment, android.app.Activity activity) Called afterRecognizerRunnerFragment
gets attached to its host activity.void
onRecognizerRunnerViewCreated
(RecognizerRunnerFragment recognizerRunnerFragment) Called whenRecognizerRunnerView
has been created within givenRecognizerRunnerFragment
.void
onUnrecoverableError
(Throwable throwable) This method is called when the scanning cannot be performed because of an error.void
If theRecognizerRunnerView
has been created, pauses the scanning loop by callingRecognizerRunnerView.pauseScanning()
.void
If theRecognizerRunnerView
has been created, resumes the scanning loop (that has been paused) by callingRecognizerRunnerView.resumeScanning(boolean)
}.protected void
protected abstract boolean
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.microblink.blinkid.view.recognition.ScanResultListener
onScanningDone
-
Field Details
-
scanResultListener
-
overlayState
-
recognizerRunnerFragment
-
recognizerRunnerView
-
handler
@NonNull protected android.os.Handler handler -
errorDialog
@Nullable protected android.app.AlertDialog errorDialog -
scanSoundPlayer
-
torchController
-
-
Constructor Details
-
BaseOverlayController
-
-
Method Details
-
onRecognizerRunnerViewCreated
@CallSuper public void onRecognizerRunnerViewCreated(@NonNull RecognizerRunnerFragment recognizerRunnerFragment) Description copied from interface:ScanningOverlay
Called whenRecognizerRunnerView
has been created within givenRecognizerRunnerFragment
. You can useRecognizerRunnerFragment.getRecognizerRunnerView()
to get the createdRecognizerRunnerView
and configure it. The most important thing you should do in this method is to setRecognizerBundle
to createdRecognizerRunnerView
usingRecognizerRunnerView.setRecognizerBundle(RecognizerBundle)
. You can also register various callbacks toRecognizerRunnerView
, exceptCameraEventsListener
(usingBaseCameraView.setCameraEventsListener(CameraEventsListener)
) andScanResultListener
(usingRecognizerRunnerView.setScanResultListener(ScanResultListener)
- those two listeners will be set toRecognizerRunnerView
withinRecognizerRunnerFragment
after calling this method - if you need to observe camera events withinRecognizerRunnerFragment
, you can set your ownBaseCameraEventsListener
to it withRecognizerRunnerFragment.setCameraEventsListener(BaseCameraEventsListener)
. In this method, you can also accessRecognizerRunnerFragment
's content layout with methodRecognizerRunnerFragment.getContentLayout()
and add your views to it.- Specified by:
onRecognizerRunnerViewCreated
in interfaceScanningOverlay
- Parameters:
recognizerRunnerFragment
-RecognizerRunnerFragment
within whichRecognizerRunnerView
has been created.
-
resumeScanning
@AnyThread @CallSuper public void resumeScanning()Description copied from interface:ScanningOverlay
If theRecognizerRunnerView
has been created, resumes the scanning loop (that has been paused) by callingRecognizerRunnerView.resumeScanning(boolean)
}.If the
RecognizerRunnerView
has not been created yet, does nothing.- Specified by:
resumeScanning
in interfaceScanningOverlay
- See Also:
-
shouldResetStateOnRecognizerResume
protected abstract boolean shouldResetStateOnRecognizerResume() -
pauseScanning
@AnyThread @CallSuper public void pauseScanning()Description copied from interface:ScanningOverlay
If theRecognizerRunnerView
has been created, pauses the scanning loop by callingRecognizerRunnerView.pauseScanning()
. But keeps camera active. If theRecognizerRunnerView
has not been created yet, does nothing.You can resume scanning by calling
ScanningOverlay.resumeScanning()
.- Specified by:
pauseScanning
in interfaceScanningOverlay
- See Also:
-
getBeepSoundResourceId
protected abstract int getBeepSoundResourceId() -
onRecognizerRunnerFragmentAttached
@CallSuper public void onRecognizerRunnerFragmentAttached(@NonNull RecognizerRunnerFragment recognizerRunnerFragment, @NonNull android.app.Activity activity) Description copied from interface:ScanningOverlay
Called afterRecognizerRunnerFragment
gets attached to its host activity. This happens beforeRecognizerRunnerFragment.onCreateView(LayoutInflater, ViewGroup, Bundle)
which internally invokesScanningOverlay.onRecognizerRunnerViewCreated(RecognizerRunnerFragment)
. This means that at the time this method is invoked, methods likeRecognizerRunnerFragment.getRecognizerRunnerView()
orRecognizerRunnerFragment.getContentLayout()
will return null. However, this is a good place to register yourLifecycleObserver
withRecognizerRunnerFragment.registerLifecycleObserver(LifecycleObserver)
if your overlay needs to be notified about lifecycle events ofRecognizerRunnerFragment
.- Specified by:
onRecognizerRunnerFragmentAttached
in interfaceScanningOverlay
- Parameters:
recognizerRunnerFragment
-RecognizerRunnerFragment
that has been attached to host activity.activity
-Activity
to whichRecognizerRunnerFragment
has been attached.
-
getContext
@Nullable public android.content.Context getContext()Returns context of the parent activity, after the RecognizerRunnerFragment is attached.- Returns:
- context of the parent activity or
null
if the recognizer runner fragment has not been attached yet.
-
getSplashScreenLayoutId
@LayoutRes protected abstract int getSplashScreenLayoutId() -
setMeteringAreas
protected void setMeteringAreas() -
onFragmentCreated
protected void onFragmentCreated(@Nullable android.os.Bundle savedInstanceState) -
onFragmentStarted
protected void onFragmentStarted() -
onFragmentResumed
protected void onFragmentResumed() -
onFragmentPaused
protected void onFragmentPaused() -
onFragmentStopped
protected void onFragmentStopped() -
onFragmentDestroyed
protected void onFragmentDestroyed() -
onFragmentConfigurationChanged
protected void onFragmentConfigurationChanged(@NonNull android.content.res.Configuration newConfig) -
onFragmentSaveInstanceState
protected void onFragmentSaveInstanceState(@Nullable android.os.Bundle outState) -
onCameraAutofocusFailed
protected void onCameraAutofocusFailed() -
onUnrecoverableError
Description copied from interface:ScanResultListener
This method is called when the scanning cannot be performed because of an error.- Specified by:
onUnrecoverableError
in interfaceScanResultListener
- Parameters:
throwable
- type of error
-
onFrameRecognitionDone
Description copied from interface:ScanningOverlay
Called for each camera frame, after the recognition has been completed.- Specified by:
onFrameRecognitionDone
in interfaceScanningOverlay
- Parameters:
recognitionSuccessType
- frame recognition status.
-