public class BaseAutoSnappingController<T> implements IAutoSnappingController<T>
Base interface IAutoSnappingController implementation, that is, in theory, to suffice any scenario needs.
This class wraps all device- and camera's lifecycle-specific code, as well as two conditions validation - significant move timeout and capture interval timeout.
interface IAutoSnappingController,
detachpublic static boolean FORCE_AUTOFOCUS_BEFORE_SNAP_DEFAULT
public static io.scanbot.sdk.camera.autosnapping.BaseAutoSnappingController.Companion Companion
public BaseAutoSnappingController(@NotNull
IScanbotCameraView cameraView)
Base interface IAutoSnappingController implementation, that is, in theory, to suffice any scenario needs.
This class wraps all device- and camera's lifecycle-specific code, as well as two conditions validation - significant move timeout and capture interval timeout.
interface IAutoSnappingController,
detach@NotNull public io.scanbot.sdk.camera.autosnapping.IAutoSnappingController.AutoSnappingStateListener getStateListener()
public void setStateListener(@NotNull
io.scanbot.sdk.camera.autosnapping.IAutoSnappingController.AutoSnappingStateListener value)
@NotNull protected java.util.concurrent.atomic.AtomicBoolean isResumed()
public boolean isEnabled()
Flag to disable autosnapping processing. In case of false frames will be skipped.
public void setEnabled(boolean p)
Flag to disable autosnapping processing. In case of false frames will be skipped.
public void setForceAutofocusBeforeSnap(boolean forceAutofocusBeforeSnap)
forceAutofocusBeforeSnap - true to enable auto focus before snapping, false
to snap whenever requested.
Default is false
public void setShakeDetectionEnabled(boolean enabled)
Allows to enable or disable shake detection before autosnapping. It will wait for 2 seconds of stable values from accelerometer before taking a picture. Default is true
public void setSensitivity(float sensitivity)
Changes sensitivity of auto-snapping. That is: the more sensitive it is the faster it shoots.
Sensitivity must be within [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 CaptureIntervalAutoSnappingPredicate.DEFAULT_SENSITIVITY (~1 sec)
sensitivity - sensitivity within [0..1] range. If given value is outside of this rangeit is clampedpublic void trySnap(@NotNull
T parameter)
Start conditions evaluation and, maybe, take a snap, e.g. depending on current image status, snap interval etc.
@CallSuper
protected boolean runPredicates(@NotNull
T param)
Run particular implementation's autosnapping conditions checks.
Note the ability to specify predicates order together with distinguishing logical operators that short-circuit ('&&' and '||') and those that validate both sides of comparison (inflix 'and', 'or')
true if autosnapping conditions are met and image can be taken now.public void setAutoSnappingCallback(@Nullable
io.scanbot.sdk.camera.autosnapping.IAutoSnappingController.Callback callback)
Set callback. Defaults to IAutoSnappingController.Callback.NULL
callback - to set or null to reset to default.IAutoSnappingController.Callback.NULL,
interface IAutoSnappingController.Callbackpublic void detach()
Allows to detach successor implementation class. To be called in place of usage when screen hierarchy is being destroyed.
@CallSuper protected void resetPredicates()
Resets all predicates that store state.