public class ShakeAutoSnappingPredicate implements IAutoSnappingPredicate<T>
Validation that tracks significant movements and allows snap only after some time passed since last significant move.
public static int DELAY_AFTER_MOVE_MS
public static io.scanbot.sdk.camera.autosnapping.ShakeAutoSnappingPredicate.Companion Companion
public ShakeAutoSnappingPredicate(@NotNull
android.content.Context context,
@Nullable
kotlin.jvm.functions.Function0<kotlin.Unit> moveCallback)
Validation that tracks significant movements and allows snap only after some time passed since last significant move.
public boolean isEnabled()
public void setEnabled(boolean p)
public boolean checkState(@NotNull
kotlin.Unit param)
Run this check.
param - typed param that this implementation might need. Default is Unitwhether this predicate currently allows autosnap
Note some (bad) magic here:
to achieve ability to implement interface IAutoSnappingPredicate
with param or without it - we do unchecked cast here.
If interface IAutoSnappingPredicate's implementation explicitly defines some type to use
as param - this cast will fail if nothing provided:
For class Foo : IAutoSnappingPredicate
call myFoo.okDetected() will fail, as it expects myFoo.okDetected(myClassInstance).
To have implementation that does not need param, just use Unit and pass no parameter:
class Bar : IAutoSnappingPredicate, and then myBar.okDetected()
public void onResume()
Call to attach to hardware listener.
public void onPause()
Call to detach when component no longer needed.