public void setCameraPreview(CameraPreview view) {
        this.cameraPreview = view;
        view.addStateListener(new CameraPreview.StateListener() {
            @Override
            public void previewSized() {
                refreshSizes();
                invalidate();
            }

            @Override
            public void previewStarted() {

            }

            @Override
            public void previewStopped() {

            }

            @Override
            public void cameraError(Exception error) {

            }

            @Override
            public void cameraClosed() {

            }
        });
    }
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.

@author dswitkin@google.com (Daniel Switkin)
zxing-android-embedded/src/com/journeyapps/barcodescanner/ViewfinderView.java