Class CameraView
-
- All Implemented Interfaces:
-
android.graphics.drawable.Drawable.Callback
,android.view.KeyEvent.Callback
,android.view.ViewManager
,android.view.ViewParent
,android.view.accessibility.AccessibilityEventSource
,io.anyline2.camera.HighResolutionImageProvider
,io.anyline2.image.ImageProvider
,io.anyline2.image.NativeBarcodeProvider
public class CameraView extends ViewGroup implements ImageProvider, NativeBarcodeProvider, HighResolutionImageProvider
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description CameraView(Context context)
CameraView(Context context, AttributeSet attrs)
CameraView(Context context, AttributeSet attrs, int defStyleAttr)
-
Method Summary
Modifier and Type Method Description void
setPreferredPreviewSize(int width, int height)
Set the preferred preview size. void
setPreferredPictureSize(int width, int height)
Set the preferred picture size which is used when takeHighResolutionImage is called. void
setSceneMode(String sceneMode)
Set the scene mode that should be used if it is supported. void
setUseMaxFpsRange(boolean isEnabled)
Use maximum fps available or not. void
setPreferredPreviewFps(int minFps, int maxFps)
Set the proffered values for the minimum and maximum preview frames per second. void
setFocusConfig(FocusConfig focusConfig)
Set the focus config to use for focusing. CameraConfig
getPreferredCameraConfig()
Get the current preferred camera settings. void
setPreferredCameraConfig(CameraConfig preferredConfig)
Set the preferred camera settings. CameraConfig
getSettings()
Get the actually used settings (this is only available after the camera has been opened). void
setCameraOpenListener(CameraOpenListener listener)
Set the listener that is called when the camera is opened or a camera related error occurred. void
setHighResolutionImageListener(HighResolutionImageListener highResolutionImageListener)
Sets an optional listener which is called with the final AnylineImage, once a picture was taken with the camera via the takeHighResolutionImage method. float
getScale()
float
getScaleWidth()
int
getFrameWidth()
int
getFrameHeight()
CameraController
getCameraController()
void
callAutoFocus()
Call auto focus. void
setFlashOn(boolean isOn)
Turn the torch flash on or off. void
resetAutoFocusTimer()
Reset the auto focus timer, if a focus config is set. void
setImageListener(@Nullable() ImageListener imageListener)
Set the listener that should be called when a new image is available boolean
hasNewImage()
void
takeHighResolutionImage()
Takes a picture from the camera and calls onImageTaken after the image is taken successfully. void
takeHighResolutionImage(int top, int left, int right, int bottom, int scanViewWidth, int scanViewHeight)
AnylineImage
getLastImageWithFullSize()
Get the latest image in full size. ImageReceiver
getLastImageWithFullSizeReceiver()
Get the a receiver for the latest image in full size. boolean
openCameraInBackground()
Open the camera in a background thread, if surface is already created and camera is not opened already. void
releaseCameraInBackground()
Release the camera in a background thread. void
releaseCameraAndPreview()
void
releaseCamera()
Release the camera. boolean
onTouchEvent(MotionEvent event)
void
addImageReceivedEventListener(Event<AnylineImage> imageReceivedEvent)
void
removeImageReceivedEventListener(Event<AnylineImage> imageReceivedEvent)
boolean
isBarcodeDetectionEnabled()
boolean
isBarcodeDetectionOperational()
void
addNativeBarcodeReceivedEventListener(Event<Pair<AnylineYuvImage, BarcodeResult>> nativeBarcodeReceivedEvent, List<BarcodeFormat> supportedFormats)
void
removeNativeBarcodeReceivedEventListener(Event<Pair<AnylineYuvImage, BarcodeResult>> nativeBarcodeReceivedEvent)
boolean
isNativeBarcodeDetectionEnabled()
void
setPreviewCropGravity(int cropGravity)
-
Methods inherited from class android.view.ViewGroup
addChildrenForAccessibility, addExtraDataToAccessibilityNodeInfo, addFocusables, addKeyboardNavigationClusters, addStatesFromChildren, addTouchables, addView, bringChildToFront, childDrawableStateChanged, childHasTransientStateChanged, clearChildFocus, clearDisappearingChildren, clearFocus, dispatchApplyWindowInsets, dispatchCapturedPointerEvent, dispatchConfigurationChanged, dispatchCreateViewTranslationRequest, dispatchDisplayHint, dispatchDragEvent, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPointerCaptureChanged, dispatchProvideAutofillStructure, dispatchProvideStructure, dispatchScrollCaptureSearch, dispatchSetActivated, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowInsetsAnimationEnd, dispatchWindowInsetsAnimationPrepare, dispatchWindowInsetsAnimationProgress, dispatchWindowInsetsAnimationStart, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, endViewTransition, findFocus, findOnBackInvokedDispatcherForChild, findViewsWithText, focusSearch, focusableViewAvailable, gatherTransparentRegion, generateLayoutParams, getAccessibilityClassName, getChildAt, getChildCount, getChildMeasureSpec, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getNestedScrollAxes, getOverlay, getPersistentDrawingCache, getTouchscreenBlocksFocus, hasFocus, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isLayoutSuppressed, isMotionEventSplittingEnabled, isTransitionGroup, jumpDrawablesToCurrentState, layout, notifySubtreeAccessibilityStateChanged, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onDescendantInvalidated, onInterceptHoverEvent, onInterceptTouchEvent, onNestedFling, onNestedPreFling, onNestedPrePerformAccessibilityAction, onNestedPreScroll, onNestedScroll, onNestedScrollAccepted, onRequestSendAccessibilityEvent, onResolvePointerIcon, onStartNestedScroll, onStopNestedScroll, onViewAdded, onViewRemoved, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestSendAccessibilityEvent, requestTransparentRegion, restoreDefaultFocus, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setTouchscreenBlocksFocus, setTransitionGroup, setWindowInsetsAnimationCallback, shouldDelayChildPressedState, showContextMenuForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, suppressLayout, updateViewLayout
-
Methods inherited from class android.view.View
addOnAttachStateChangeListener, addOnLayoutChangeListener, addOnUnhandledKeyEventListener, animate, announceForAccessibility, autofill, bringToFront, buildDrawingCache, buildLayer, callOnClick, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, cancelDragAndDrop, cancelLongPress, cancelPendingInputEvents, checkInputConnectionProxy, clearAnimation, clearViewTranslationCallback, combineMeasuredStates, computeScroll, computeSystemWindowInsets, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPopulateAccessibilityEvent, draw, drawableHotspotChanged, findOnBackInvokedDispatcher, findViewById, findViewWithTag, forceHasOverlappingRendering, forceLayout, generateDisplayHash, generateViewId, getAccessibilityDelegate, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityPaneTitle, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAlpha, getAnimation, getAnimationMatrix, getApplicationWindowToken, getAttributeResolutionStack, getAttributeSourceResourceMap, getAutofillHints, getAutofillId, getAutofillType, getAutofillValue, getBackground, getBackgroundTintBlendMode, getBackgroundTintList, getBackgroundTintMode, getBaseline, getBottom, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentCaptureSession, getContentDescription, getContext, getDefaultFocusHighlightEnabled, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getExplicitStyle, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusable, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintBlendMode, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getHandler, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarThumbDrawable, getHorizontalScrollbarTrackDrawable, getId, getImportantForAccessibility, getImportantForAutofill, getImportantForContentCapture, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLocalVisibleRect, getLocationInSurface, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineAmbientShadowColor, getOutlineProvider, getOutlineSpotShadowColor, getOverScrollMode, getOverlay, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getPointerIcon, getPreferKeepClearRects, getReceiveContentMimeTypes, getResources, getRevealOnFocusHint, getRight, getRootSurfaceControl, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollCaptureHint, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getSourceLayoutResId, getStateDescription, getStateListAnimator, getSystemGestureExclusionRects, getSystemUiVisibility, getTag, getTextAlignment, getTextDirection, getTooltipText, getTop, getTouchDelegate, getTouchables, getTransitionAlpha, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getUniqueDrawingId, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarThumbDrawable, getVerticalScrollbarTrackDrawable, getVerticalScrollbarWidth, getViewTranslationResponse, getViewTreeObserver, getVisibility, getWidth, getWindowId, getWindowInsetsController, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasExplicitFocusable, hasFocusable, hasNestedScrollingParent, hasOnClickListeners, hasOnLongClickListeners, hasOverlappingRendering, hasPointerCapture, hasWindowFocus, inflate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityFocused, isAccessibilityHeading, isActivated, isAttachedToWindow, isAutoHandwritingEnabled, isClickable, isContextClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isForceDarkAllowed, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isImportantForAutofill, isImportantForContentCapture, isInEditMode, isInLayout, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingRelative, isPivotSet, isPreferKeepClear, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScreenReaderFocusable, isScrollContainer, isScrollbarFadingEnabled, isSelected, isShowingLayoutBounds, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVisibleToUserForAutofill, keyboardNavigationClusterSearch, measure, offsetLeftAndRight, offsetTopAndBottom, onApplyWindowInsets, onCancelPendingInputEvents, onCapturedPointerEvent, onCheckIsTextEditor, onCreateInputConnection, onCreateViewTranslationRequest, onCreateVirtualViewTranslationRequests, onDragEvent, onDrawForeground, onFilterTouchEventForSecurity, onFinishTemporaryDetach, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onPointerCaptureChange, onPopulateAccessibilityEvent, onProvideAutofillStructure, onProvideAutofillVirtualStructure, onProvideContentCaptureStructure, onProvideStructure, onProvideVirtualStructure, onReceiveContent, onRtlPropertiesChanged, onScreenStateChanged, onScrollCaptureSearch, onStartTemporaryDetach, onTrackballEvent, onViewTranslationResponse, onVirtualViewTranslationResponses, onVisibilityAggregated, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, performAccessibilityAction, performClick, performContextClick, performHapticFeedback, performLongClick, performReceiveContent, playSoundEffect, post, postDelayed, postInvalidate, postInvalidateDelayed, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, releasePointerCapture, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, removeOnUnhandledKeyEventListener, requestApplyInsets, requestFitSystemWindows, requestFocusFromTouch, requestLayout, requestPointerCapture, requestRectangleOnScreen, requestUnbufferedDispatch, requireViewById, resetPivot, resolveSize, resolveSizeAndState, restoreHierarchyState, saveAttributeDataForStyleable, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityHeading, setAccessibilityLiveRegion, setAccessibilityPaneTitle, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAllowClickWhenDisabled, setAlpha, setAnimation, setAnimationMatrix, setAutoHandwritingEnabled, setAutofillHints, setAutofillId, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintBlendMode, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentCaptureSession, setContentDescription, setContextClickable, setDefaultFocusHighlightEnabled, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setFocusedByDefault, setForceDarkAllowed, setForeground, setForegroundGravity, setForegroundTintBlendMode, setForegroundTintList, setForegroundTintMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHorizontalScrollbarThumbDrawable, setHorizontalScrollbarTrackDrawable, setHovered, setId, setImportantForAccessibility, setImportantForAutofill, setImportantForContentCapture, setKeepScreenOn, setKeyboardNavigationCluster, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLeftTopRightBottom, setLongClickable, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnCapturedPointerListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnReceiveContentListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineAmbientShadowColor, setOutlineProvider, setOutlineSpotShadowColor, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPointerIcon, setPreferKeepClear, setPreferKeepClearRects, setPressed, setRenderEffect, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScreenReaderFocusable, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollBarSize, setScrollBarStyle, setScrollCaptureCallback, setScrollCaptureHint, setScrollContainer, setScrollIndicators, setScrollX, setScrollY, setScrollbarFadingEnabled, setSelected, setSoundEffectsEnabled, setStateDescription, setStateListAnimator, setSystemGestureExclusionRects, setSystemUiVisibility, setTag, setTextAlignment, setTextDirection, setTooltipText, setTop, setTouchDelegate, setTransitionAlpha, setTransitionName, setTransitionVisibility, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVerticalScrollbarThumbDrawable, setVerticalScrollbarTrackDrawable, setViewTranslationCallback, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, showContextMenu, startActionMode, startAnimation, startDrag, startDragAndDrop, startNestedScroll, stopNestedScroll, toString, transformMatrixToGlobal, transformMatrixToLocal, unscheduleDrawable, updateDragShadow, willNotCacheDrawing, willNotDraw
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
CameraView
CameraView(Context context)
-
CameraView
CameraView(Context context, AttributeSet attrs)
-
CameraView
CameraView(Context context, AttributeSet attrs, int defStyleAttr)
-
-
Method Detail
-
setPreferredPreviewSize
@Deprecated() void setPreferredPreviewSize(int width, int height)
Set the preferred preview size. If set, a preview size that fits in the given size will be used otherwise the views size is used to determine a fitting preview size. This must be set before the camera is initialized to have an effect.
- Parameters:
width
- the preferred widthheight
- the preferred height
-
setPreferredPictureSize
@Deprecated() void setPreferredPictureSize(int width, int height)
Set the preferred picture size which is used when takeHighResolutionImage is called. If set, the supported picture size closest, and max the given size will be used. Otherwise the maximum supported size will be used. This must be set before the camera is initialized to have an effect.
- Parameters:
width
- the preferred picture widthheight
- the preferred picture height
-
setSceneMode
@Deprecated() void setSceneMode(String sceneMode)
Set the scene mode that should be used if it is supported.
This setting needs to be set before the camera is opened.
This has no effect on Nexus 4 + 5, because the flash is not working if a scene mode is set on those devices.
- Parameters:
sceneMode
- the scene mode to use (one of: android.hardware.Camera.Parameters.
-
setUseMaxFpsRange
void setUseMaxFpsRange(boolean isEnabled)
Use maximum fps available or not. By enabling this mode, the camera tries to set the shutter speed as high as possible, and thus reducing motion blur and providing a more fluid look and feel.
Generally, a high shutter speed leads to less camera sensor exposure, which means that the image may become darker and may need a flashlight, so that proper lighting conditions are met for the processing of the image.
This setting needs to be set before the camera is opened.
This setting is applied after the scene mode.
- Parameters:
isEnabled
- - true if high FPS mode should be enabled, false by default
-
setPreferredPreviewFps
void setPreferredPreviewFps(int minFps, int maxFps)
Set the proffered values for the minimum and maximum preview frames per second. This should usually NOT be used, but special values maybe required for certain hardware (like google glasses).
This setting has higher priority then setUseMaxFpsRange.
- Parameters:
minFps
- the preferred min FPSmaxFps
- the preferred max FPS
-
setFocusConfig
@Deprecated() void setFocusConfig(FocusConfig focusConfig)
Set the focus config to use for focusing.
This setting needs to be set before the camera is opened.
- Parameters:
focusConfig
- the focus config
-
getPreferredCameraConfig
CameraConfig getPreferredCameraConfig()
Get the current preferred camera settings.
This can be used to change the preferred settings. Changes needs to be made before the camera is opened to have an effect.
- Returns:
the preferred camera settings
-
setPreferredCameraConfig
void setPreferredCameraConfig(CameraConfig preferredConfig)
Set the preferred camera settings. The actual used settings will be composed of this and the available features.
This needs to be set before the camera is opened.
It is also possible to just manipulate the settings returned by getPreferredCameraConfig.
- Parameters:
preferredConfig
- the preferred settings
-
getSettings
CameraConfig getSettings()
Get the actually used settings (this is only available after the camera has been opened).
This is for information purposes only (to see what settings are actually used). To change the settings use the getPreferredCameraConfig instead.
- Returns:
the actually used settings (or null if camera not yet opened)
-
setCameraOpenListener
void setCameraOpenListener(CameraOpenListener listener)
Set the listener that is called when the camera is opened or a camera related error occurred. If not set the opening of the camera will be logged and an error will be thrown as a RuntimeException.
- Parameters:
listener
- the listener
-
setHighResolutionImageListener
void setHighResolutionImageListener(HighResolutionImageListener highResolutionImageListener)
Sets an optional listener which is called with the final AnylineImage, once a picture was taken with the camera via the takeHighResolutionImage method.
- Parameters:
highResolutionImageListener
- the listener to call if a picture was taken (or an error occured)
-
getScale
float getScale()
- Returns:
the scale that is applied to the actual image size in order to fit the view (e.g. will be 1.5 on fullscreen on a 1080p display with 720p preview)
-
getScaleWidth
float getScaleWidth()
-
getFrameWidth
int getFrameWidth()
- Returns:
the full width of the preview frame
-
getFrameHeight
int getFrameHeight()
- Returns:
the full height of the preview frame
-
getCameraController
@NonNull() CameraController getCameraController()
- Returns:
the object controlling the camera
-
callAutoFocus
void callAutoFocus()
Call auto focus. This will only do anything if the focus mode is set to auto. It usually should not be called manually. (is called through interval or through touch automatically if configured)
-
setFlashOn
void setFlashOn(boolean isOn)
Turn the torch flash on or off. Will only have an effect after the camera is opened.
- Parameters:
isOn
- true to turn the flash on false to turn it off
-
resetAutoFocusTimer
void resetAutoFocusTimer()
Reset the auto focus timer, if a focus config is set.
-
setImageListener
void setImageListener(@Nullable() ImageListener imageListener)
Set the listener that should be called when a new image is available
- Parameters:
imageListener
- the listener that should be notified if a new image is available
-
hasNewImage
boolean hasNewImage()
- Returns:
true if a new image is available in the buffer
-
takeHighResolutionImage
void takeHighResolutionImage()
Takes a picture from the camera and calls onImageTaken after the image is taken successfully. If no HighResolutionImageListener is set, the method returns. Additionally, a picture is only taken if the safeToTakePicture flag is set to true, which means the camera is open and preview is started.
-
takeHighResolutionImage
void takeHighResolutionImage(int top, int left, int right, int bottom, int scanViewWidth, int scanViewHeight)
-
getLastImageWithFullSize
@Nullable() AnylineImage getLastImageWithFullSize()
Get the latest image in full size. This does not check or manipulate hasNewImage.
Prefer getLastImageWithFullSizeReceiver, if you are not sure if the image is actually needed, to save resources.
- Returns:
the latest image in full size.
-
getLastImageWithFullSizeReceiver
@Nullable() ImageReceiver getLastImageWithFullSizeReceiver()
Get the a receiver for the latest image in full size. This does not check or manipulate hasNewImage.
The receiver does not copy the image if no getter is called.
- Returns:
a receiver for the latest image in full size.
-
openCameraInBackground
boolean openCameraInBackground()
Open the camera in a background thread, if surface is already created and camera is not opened already. Reports opening or error to the CameraOpenListener set with setCameraOpenListener.
-
releaseCameraInBackground
void releaseCameraInBackground()
Release the camera in a background thread. Camera releasing may take a bit, so it may interfere with your exit animation. Use this to do it in the background.
ALWAYS call this or releaseCamera in onPause of your activity!!
-
releaseCameraAndPreview
void releaseCameraAndPreview()
-
releaseCamera
void releaseCamera()
Release the camera.
ALWAYS call this or releaseCameraInBackground in onPause of your activity!!
-
onTouchEvent
boolean onTouchEvent(MotionEvent event)
-
addImageReceivedEventListener
void addImageReceivedEventListener(Event<AnylineImage> imageReceivedEvent)
-
removeImageReceivedEventListener
void removeImageReceivedEventListener(Event<AnylineImage> imageReceivedEvent)
-
isBarcodeDetectionEnabled
boolean isBarcodeDetectionEnabled()
-
isBarcodeDetectionOperational
boolean isBarcodeDetectionOperational()
-
addNativeBarcodeReceivedEventListener
void addNativeBarcodeReceivedEventListener(Event<Pair<AnylineYuvImage, BarcodeResult>> nativeBarcodeReceivedEvent, List<BarcodeFormat> supportedFormats)
-
removeNativeBarcodeReceivedEventListener
void removeNativeBarcodeReceivedEventListener(Event<Pair<AnylineYuvImage, BarcodeResult>> nativeBarcodeReceivedEvent)
-
isNativeBarcodeDetectionEnabled
boolean isNativeBarcodeDetectionEnabled()
-
setPreviewCropGravity
void setPreviewCropGravity(int cropGravity)
-
-
-
-