public abstract class BaseCameraView
extends android.view.ViewGroup
| Modifier and Type | Class and Description |
|---|---|
protected class |
BaseCameraView.BaseCameraListener |
protected class |
BaseCameraView.BaseCameraViewEventsListener |
protected class |
BaseCameraView.BaseOrientationChangeListener |
static class |
BaseCameraView.CameraViewState |
android.view.ViewGroup.LayoutParams, android.view.ViewGroup.MarginLayoutParams, android.view.ViewGroup.OnHierarchyChangeListenerandroid.view.View.AccessibilityDelegate, android.view.View.BaseSavedState, android.view.View.DragShadowBuilder, android.view.View.MeasureSpec, android.view.View.OnApplyWindowInsetsListener, android.view.View.OnAttachStateChangeListener, android.view.View.OnClickListener, android.view.View.OnContextClickListener, android.view.View.OnCreateContextMenuListener, android.view.View.OnDragListener, android.view.View.OnFocusChangeListener, android.view.View.OnGenericMotionListener, android.view.View.OnHoverListener, android.view.View.OnKeyListener, android.view.View.OnLayoutChangeListener, android.view.View.OnLongClickListener, android.view.View.OnScrollChangeListener, android.view.View.OnSystemUiVisibilityChangeListener, android.view.View.OnTouchListener| Modifier and Type | Field and Description |
|---|---|
protected CameraAspectMode |
mAspectMode
Defines the way camera preview will be layouted inside view
|
protected CameraEventsListener |
mCameraEventsListener
Listener that will receive various camera events
|
protected ICameraView |
mCameraSurfaceView
View element
|
protected BaseCameraView.CameraViewState |
mCameraViewState |
protected int |
mConfigurationOrientation
Current configuration orientation
|
protected DeviceManager |
mDeviceManager
Device manager that will load device list from resources
|
protected boolean |
mErrorState
Flag indicating there has been an unrecoverable error
|
protected int |
mHostScreenOrientation
Orientation of the host activity
|
protected Orientation |
mInitialOrientation
Initial orientation which will be used for frame orientation if mOrientation is unknown
|
protected boolean |
mIsRequestedOrientationSensor |
protected boolean |
mIsRequestedOrientationUser |
protected OnActivityFlipListener |
mOnActivityFlipListener
Listener that will be notified when activity flip occurs.
|
protected OrientationChangeListener |
mOrientationChangeListener |
protected boolean |
mRotateMeteringAreas |
protected OrientationChangeListener |
mSlaveOrientationChangeListener
Slave orientation change listener that can be notified of orientation change events generated by mOrientationManager
|
CLIP_TO_PADDING_MASK, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, LAYOUT_MODE_CLIP_BOUNDS, LAYOUT_MODE_OPTICAL_BOUNDS, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHEACCESSIBILITY_LIVE_REGION_ASSERTIVE, ACCESSIBILITY_LIVE_REGION_NONE, ACCESSIBILITY_LIVE_REGION_POLITE, ALPHA, DRAG_FLAG_GLOBAL, DRAG_FLAG_GLOBAL_PERSISTABLE_URI_PERMISSION, DRAG_FLAG_GLOBAL_PREFIX_URI_PERMISSION, DRAG_FLAG_GLOBAL_URI_READ, DRAG_FLAG_GLOBAL_URI_WRITE, DRAG_FLAG_OPAQUE, DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FIND_VIEWS_WITH_CONTENT_DESCRIPTION, FIND_VIEWS_WITH_TEXT, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, IMPORTANT_FOR_ACCESSIBILITY_AUTO, IMPORTANT_FOR_ACCESSIBILITY_NO, IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS, IMPORTANT_FOR_ACCESSIBILITY_YES, INVISIBLE, KEEP_SCREEN_ON, LAYER_TYPE_HARDWARE, LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE, LAYOUT_DIRECTION_LTR, LAYOUT_DIRECTION_RTL, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, NO_ID, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCREEN_STATE_OFF, SCREEN_STATE_ON, SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_NONE, SCROLL_AXIS_VERTICAL, SCROLL_INDICATOR_BOTTOM, SCROLL_INDICATOR_END, SCROLL_INDICATOR_LEFT, SCROLL_INDICATOR_RIGHT, SCROLL_INDICATOR_START, SCROLL_INDICATOR_TOP, SCROLLBAR_POSITION_DEFAULT, SCROLLBAR_POSITION_LEFT, SCROLLBAR_POSITION_RIGHT, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, STATUS_BAR_HIDDEN, STATUS_BAR_VISIBLE, SYSTEM_UI_FLAG_FULLSCREEN, SYSTEM_UI_FLAG_HIDE_NAVIGATION, SYSTEM_UI_FLAG_IMMERSIVE, SYSTEM_UI_FLAG_IMMERSIVE_STICKY, SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_STABLE, SYSTEM_UI_FLAG_LIGHT_STATUS_BAR, SYSTEM_UI_FLAG_LOW_PROFILE, SYSTEM_UI_FLAG_VISIBLE, SYSTEM_UI_LAYOUT_FLAGS, TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_GRAVITY, TEXT_ALIGNMENT_INHERIT, TEXT_ALIGNMENT_TEXT_END, TEXT_ALIGNMENT_TEXT_START, TEXT_ALIGNMENT_VIEW_END, TEXT_ALIGNMENT_VIEW_START, TEXT_DIRECTION_ANY_RTL, TEXT_DIRECTION_FIRST_STRONG, TEXT_DIRECTION_FIRST_STRONG_LTR, TEXT_DIRECTION_FIRST_STRONG_RTL, TEXT_DIRECTION_INHERIT, TEXT_DIRECTION_LOCALE, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, TRANSLATION_X, TRANSLATION_Y, TRANSLATION_Z, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y, Z| Constructor and Description |
|---|
BaseCameraView(android.content.Context context) |
BaseCameraView(android.content.Context context,
android.util.AttributeSet attrs) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
areCameraPixelsLandscapeLeft() |
protected int |
calculateHostScreenOrientation() |
void |
changeConfiguration(android.content.res.Configuration newConfiguration)
This method changes the view's configuration.
|
protected void |
changeConfigurationInternal(android.content.res.Configuration newConfiguration) |
void |
create()
Creates the view and its subviews and initializes camera settings.
|
protected abstract CameraListener |
createCameraListener()
ABSTRACT METHODS
|
protected ICameraView.CameraViewEventListener |
createCameraViewEventsListener() |
protected OrientationChangeListener |
createOrientationChangeListener() |
void |
destroy() |
boolean |
dispatchTouchEvent(android.view.MotionEvent ev) |
void |
focusCamera()
Request a new autofocus cycle from camera.
|
protected Orientation |
getActivityOrientation() |
CameraAspectMode |
getAspectMode()
Returns the aspect mode of camera preview.
|
CameraEventsListener |
getCameraEventsListener()
Returns the current camera events listener.
|
protected CameraSettings |
getCameraFactorySettings() |
int |
getCameraPreviewHeight()
Returns the height in pixels of the actual camera preview (does not have to be same as getHeight).
|
int |
getCameraPreviewWidth()
Returns the width in pixels of the actual camera preview (does not have to be same as getWidth).
|
BaseCameraView.CameraViewState |
getCameraViewState()
Returns the current lifecycle state of camera view.
|
protected int |
getConfigurationOrientation() |
Orientation |
getCurrentOrientation() |
protected android.app.Activity |
getHostActivity() |
int |
getHostScreenOrientation()
Returns the host's screen orientation as detected internally.
|
Orientation |
getInitialOrientation()
Returns the initial orientation of rotatable view as set by setInitialOrientation.
|
CameraType |
getOpenedCameraType()
Returns the type of the currently opened camera or null if currently there is no opened camera.
|
OrientationChangeListener |
getOrientationChangeListener()
Returns the current oreintation change listener
|
android.graphics.RectF |
getVisiblePart()
Returns the rectangle that which part of camera frame is visible in view
|
float |
getZoomLevel()
Returns the current camera zoom level.
|
java.lang.Boolean |
isAutofocusSupported()
Returns true if opened camera supports autofocus.
|
boolean |
isCameraActive()
Returns true if camera is currently active.
|
boolean |
isCameraFocused()
Returns true if camera is currently in focus
|
boolean |
isCameraTorchSupported()
Returns true if camera has got torch.
|
boolean |
isDeviceShaking()
Returns true if the device is being shaken
|
protected boolean |
isHostActivityOrientationOnSensor() |
protected boolean |
isOrientationAllowed(Orientation orientation) |
boolean |
isPinchToZoomAllowed()
Returns true if camera view will handle pinch events to manage camera zoom level.
|
protected static boolean |
isRequestedOrientationSensor(int requestedOrientation) |
protected boolean |
isRequestedOrientationUser(int requestedOrientation) |
boolean |
isTapToFocusAllowed()
Returns true if camera view will handle tap events to ask camera to perform autofocus
on tapped area.
|
protected abstract void |
onActivityFlip()
Called when activity is flipped - this event is not raised by OS so we have custom detection
of that state.
|
protected void |
onCameraPreviewStarted() |
protected void |
onCameraPreviewStopped() |
protected ICameraManager |
onCreateCameraManager(CameraSettings settings)
Called inside onCreate method.
|
protected void |
onLayout(boolean changed,
int l,
int t,
int r,
int b) |
protected void |
onMeasure(int widthMeasureSpec,
int heightMeasureSpec) |
void |
pause()
This method must be called from activity's onPause.
|
protected void |
prepareCameraSettings(CameraSettings settings)
Called inside onCreate method before creating camera manager.
|
protected abstract boolean |
requireAutofocusFeature()
If autofocus feature is required, please return true from this method.
|
void |
resume()
This method must be called from activity's onResume.
|
protected void |
runOnUIThread(java.lang.Runnable runnable)
Ensures given runnable is run on UI thread.
|
void |
setAspectMode(CameraAspectMode aspectMode)
Defines the aspect mode of camera preview.
|
void |
setCameraEventsListener(CameraEventsListener cameraEventsListener)
Sets the listener that will receive various camera events, such as when camera preview has
started or camera initialization error has occurred.
|
void |
setCameraType(CameraType cameraType)
Sets the camera type that will be used.
|
void |
setForceUseLegacyCamera(boolean useLegacyCamera)
With this method you can request using legacy Camera API even on devices that natively support new Camera2 API.
|
void |
setInitialOrientation(Orientation initialOrientation)
Sets the initial orientation of rotatable view and recognizer.
|
void |
setMeteringAreas(android.graphics.RectF[] meteringAreas,
boolean rotateAreasWithDevice)
Sets the areas where camera will perform focus, exposure and white balance meterings.
|
protected void |
setMeteringAreasToCamera() |
void |
setOnActivityFlipListener(OnActivityFlipListener onActivityFlipListener)
Sets the listener that will be notified when activity flip event occurs.
|
void |
setOnSizeChangedListener(OnSizeChangedListener onSizeChangedListener)
Sets the listener that will be notified when size of child views changes.
|
void |
setOptimizeCameraForNearScan(boolean nearScan) |
void |
setOrientationAllowedListener(OrientationAllowedListener orientationAllowedListener)
Sets the listener that will be asked if device orientation is allowed prior rotating
rotatable view and native recognizer to that orientation.
|
void |
setOrientationChangeListener(OrientationChangeListener orientationChangeListener)
Sets the orientation listener that will receive orientation change events that are already reported
to BaseCameraView.
|
void |
setPhotoMode(boolean photoMode) |
void |
setPinchToZoomAllowed(boolean allowPinchToZoom)
Sets whether camear view will handle pinch events to manage camera zoom level.
|
void |
setRequestAutofocusOnShakingStopInContinousAutofocusMode(boolean requestAutofocusOnShakingStopInContinousAutofocusMode)
If device supports continous autofocus mode, enabling this feature will request normal autofocus every time device shaking
stops.
|
void |
setShakeListener(ShakeCallback shakeCallback)
Sets the shake callback that will be notified about device shake events.
|
void |
setTapToFocusAllowed(boolean allowTapToFocus)
Sets whether camera view will handle tap events to ask camera to perform autofocus
on tapped area.
|
void |
setTorchState(boolean on,
SuccessCallback successCallback)
Turns the torch on the camera on or off.
|
void |
setUseTextureViewForCameraDisplay(boolean forceTextureView)
In order to display camera preview, camera view must use one of two android's view's that are
capable of displaying camera preview video stream.
|
void |
setVideoResolutionPreset(VideoResolutionPreset preset) |
void |
setZoomLevel(float zoomLevel)
Sets the camera zoom level.
|
protected boolean |
shouldStartCamera() |
void |
start() |
void |
stop() |
addChildrenForAccessibility, addFocusables, addStatesFromChildren, addTouchables, addView, addView, addView, addView, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, canAnimate, checkLayoutParams, childDrawableStateChanged, childHasTransientStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchApplyWindowInsets, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchDrawableHotspotChanged, dispatchFreezeSelfOnly, dispatchGenericFocusedEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchProvideStructure, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchSystemUiVisibilityChanged, dispatchThawSelfOnly, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, drawableStateChanged, drawChild, endViewTransition, findFocus, findViewsWithText, focusableViewAvailable, focusSearch, gatherTransparentRegion, generateDefaultLayoutParams, generateLayoutParams, generateLayoutParams, getAccessibilityClassName, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getNestedScrollAxes, getOverlay, getPersistentDrawingCache, getTouchscreenBlocksFocus, hasFocus, hasFocusable, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, isMotionEventSplittingEnabled, isTransitionGroup, jumpDrawablesToCurrentState, layout, measureChild, measureChildren, measureChildWithMargins, notifySubtreeAccessibilityStateChanged, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAttachedToWindow, onCreateDrawableState, onDetachedFromWindow, onInterceptHoverEvent, onInterceptTouchEvent, onNestedFling, onNestedPreFling, onNestedPrePerformAccessibilityAction, onNestedPreScroll, onNestedScroll, onNestedScrollAccepted, onRequestFocusInDescendants, onRequestSendAccessibilityEvent, onResolvePointerIcon, onStartNestedScroll, onStopNestedScroll, onViewAdded, onViewRemoved, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeDetachedView, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestSendAccessibilityEvent, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setStaticTransformationsEnabled, setTouchscreenBlocksFocus, setTransitionGroup, shouldDelayChildPressedState, showContextMenuForChild, showContextMenuForChild, startActionModeForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, updateViewLayoutaddFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, animate, announceForAccessibility, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelDragAndDrop, cancelLongPress, cancelPendingInputEvents, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, checkInputConnectionProxy, clearAnimation, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeSystemWindowInsets, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchFinishTemporaryDetach, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPopulateAccessibilityEvent, dispatchStartTemporaryDetach, draw, drawableHotspotChanged, findViewById, findViewWithTag, fitSystemWindows, focusSearch, forceHasOverlappingRendering, forceLayout, generateViewId, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAlpha, getAnimation, getApplicationWindowToken, getBackground, getBackgroundTintList, getBackgroundTintMode, getBaseline, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentDescription, getContext, getContextMenuInfo, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getImportantForAccessibility, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineProvider, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getPointerIcon, getResources, getRevealOnFocusHint, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowId, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasNestedScrollingParent, hasOnClickListeners, hasOverlappingRendering, hasWindowFocus, inflate, invalidate, invalidate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityFocused, isActivated, isAttachedToWindow, isClickable, isContextClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isInEditMode, isInLayout, isInTouchMode, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingOffsetRequired, isPaddingRelative, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAnimationEnd, onAnimationStart, onApplyWindowInsets, onCancelPendingInputEvents, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateInputConnection, onDisplayHint, onDragEvent, onDraw, onDrawForeground, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onOverScrolled, onPopulateAccessibilityEvent, onProvideStructure, onProvideVirtualStructure, onRestoreInstanceState, onRtlPropertiesChanged, onSaveInstanceState, onScreenStateChanged, onScrollChanged, onSetAlpha, onSizeChanged, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onVisibilityAggregated, onVisibilityChanged, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performAccessibilityAction, performClick, performContextClick, performContextClick, performHapticFeedback, performHapticFeedback, performLongClick, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, requestUnbufferedDispatch, resolveSize, resolveSizeAndState, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityLiveRegion, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAlpha, setAnimation, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentDescription, setContextClickable, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setForeground, setForegroundGravity, setForegroundTintList, setForegroundTintMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setKeepScreenOn, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineProvider, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPointerIcon, setPressed, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setStateListAnimator, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTop, setTouchDelegate, setTransitionName, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, showContextMenu, showContextMenu, startActionMode, startActionMode, startAnimation, startDrag, startDragAndDrop, startNestedScroll, stopNestedScroll, toString, unscheduleDrawable, unscheduleDrawable, updateDragShadow, verifyDrawable, willNotCacheDrawing, willNotDrawclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcanResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, createContextMenu, getLayoutDirection, getParent, getParentForAccessibility, getTextAlignment, getTextDirection, isLayoutDirectionResolved, isLayoutRequested, isTextAlignmentResolved, isTextDirectionResolved, requestFitSystemWindows, requestLayoutprotected CameraEventsListener mCameraEventsListener
protected boolean mErrorState
protected DeviceManager mDeviceManager
protected BaseCameraView.CameraViewState mCameraViewState
protected ICameraView mCameraSurfaceView
protected int mConfigurationOrientation
protected OnActivityFlipListener mOnActivityFlipListener
protected int mHostScreenOrientation
protected CameraAspectMode mAspectMode
protected boolean mIsRequestedOrientationSensor
protected boolean mIsRequestedOrientationUser
protected OrientationChangeListener mOrientationChangeListener
protected boolean mRotateMeteringAreas
protected Orientation mInitialOrientation
protected OrientationChangeListener mSlaveOrientationChangeListener
public BaseCameraView(android.content.Context context)
public BaseCameraView(android.content.Context context,
android.util.AttributeSet attrs)
protected static boolean isRequestedOrientationSensor(int requestedOrientation)
protected boolean isRequestedOrientationUser(int requestedOrientation)
protected Orientation getActivityOrientation()
protected int calculateHostScreenOrientation()
protected void runOnUIThread(java.lang.Runnable runnable)
runnable - @UiThread public void changeConfiguration(android.content.res.Configuration newConfiguration)
newConfiguration - New view configuration@CallSuper protected void changeConfigurationInternal(android.content.res.Configuration newConfiguration)
protected android.app.Activity getHostActivity()
@UiThread @CallSuper public void create()
@UiThread @CallSuper public void destroy()
protected void prepareCameraSettings(CameraSettings settings)
protected CameraSettings getCameraFactorySettings()
protected ICameraManager onCreateCameraManager(CameraSettings settings)
settings - camera settings as returned by onCreateCameraFactorySettingsprotected boolean shouldStartCamera()
protected void onCameraPreviewStarted()
protected void onCameraPreviewStopped()
@UiThread @CallSuper public void start()
@UiThread @CallSuper public void resume()
@UiThread @CallSuper public void pause()
@UiThread @CallSuper public void stop()
@UiThread
protected void onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
onMeasure in class android.view.View@UiThread public boolean dispatchTouchEvent(android.view.MotionEvent ev)
dispatchTouchEvent in class android.view.ViewGroup@UiThread
protected void onLayout(boolean changed,
int l,
int t,
int r,
int b)
onLayout in class android.view.ViewGroup@UiThread public final boolean isCameraFocused()
@UiThread public final CameraType getOpenedCameraType()
@UiThread public final void focusCamera()
@UiThread public final boolean isCameraTorchSupported()
@Nullable @UiThread public final java.lang.Boolean isAutofocusSupported()
@UiThread
public final void setTorchState(boolean on,
SuccessCallback successCallback)
on - If true, torch will be turned on, if false, torch will be turned off.successCallback - callback that will receive information if torch was successfully put in desired stateprotected boolean areCameraPixelsLandscapeLeft()
@UiThread public final float getZoomLevel()
@UiThread public final void setZoomLevel(float zoomLevel)
zoomLevel - Desired camera zoom level.@UiThread public final BaseCameraView.CameraViewState getCameraViewState()
public final boolean isTapToFocusAllowed()
public final void setTapToFocusAllowed(boolean allowTapToFocus)
allowTapToFocus - whether or not tap to focus is allowedpublic final boolean isPinchToZoomAllowed()
public final void setPinchToZoomAllowed(boolean allowPinchToZoom)
allowPinchToZoom - whether or not pinch to zoom is allowed. Default is false.public final boolean isDeviceShaking()
public final int getCameraPreviewWidth()
public final int getCameraPreviewHeight()
@UiThread
public final void setMeteringAreas(android.graphics.RectF[] meteringAreas,
boolean rotateAreasWithDevice)
meteringAreas - array of rectangles that define areas where camera will perform focus, exposure and white balance meterings.rotateAreasWithDevice - if set to true, metering areas will be readjusted each time device orientation changesjava.lang.NullPointerException - if at least one element of meteringAreas is nulljava.lang.IllegalArgumentException - if at least on element of meteringAreas has either zero surface or is not inside viewjava.lang.IllegalStateException - if camera is not activeprotected void setMeteringAreasToCamera()
public final boolean isCameraActive()
protected final int getConfigurationOrientation()
@UiThread public void setCameraType(CameraType cameraType)
cameraType - @UiThread public void setShakeListener(ShakeCallback shakeCallback)
shakeCallback - public CameraAspectMode getAspectMode()
@UiThread public void setAspectMode(CameraAspectMode aspectMode)
aspectMode - desired aspect mode@UiThread public final void setOnSizeChangedListener(OnSizeChangedListener onSizeChangedListener)
onSizeChangedListener - @UiThread public final void setOnActivityFlipListener(OnActivityFlipListener onActivityFlipListener)
onActivityFlipListener - Activity flip listener@UiThread public final void setVideoResolutionPreset(VideoResolutionPreset preset)
preset - Sets the preset that will be used for choosing camera video resolution.@UiThread public final void setForceUseLegacyCamera(boolean useLegacyCamera)
useLegacyCamera - If set to true, legacy Camera API will be used even on devices that support new Camera2 API.@UiThread public final void setRequestAutofocusOnShakingStopInContinousAutofocusMode(boolean requestAutofocusOnShakingStopInContinousAutofocusMode)
requestAutofocusOnShakingStopInContinousAutofocusMode - will autofocus be requested each time device shaking stops.@UiThread public final void setPhotoMode(boolean photoMode)
photoMode - If set to true, Photo camera manager will be used instead of Video camera manager. Thus, user will have to
take the picture before it goes to recognition. Default is false.@UiThread public final void setOptimizeCameraForNearScan(boolean nearScan)
nearScan - Flag which indicates camera parameters should be optimized for near object scanning.
When camera parameters are optimized for near object scanning, macro focus mode will be
preferred over autofocus mode. Thus, camera will have easier time focusing on to near objects,
but might have harder time focusing on far objects. If you expect that most of your scans
will be performed by holding the device very near the object, turn on that parameter. By default,
this parameter is set to false.@UiThread public final void setUseTextureViewForCameraDisplay(boolean forceTextureView)
forceTextureView - Whether TextureView should be used even for legacy camera API.public CameraEventsListener getCameraEventsListener()
@UiThread public void setCameraEventsListener(CameraEventsListener cameraEventsListener)
cameraEventsListener - public int getHostScreenOrientation()
public android.graphics.RectF getVisiblePart()
protected OrientationChangeListener createOrientationChangeListener()
protected ICameraView.CameraViewEventListener createCameraViewEventsListener()
protected abstract boolean requireAutofocusFeature()
protected abstract void onActivityFlip()
protected abstract CameraListener createCameraListener()
protected boolean isHostActivityOrientationOnSensor()
public Orientation getCurrentOrientation()
protected final boolean isOrientationAllowed(Orientation orientation)
public final Orientation getInitialOrientation()
@UiThread @CallSuper public void setInitialOrientation(Orientation initialOrientation)
initialOrientation - @UiThread public void setOrientationAllowedListener(OrientationAllowedListener orientationAllowedListener)
public OrientationChangeListener getOrientationChangeListener()
public void setOrientationChangeListener(OrientationChangeListener orientationChangeListener)
orientationChangeListener -