Class ViewfinderView

  • All Implemented Interfaces:
    Drawable.Callback, AccessibilityEventSource, KeyEvent.Callback

    public class ViewfinderView
    extends View
    This view is overlaid on top of the camera preview. It adds the viewfinder rectangle and partial transparency outside it, as well as the laser scanner animation and result points.
    • Field Detail

      • TAG

        protected static final String TAG
      • SCANNER_ALPHA

        protected static final int[] SCANNER_ALPHA
      • CURRENT_POINT_OPACITY

        protected static final int CURRENT_POINT_OPACITY
        See Also:
        Constant Field Values
      • paint

        protected final Paint paint
      • resultBitmap

        protected Bitmap resultBitmap
      • maskColor

        protected int maskColor
      • resultColor

        protected final int resultColor
      • laserColor

        protected final int laserColor
      • resultPointColor

        protected final int resultPointColor
      • laserVisibility

        protected boolean laserVisibility
      • scannerAlpha

        protected int scannerAlpha
      • possibleResultPoints

        protected List<com.google.zxing.ResultPoint> possibleResultPoints
      • lastPossibleResultPoints

        protected List<com.google.zxing.ResultPoint> lastPossibleResultPoints
      • framingRect

        protected Rect framingRect
      • previewSize

        protected Size previewSize
    • Method Detail

      • setCameraPreview

        public void setCameraPreview​(CameraPreview view)
      • refreshSizes

        protected void refreshSizes()
      • onDraw

        public void onDraw​(Canvas canvas)
        Overrides:
        onDraw in class View
      • drawViewfinder

        public void drawViewfinder()
      • drawResultBitmap

        public void drawResultBitmap​(Bitmap result)
        Draw a bitmap with the result points highlighted instead of the live scanning display.
        Parameters:
        result - An image of the result.
      • addPossibleResultPoint

        public void addPossibleResultPoint​(com.google.zxing.ResultPoint point)
        Only call from the UI thread.
        Parameters:
        point - a point to draw, relative to the preview frame
      • setMaskColor

        public void setMaskColor​(int maskColor)
      • setLaserVisibility

        public void setLaserVisibility​(boolean visible)