Package com.microblink.photopay.view
Class BaseCameraView
java.lang.Object
android.view.View
android.view.ViewGroup
com.microblink.photopay.view.BaseCameraView
- All Implemented Interfaces:
android.graphics.drawable.Drawable.Callback,android.view.accessibility.AccessibilityEventSource,android.view.KeyEvent.Callback,android.view.ViewManager,android.view.ViewParent
- Direct Known Subclasses:
CameraViewGroup
public abstract class BaseCameraView
extends android.view.ViewGroup
Created by dodo on 25/08/16.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classprotected classprotected classstatic enumprotected static interfaceNested classes/interfaces inherited from class android.view.ViewGroup
android.view.ViewGroup.LayoutParams, android.view.ViewGroup.MarginLayoutParams, android.view.ViewGroup.OnHierarchyChangeListenerNested classes/interfaces inherited from class android.view.View
android.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.OnCapturedPointerListener, 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, android.view.View.OnUnhandledKeyEventListener -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CameraAspectModeDefines the way camera preview will be layouted inside viewprotected CameraEventsListenerListener that will receive various camera eventsprotected com.microblink.photopay.view.surface.ICameraViewView elementprotected BaseCameraView.CameraViewStateprotected intCurrent configuration orientationprotected com.microblink.photopay.hardware.DeviceManagerDevice manager that will load device list from resourcesprotected booleanFlag indicating there has been an unrecoverable errorprotected intOrientation of the host activityprotected OrientationInitial orientation which will be used for frame orientation if mOrientation is unknownprotected booleanprotected booleanprotected OnActivityFlipListenerListener that will be notified when activity flip occurs.protected com.microblink.photopay.hardware.orientation.OrientationChangeListenerprotected floatprotected booleanprotected ConcurrentLinkedQueue<com.microblink.photopay.hardware.orientation.OrientationChangeListener>Slave orientation change listeners that can be notified on orientation change events generated by mOrientationManagerFields inherited from class android.view.ViewGroup
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_CACHEFields inherited from class android.view.View
ACCESSIBILITY_DATA_SENSITIVE_AUTO, ACCESSIBILITY_DATA_SENSITIVE_NO, ACCESSIBILITY_DATA_SENSITIVE_YES, ACCESSIBILITY_LIVE_REGION_ASSERTIVE, ACCESSIBILITY_LIVE_REGION_NONE, ACCESSIBILITY_LIVE_REGION_POLITE, ALPHA, AUTOFILL_FLAG_INCLUDE_NOT_IMPORTANT_VIEWS, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH, AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR, AUTOFILL_HINT_CREDIT_CARD_NUMBER, AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE, AUTOFILL_HINT_EMAIL_ADDRESS, AUTOFILL_HINT_NAME, AUTOFILL_HINT_PASSWORD, AUTOFILL_HINT_PHONE, AUTOFILL_HINT_POSTAL_ADDRESS, AUTOFILL_HINT_POSTAL_CODE, AUTOFILL_HINT_USERNAME, AUTOFILL_TYPE_DATE, AUTOFILL_TYPE_LIST, AUTOFILL_TYPE_NONE, AUTOFILL_TYPE_TEXT, AUTOFILL_TYPE_TOGGLE, CONTENT_SENSITIVITY_AUTO, CONTENT_SENSITIVITY_NOT_SENSITIVE, CONTENT_SENSITIVITY_SENSITIVE, DRAG_FLAG_ACCESSIBILITY_ACTION, DRAG_FLAG_GLOBAL, DRAG_FLAG_GLOBAL_PERSISTABLE_URI_PERMISSION, DRAG_FLAG_GLOBAL_PREFIX_URI_PERMISSION, DRAG_FLAG_GLOBAL_SAME_APPLICATION, DRAG_FLAG_GLOBAL_URI_READ, DRAG_FLAG_GLOBAL_URI_WRITE, DRAG_FLAG_OPAQUE, DRAG_FLAG_START_INTENT_SENDER_ON_UNHANDLED_DRAG, 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, FOCUSABLE, FOCUSABLE_AUTO, 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, IMPORTANT_FOR_AUTOFILL_AUTO, IMPORTANT_FOR_AUTOFILL_NO, IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS, IMPORTANT_FOR_AUTOFILL_YES, IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS, IMPORTANT_FOR_CONTENT_CAPTURE_AUTO, IMPORTANT_FOR_CONTENT_CAPTURE_NO, IMPORTANT_FOR_CONTENT_CAPTURE_NO_EXCLUDE_DESCENDANTS, IMPORTANT_FOR_CONTENT_CAPTURE_YES, IMPORTANT_FOR_CONTENT_CAPTURE_YES_EXCLUDE_DESCENDANTS, 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, NOT_FOCUSABLE, 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, REQUESTED_FRAME_RATE_CATEGORY_DEFAULT, REQUESTED_FRAME_RATE_CATEGORY_HIGH, REQUESTED_FRAME_RATE_CATEGORY_LOW, REQUESTED_FRAME_RATE_CATEGORY_NO_PREFERENCE, REQUESTED_FRAME_RATE_CATEGORY_NORMAL, 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_CAPTURE_HINT_AUTO, SCROLL_CAPTURE_HINT_EXCLUDE, SCROLL_CAPTURE_HINT_EXCLUDE_DESCENDANTS, SCROLL_CAPTURE_HINT_INCLUDE, 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_NAVIGATION_BAR, 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 Summary
ConstructorsConstructorDescriptionBaseCameraView(android.content.Context context) BaseCameraView(android.content.Context context, android.util.AttributeSet attrs) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddOrientationChangeListener(com.microblink.photopay.hardware.orientation.OrientationChangeListener orientationChangeListener) Adds the orientation listener that will receive orientation change events that are already reported to BaseCameraView.protected booleanprotected intprotected voidvoidchangeConfiguration(android.content.res.Configuration newConfiguration) This method changes the view's configuration.protected voidchangeConfigurationInternal(android.content.res.Configuration newConfiguration) voidcreate()Creates the view and its subviews and initializes camera settings.protected abstract com.microblink.photopay.hardware.camera.CameraListenerABSTRACT METHODSprotected com.microblink.photopay.view.surface.ICameraView.CameraViewEventListenerprotected com.microblink.photopay.hardware.orientation.OrientationChangeListenervoiddestroy()booleandispatchTouchEvent(android.view.MotionEvent ev) final voidRequest a new autofocus cycle from camera.Returns the aspect mode of camera preview.Returns the current camera events listener.protected com.microblink.photopay.hardware.camera.CameraSettingsfinal intReturns the height in pixels of the actual camera preview (does not have to be same as getHeight).final intReturns the width in pixels of the actual camera preview (does not have to be same as getWidth).protected intReturns the current lifecycle state of camera view.protected final intfinal intReturns the current high res frame limitprotected android.app.ActivityintReturns the host's screen orientation as detected internally.final OrientationReturns the initial orientation of rotatable view as set by setInitialOrientation.final CameraTypeReturns the type of the currently opened camera or null if currently there is no opened camera.floatReturns the preview zoom scale that is used to draw the camera preview.android.graphics.RectFReturns the rectangle that which part of camera frame is visible in viewfinal floatReturns the current camera zoom level.final BooleanReturns true if opened camera supports autofocus.final booleanReturns true if camera is currently active.final booleanReturns true if camera is currently in focusfinal booleanReturns true if camera has got torch.final booleanReturns true if the device is being shakenbooleanReturns true if high res frame capture was enabled.protected booleanprotected final booleanisOrientationAllowed(Orientation orientation) final booleanReturns true if camera view will handle pinch events to manage camera zoom level.protected static booleanisRequestedOrientationSensor(int requestedOrientation) protected booleanisRequestedOrientationUser(int requestedOrientation) final booleanReturns true if camera view will handle tap events to ask camera to perform autofocus on tapped area.protected abstract voidCalled when activity is flipped - this event is not raised by OS so we have custom detection of that state.protected voidprotected voidprotected voidonLayout(boolean changed, int l, int t, int r, int b) protected voidonMeasure(int widthMeasureSpec, int heightMeasureSpec) voidpause()This method must be called from activity's onPause.protected voidprepareCameraSettings(com.microblink.photopay.hardware.camera.CameraSettings settings) Called inside onCreate method before creating camera manager.voidremoveOrientationChangeListener(com.microblink.photopay.hardware.orientation.OrientationChangeListener orientationChangeListener) Removes a single listener instance from listeners collection, if it is present.protected abstract booleanIf autofocus feature is required, please return true from this method.voidresume()This method must be called from activity's onResume.protected voidrunOnUIThread(Runnable runnable) Ensures given runnable is run on UI thread.voidsetAspectMode(CameraAspectMode aspectMode) Defines the aspect mode of camera preview.voidsetCameraEventsListener(CameraEventsListener cameraEventsListener) Sets the listener that will receive various camera events, such as when camera preview has started or camera initialization error has occurred.final voidsetCameraFrameFactory(com.microblink.photopay.hardware.camera.frame.CameraFrameFactory cameraFrameFactory) Set your custom implementation of camera frame factory.voidsetCameraType(CameraType cameraType) Sets the camera type that will be used.final voidsetForceUseLegacyCamera(boolean useLegacyCamera) With this method you can request using legacy Camera API even on devices that natively support new Camera2 API.voidsetHighResFrameCaptureEnabled(boolean enabled) High res frame capture is disabled by default and needs to be enabled by using this method.final voidsetHighResFrameLimit(int highResFrameLimit) Sets the maximum number of high res frames that can be active at a given moment.voidsetInitialOrientation(Orientation initialOrientation) Sets the initial orientation of rotatable view and recognizer.final voidsetMeteringAreas(android.graphics.RectF[] meteringAreas, boolean rotateAreasWithDevice) Sets the areas where camera will perform focus, exposure and white balance meterings.protected voidfinal voidsetOnActivityFlipListener(OnActivityFlipListener onActivityFlipListener) Sets the listener that will be notified when activity flip event occurs.final voidsetOnSizeChangedListener(OnSizeChangedListener onSizeChangedListener) Sets the listener that will be notified when size of child views changes.final voidsetOptimizeCameraForNearScan(boolean nearScan) voidsetOrientationAllowedListener(OrientationAllowedListener orientationAllowedListener) Sets the listener that will be asked if device orientation is allowed prior rotating rotatable view and native recognizer to that orientation.final voidsetPinchToZoomAllowed(boolean allowPinchToZoom) Sets whether camear view will handle pinch events to manage camera zoom level.voidsetPreviewZoomScale(float previewZoomScale) Sets the preview zoom scale that will be used to draw the camera preview.final voidsetRequestAutofocusOnShakingStopInContinousAutofocusMode(boolean requestAutofocusOnShakingStopInContinousAutofocusMode) If device supports continous autofocus mode, enabling this feature will request normal autofocus every time device shaking stops.final voidsetRequestedSurfaceViewForCameraDisplay(com.microblink.photopay.view.surface.CameraSurface requestedSurface) 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:SurfaceViewandTextureView.voidsetShakeListener(ShakeCallback shakeCallback) Sets the shake callback that will be notified about device shake events.final voidsetTapToFocusAllowed(boolean allowTapToFocus) Sets whether camera view will handle tap events to ask camera to perform autofocus on tapped area.final voidsetTorchState(boolean on, SuccessCallback successCallback) Turns the torch on the camera on or off.final voidprotected voidsetVisiblePartUpdateListener(BaseCameraView.VisiblePartUpdateListener visiblePartUpdateListener) final voidsetZoomLevel(float zoomLevel) Sets the camera zoom level.protected booleanvoidstart()voidstop()Methods inherited from class android.view.ViewGroup
addChildrenForAccessibility, addExtraDataToAccessibilityNodeInfo, addFocusables, addKeyboardNavigationClusters, 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, dispatchCapturedPointerEvent, dispatchConfigurationChanged, dispatchCreateViewTranslationRequest, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchFreezeSelfOnly, dispatchGenericFocusedEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPointerCaptureChanged, dispatchProvideAutofillStructure, dispatchProvideStructure, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchScrollCaptureSearch, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchThawSelfOnly, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowInsetsAnimationEnd, dispatchWindowInsetsAnimationPrepare, dispatchWindowInsetsAnimationProgress, dispatchWindowInsetsAnimationStart, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, drawableStateChanged, drawChild, endViewTransition, findFocus, findOnBackInvokedDispatcherForChild, findViewsWithText, focusableViewAvailable, focusSearch, gatherTransparentRegion, generateDefaultLayoutParams, generateLayoutParams, generateLayoutParams, getAccessibilityClassName, getChildAt, getChildCount, getChildDrawingOrder, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getNestedScrollAxes, getOverlay, getPersistentDrawingCache, getTouchscreenBlocksFocus, hasFocus, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, isLayoutSuppressed, isMotionEventSplittingEnabled, isTransitionGroup, jumpDrawablesToCurrentState, layout, measureChild, measureChildren, measureChildWithMargins, notifySubtreeAccessibilityStateChanged, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAttachedToWindow, onCreateDrawableState, onDescendantInvalidated, 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, restoreDefaultFocus, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setStaticTransformationsEnabled, setTouchscreenBlocksFocus, setTransitionGroup, setWindowInsetsAnimationCallback, shouldDelayChildPressedState, showContextMenuForChild, showContextMenuForChild, startActionModeForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, suppressLayout, updateViewLayoutMethods inherited from class android.view.View
addFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, addOnUnhandledKeyEventListener, animate, announceForAccessibility, autofill, autofill, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelDragAndDrop, cancelLongPress, cancelPendingInputEvents, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, checkInputConnectionProxy, clearAnimation, clearPendingCredentialRequest, clearViewTranslationCallback, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeSystemWindowInsets, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPopulateAccessibilityEvent, draw, drawableHotspotChanged, findOnBackInvokedDispatcher, findViewById, findViewWithTag, fitSystemWindows, focusSearch, forceHasOverlappingRendering, forceLayout, generateDisplayHash, generateViewId, getAccessibilityDelegate, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityPaneTitle, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAllowedHandwritingDelegatePackageName, getAllowedHandwritingDelegatorPackageName, getAlpha, getAnimation, getAnimationMatrix, getApplicationWindowToken, getAttributeResolutionStack, getAttributeSourceResourceMap, getAutofillHints, getAutofillId, getAutofillType, getAutofillValue, getBackground, getBackgroundTintBlendMode, getBackgroundTintList, getBackgroundTintMode, getBaseline, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentCaptureSession, getContentDescription, getContentSensitivity, getContext, getContextMenuInfo, getDefaultFocusHighlightEnabled, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getExplicitStyle, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusable, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintBlendMode, getForegroundTintList, getForegroundTintMode, getFrameContentVelocity, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHandwritingBoundsOffsetBottom, getHandwritingBoundsOffsetLeft, getHandwritingBoundsOffsetRight, getHandwritingBoundsOffsetTop, getHandwritingDelegateFlags, getHandwritingDelegatorCallback, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getHorizontalScrollbarThumbDrawable, getHorizontalScrollbarTrackDrawable, getId, getImportantForAccessibility, getImportantForAutofill, getImportantForContentCapture, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInSurface, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineAmbientShadowColor, getOutlineProvider, getOutlineSpotShadowColor, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPendingCredentialCallback, getPendingCredentialRequest, getPivotX, getPivotY, getPointerIcon, getPreferKeepClearRects, getReceiveContentMimeTypes, getRequestedFrameRate, getResources, getRevealOnFocusHint, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootSurfaceControl, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollCaptureHint, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getSourceLayoutResId, getStateDescription, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemGestureExclusionRects, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTooltipText, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getTransitionAlpha, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getUniqueDrawingId, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarThumbDrawable, getVerticalScrollbarTrackDrawable, getVerticalScrollbarWidth, getViewTranslationResponse, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowId, getWindowInsetsController, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasExplicitFocusable, hasFocusable, hasNestedScrollingParent, hasOnClickListeners, hasOnLongClickListeners, hasOverlappingRendering, hasPointerCapture, hasWindowFocus, inflate, invalidate, invalidate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityDataSensitive, isAccessibilityFocused, isAccessibilityHeading, isActivated, isAttachedToWindow, isAutoHandwritingEnabled, isClickable, isContentSensitive, isContextClickable, isCredential, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isForceDarkAllowed, isHandwritingDelegate, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isImportantForAutofill, isImportantForContentCapture, isInEditMode, isInLayout, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingOffsetRequired, isPaddingRelative, isPivotSet, isPreferKeepClear, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScreenReaderFocusable, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShowingLayoutBounds, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVisibleToUserForAutofill, keyboardNavigationClusterSearch, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAnimationEnd, onAnimationStart, onApplyWindowInsets, onCancelPendingInputEvents, onCapturedPointerEvent, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateInputConnection, onCreateViewTranslationRequest, onCreateVirtualViewTranslationRequests, onDisplayHint, onDragEvent, onDraw, onDrawForeground, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onOverScrolled, onPointerCaptureChange, onPopulateAccessibilityEvent, onProvideAutofillStructure, onProvideAutofillVirtualStructure, onProvideContentCaptureStructure, onProvideStructure, onProvideVirtualStructure, onReceiveContent, onRestoreInstanceState, onRtlPropertiesChanged, onSaveInstanceState, onScreenStateChanged, onScrollCaptureSearch, onScrollChanged, onSetAlpha, onSizeChanged, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onViewTranslationResponse, onVirtualViewTranslationResponses, onVisibilityAggregated, onVisibilityChanged, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performAccessibilityAction, performClick, performContextClick, performContextClick, performHapticFeedback, performHapticFeedback, performLongClick, performLongClick, performReceiveContent, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, releasePointerCapture, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, removeOnUnhandledKeyEventListener, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestPointerCapture, requestRectangleOnScreen, requestRectangleOnScreen, requestUnbufferedDispatch, requestUnbufferedDispatch, requireViewById, resetPivot, resolveSize, resolveSizeAndState, restoreHierarchyState, saveAttributeDataForStyleable, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDataSensitive, setAccessibilityDelegate, setAccessibilityHeading, setAccessibilityLiveRegion, setAccessibilityPaneTitle, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAllowClickWhenDisabled, setAllowedHandwritingDelegatePackage, setAllowedHandwritingDelegatorPackage, setAlpha, setAnimation, setAnimationMatrix, setAutofillHints, setAutofillId, setAutoHandwritingEnabled, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintBlendMode, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentCaptureSession, setContentDescription, setContentSensitivity, setContextClickable, setDefaultFocusHighlightEnabled, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusable, setFocusableInTouchMode, setFocusedByDefault, setForceDarkAllowed, setForeground, setForegroundGravity, setForegroundTintBlendMode, setForegroundTintList, setForegroundTintMode, setFrameContentVelocity, setHandwritingBoundsOffsets, setHandwritingDelegateFlags, setHandwritingDelegatorCallback, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHorizontalScrollbarThumbDrawable, setHorizontalScrollbarTrackDrawable, setHovered, setId, setImportantForAccessibility, setImportantForAutofill, setImportantForContentCapture, setIsCredential, setIsHandwritingDelegate, setKeepScreenOn, setKeyboardNavigationCluster, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLeftTopRightBottom, setLongClickable, setMeasuredDimension, 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, setPendingCredentialRequest, setPivotX, setPivotY, setPointerIcon, setPreferKeepClear, setPreferKeepClearRects, setPressed, setRenderEffect, setRequestedFrameRate, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScreenReaderFocusable, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollCaptureCallback, setScrollCaptureHint, setScrollContainer, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setStateDescription, setStateListAnimator, setSystemGestureExclusionRects, setSystemUiVisibility, setTag, 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, showContextMenu, startActionMode, startActionMode, startAnimation, startDrag, startDragAndDrop, startNestedScroll, stopNestedScroll, toString, transformMatrixToGlobal, transformMatrixToLocal, unscheduleDrawable, unscheduleDrawable, updateDragShadow, verifyDrawable, willNotCacheDrawing, willNotDrawMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface android.view.ViewParent
canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, createContextMenu, getLayoutDirection, getParent, getParentForAccessibility, getTextAlignment, getTextDirection, isLayoutDirectionResolved, isLayoutRequested, isTextAlignmentResolved, isTextDirectionResolved, keyboardNavigationClusterSearch, requestFitSystemWindows, requestLayout
-
Field Details
-
mCameraEventsListener
Listener that will receive various camera events -
mErrorState
protected boolean mErrorStateFlag indicating there has been an unrecoverable error -
mDeviceManager
@Nullable protected com.microblink.photopay.hardware.DeviceManager mDeviceManagerDevice manager that will load device list from resources -
mCameraViewState
-
mCameraSurfaceView
@Nullable protected com.microblink.photopay.view.surface.ICameraView mCameraSurfaceViewView element -
mConfigurationOrientation
protected int mConfigurationOrientationCurrent configuration orientation -
mOnActivityFlipListener
Listener that will be notified when activity flip occurs. -
mHostScreenOrientation
protected int mHostScreenOrientationOrientation of the host activity -
mAspectMode
Defines the way camera preview will be layouted inside view -
mPreviewZoomScale
protected float mPreviewZoomScale -
mIsRequestedOrientationSensor
protected boolean mIsRequestedOrientationSensor -
mIsRequestedOrientationUser
protected boolean mIsRequestedOrientationUser -
mOrientationChangeListener
@NonNull protected com.microblink.photopay.hardware.orientation.OrientationChangeListener mOrientationChangeListener -
mRotateMeteringAreas
protected boolean mRotateMeteringAreas -
mInitialOrientation
Initial orientation which will be used for frame orientation if mOrientation is unknown -
mSlaveOrientationChangeListeners
@NonNull protected ConcurrentLinkedQueue<com.microblink.photopay.hardware.orientation.OrientationChangeListener> mSlaveOrientationChangeListenersSlave orientation change listeners that can be notified on orientation change events generated by mOrientationManager
-
-
Constructor Details
-
BaseCameraView
public BaseCameraView(@NonNull android.content.Context context) -
BaseCameraView
public BaseCameraView(@NonNull android.content.Context context, @Nullable android.util.AttributeSet attrs)
-
-
Method Details
-
isRequestedOrientationSensor
protected static boolean isRequestedOrientationSensor(int requestedOrientation) -
isRequestedOrientationUser
protected boolean isRequestedOrientationUser(int requestedOrientation) -
calculateHostScreenOrientation
protected int calculateHostScreenOrientation() -
runOnUIThread
Ensures given runnable is run on UI thread. If called from UI thread, runnable's code will be run immediately (before returning from method). If not, runnable's code will be posted to UI thread's processing queue.- Parameters:
runnable-
-
changeConfiguration
public void changeConfiguration(@Nullable android.content.res.Configuration newConfiguration) This method changes the view's configuration. It is meant to be called from onConfigurationChange event.- Parameters:
newConfiguration- New view configuration
-
changeConfigurationInternal
@CallSuper protected void changeConfigurationInternal(@Nullable android.content.res.Configuration newConfiguration) -
getHostActivity
@Nullable protected android.app.Activity getHostActivity() -
create
@CallSuper public void create()Creates the view and its subviews and initializes camera settings. This method must be called in onCreate method of host activity. If not called, camera will not work. Make sure you set all your settings before calling this method. -
destroy
@CallSuper public void destroy() -
prepareCameraSettings
protected void prepareCameraSettings(@NonNull com.microblink.photopay.hardware.camera.CameraSettings settings) Called inside onCreate method before creating camera manager. Use this method to create camera settings that are used on each startPreview event. -
getCameraFactorySettings
@NonNull protected com.microblink.photopay.hardware.camera.CameraSettings getCameraFactorySettings() -
shouldStartCamera
protected boolean shouldStartCamera() -
onCameraPreviewStarted
protected void onCameraPreviewStarted() -
onCameraPreviewStopped
protected void onCameraPreviewStopped() -
start
@MainThread @CallSuper public void start() -
resume
@MainThread @CallSuper public void resume()This method must be called from activity's onResume. If not called, camera will not work. -
pause
@MainThread @CallSuper public void pause()This method must be called from activity's onPause. If not called, camera will not work properly. -
stop
@MainThread @CallSuper public void stop() -
onMeasure
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) - Overrides:
onMeasurein classandroid.view.View
-
dispatchTouchEvent
public boolean dispatchTouchEvent(@Nullable android.view.MotionEvent ev) - Overrides:
dispatchTouchEventin classandroid.view.ViewGroup
-
onLayout
protected void onLayout(boolean changed, int l, int t, int r, int b) - Specified by:
onLayoutin classandroid.view.ViewGroup
-
setVisiblePartUpdateListener
protected void setVisiblePartUpdateListener(BaseCameraView.VisiblePartUpdateListener visiblePartUpdateListener) -
isCameraFocused
public final boolean isCameraFocused()Returns true if camera is currently in focus- Returns:
-
captureHighResFrame
protected void captureHighResFrame() -
getOpenedCameraType
Returns the type of the currently opened camera or null if currently there is no opened camera.- Returns:
- the type of the currently opened camera or null if currently there is no opened camera.
-
focusCamera
public final void focusCamera()Request a new autofocus cycle from camera. -
isCameraTorchSupported
public final boolean isCameraTorchSupported()Returns true if camera has got torch.- Returns:
- true if camera has got torch.
-
isAutofocusSupported
Returns true if opened camera supports autofocus. Returns false if opened camera does not support autofocus. Returns null if camera is not opened.- Returns:
- whether opened camera supports autofocus or null if no camera is opened
-
setTorchState
Turns the torch on the camera on or off. Returns true on success, false on failure.- Parameters:
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 state
-
getCameraSensorOrientation
protected int getCameraSensorOrientation() -
areCameraPixelsLandscapeLeft
protected boolean areCameraPixelsLandscapeLeft() -
getZoomLevel
public final float getZoomLevel()Returns the current camera zoom level.- Returns:
- the current camera zoom level.
-
setZoomLevel
public final void setZoomLevel(@FloatRange(from=0.0,to=1.0) float zoomLevel) Sets the camera zoom level. Zoom level 0.f defines no applied zoom, while zoom level 1.f defines maximum supported camera zoom. Values beyond interval [0.f, 1.f] are cropped to interval [0.f, 1.f]. If camera is active, new zoom level is applied immediately. If camera is not active, desired zoom level will be applied on next camera startup.- Parameters:
zoomLevel- Desired camera zoom level.
-
getHighResFrameLimit
public final int getHighResFrameLimit()Returns the current high res frame limit- Returns:
- current high res frame limit
-
setHighResFrameLimit
public final void setHighResFrameLimit(@IntRange(from=0L) int highResFrameLimit) Sets the maximum number of high res frames that can be active at a given moment. You should try to keep it as low as possible to avoid memory issues. Trying to capture high res frames over this limit not only won't work but might also interfere with recognition process.- Parameters:
highResFrameLimit- desired high res frame limit, minimum 1
-
setHighResFrameCaptureEnabled
public void setHighResFrameCaptureEnabled(boolean enabled) High res frame capture is disabled by default and needs to be enabled by using this method. If enabling high res frames, please useVideoResolutionPreset.VIDEO_RESOLUTION_DEFAULT, higher resolutions might cause problems when combined with high res frame capture on some devices.- Parameters:
enabled- should high res frame capture be enabled
-
isHighResFrameCaptureEnabled
public boolean isHighResFrameCaptureEnabled()Returns true if high res frame capture was enabled.- Returns:
- is high res frame capture enabled
-
getCameraViewState
Returns the current lifecycle state of camera view.- Returns:
-
isTapToFocusAllowed
public final boolean isTapToFocusAllowed()Returns true if camera view will handle tap events to ask camera to perform autofocus on tapped area.- Returns:
- true if tap to focus is allowed
-
setTapToFocusAllowed
public final void setTapToFocusAllowed(boolean allowTapToFocus) Sets whether camera view will handle tap events to ask camera to perform autofocus on tapped area. Default is true.- Parameters:
allowTapToFocus- whether or not tap to focus is allowed
-
isPinchToZoomAllowed
public final boolean isPinchToZoomAllowed()Returns true if camera view will handle pinch events to manage camera zoom level.- Returns:
- true if pinch to zoom is allowed
-
setPinchToZoomAllowed
public final void setPinchToZoomAllowed(boolean allowPinchToZoom) Sets whether camear view will handle pinch events to manage camera zoom level.- Parameters:
allowPinchToZoom- whether or not pinch to zoom is allowed. Default is false.
-
isDeviceShaking
public final boolean isDeviceShaking()Returns true if the device is being shaken- Returns:
- true if the device is being shaken
-
getCameraPreviewWidth
public final int getCameraPreviewWidth()Returns the width in pixels of the actual camera preview (does not have to be same as getWidth).- Returns:
- the width in pixels of the actual camera preview (does not have to be same as getWidth).
-
getCameraPreviewHeight
public final int getCameraPreviewHeight()Returns the height in pixels of the actual camera preview (does not have to be same as getHeight).- Returns:
- the height in pixels of the actual camera preview (does not have to be same as getHeight).
-
setMeteringAreas
public final void setMeteringAreas(@NonNull android.graphics.RectF[] meteringAreas, boolean rotateAreasWithDevice) Sets the areas where camera will perform focus, exposure and white balance meterings.- Parameters:
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 changes- Throws:
NullPointerException- if at least one element of meteringAreas is nullIllegalArgumentException- if at least on element of meteringAreas has either zero surface or is not inside viewIllegalStateException- if camera is not active
-
setMeteringAreasToCamera
protected void setMeteringAreasToCamera() -
isCameraActive
@AnyThread public final boolean isCameraActive()Returns true if camera is currently active.- Returns:
- true if camera is currently active.
-
getConfigurationOrientation
protected final int getConfigurationOrientation() -
setCameraType
Sets the camera type that will be used. You must set this before calling create method.- Parameters:
cameraType-
-
setShakeListener
Sets the shake callback that will be notified about device shake events.- Parameters:
shakeCallback-
-
getAspectMode
Returns the aspect mode of camera preview.- Returns:
- the aspect mode of camera preview.
-
setAspectMode
Defines the aspect mode of camera preview.- Parameters:
aspectMode- desired aspect mode
-
getPreviewZoomScale
public float getPreviewZoomScale()Returns the preview zoom scale that is used to draw the camera preview.- Returns:
- preview zoom scale.
-
setPreviewZoomScale
public void setPreviewZoomScale(@FloatRange(from=1.0,to=2.0) float previewZoomScale) Sets the preview zoom scale that will be used to draw the camera preview. If the preview is upscaled, the visible part will be centered, and marginal parts of the camera preview will be invisible.- Parameters:
previewZoomScale- zoom scale in range [1, 2]
-
setOnSizeChangedListener
Sets the listener that will be notified when size of child views changes.- Parameters:
onSizeChangedListener-
-
setOnActivityFlipListener
Sets the listener that will be notified when activity flip event occurs.- Parameters:
onActivityFlipListener- Activity flip listener
-
setVideoResolutionPreset
- Parameters:
preset- Sets the preset that will be used for choosing camera video resolution.
-
setForceUseLegacyCamera
public final void setForceUseLegacyCamera(boolean useLegacyCamera) With this method you can request using legacy Camera API even on devices that natively support new Camera2 API. Set this to true only if you have problems with camera management on Lollipop and newer devices. Using legacy camera API is less efficient than new Camera2 API.- Parameters:
useLegacyCamera- If set to true, legacy Camera API will be used even on devices that support new Camera2 API.
-
setCameraFrameFactory
public final void setCameraFrameFactory(com.microblink.photopay.hardware.camera.frame.CameraFrameFactory cameraFrameFactory) Set your custom implementation of camera frame factory. -
setRequestAutofocusOnShakingStopInContinousAutofocusMode
public final void setRequestAutofocusOnShakingStopInContinousAutofocusMode(boolean requestAutofocusOnShakingStopInContinousAutofocusMode) If device supports continous autofocus mode, enabling this feature will request normal autofocus every time device shaking stops. By default, this is off, as is expected from device which supports continous autofocus to do this automatically. However, some devices do not meet that expectation so this tweak can be used to force autofocus after device has stopped moving.- Parameters:
requestAutofocusOnShakingStopInContinousAutofocusMode- will autofocus be requested each time device shaking stops.
-
setOptimizeCameraForNearScan
public final void setOptimizeCameraForNearScan(boolean nearScan) - Parameters:
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.
-
setRequestedSurfaceViewForCameraDisplay
public final void setRequestedSurfaceViewForCameraDisplay(@NonNull com.microblink.photopay.view.surface.CameraSurface requestedSurface) 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:SurfaceViewandTextureView. By default,SurfaceViewwill be preferred because it is faster and more power efficient. Sometimes, when you create complex UI on top of camera screen, animations or UI may render incorrectly on some devices when usingSurfaceViewfor displaying camera preview. In that case, you can use this method to force setting the surface you want.- Parameters:
requestedSurface- Which view should be used to display camera preview.
-
getCameraEventsListener
Returns the current camera events listener.- Returns:
- the current camera events listener.
-
setCameraEventsListener
Sets the listener that will receive various camera events, such as when camera preview has started or camera initialization error has occurred.- Parameters:
cameraEventsListener-
-
getHostScreenOrientation
public int getHostScreenOrientation()Returns the host's screen orientation as detected internally. Possible return codes are ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE and ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE- Returns:
- the host's screen orientation
-
getVisiblePart
@NonNull public android.graphics.RectF getVisiblePart()Returns the rectangle that which part of camera frame is visible in view- Returns:
- the rectangle that which part of camera frame is visible in view
-
createOrientationChangeListener
@NonNull protected com.microblink.photopay.hardware.orientation.OrientationChangeListener createOrientationChangeListener() -
createCameraViewEventsListener
@NonNull protected com.microblink.photopay.view.surface.ICameraView.CameraViewEventListener createCameraViewEventsListener() -
requireAutofocusFeature
protected abstract boolean requireAutofocusFeature()If autofocus feature is required, please return true from this method. If autofocus feature is not required, return false. If autofocus is required and device does not support autofocus, error will be raised and application will not start. If autofocus is not required, application will work even on devices without autofocus.- Returns:
- True if autofocus is required, otherwise false.
-
onActivityFlip
protected abstract void onActivityFlip()Called when activity is flipped - this event is not raised by OS so we have custom detection of that state. -
createCameraListener
@NonNull protected abstract com.microblink.photopay.hardware.camera.CameraListener createCameraListener()ABSTRACT METHODS -
isHostActivityOrientationOnSensor
protected boolean isHostActivityOrientationOnSensor() -
getCurrentOrientation
-
isOrientationAllowed
-
getInitialOrientation
Returns the initial orientation of rotatable view as set by setInitialOrientation.- Returns:
- the initial orientation of rotatable view as set by setInitialOrientation.
-
setInitialOrientation
Sets the initial orientation of rotatable view and recognizer.- Parameters:
initialOrientation-
-
setOrientationAllowedListener
public void setOrientationAllowedListener(@NonNull OrientationAllowedListener orientationAllowedListener) Sets the listener that will be asked if device orientation is allowed prior rotating rotatable view and native recognizer to that orientation. If you do not set this listener, recognition will be performed only in orientation defined by current activity's orientation. -
addOrientationChangeListener
public void addOrientationChangeListener(@NonNull com.microblink.photopay.hardware.orientation.OrientationChangeListener orientationChangeListener) Adds the orientation listener that will receive orientation change events that are already reported to BaseCameraView. Orientation change events are independent of host activity's orientation settings.- Parameters:
orientationChangeListener- listener that will receive orientation change events- Throws:
NullPointerException- if the specified listener is null.IllegalStateException- if addOrientationChangeListener is called after calling start()
-
removeOrientationChangeListener
public void removeOrientationChangeListener(@NonNull com.microblink.photopay.hardware.orientation.OrientationChangeListener orientationChangeListener) Removes a single listener instance from listeners collection, if it is present.- Parameters:
orientationChangeListener- listener to be removed from the collection.
-