Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added scanner flag #56

Merged
merged 1 commit into from
Jul 31, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ public class QRCodeReaderView extends SurfaceView

public interface OnQRCodeReadListener {

public void onQRCodeRead(String text, PointF[] points);
void onQRCodeRead(String text, PointF[] points);

public void cameraNotFound();
void cameraNotFound();

public void QRCodeNotFoundOnCamImage();
void QRCodeNotFoundOnCamImage();
}

private OnQRCodeReadListener mOnQRCodeReadListener;
Expand All @@ -64,6 +64,7 @@ public interface OnQRCodeReadListener {
private int mPreviewHeight;
private SurfaceHolder mHolder;
private CameraManager mCameraManager;
private boolean mQrDecodingEnabled = true;

public QRCodeReaderView(Context context) {
super(context);
Expand All @@ -79,6 +80,10 @@ public void setOnQRCodeReadListener(OnQRCodeReadListener onQRCodeReadListener) {
mOnQRCodeReadListener = onQRCodeReadListener;
}

public void setQRDecodingEnabled(boolean qrDecodingEnabled) {
this.mQrDecodingEnabled = qrDecodingEnabled;
}

public CameraManager getCameraManager() {
return mCameraManager;
}
Expand Down Expand Up @@ -131,6 +136,9 @@ public CameraManager getCameraManager() {

// Called when camera take a frame
@Override public void onPreviewFrame(byte[] data, Camera camera) {
if (!mQrDecodingEnabled) {
return;
}

PlanarYUVLuminanceSource source =
mCameraManager.buildLuminanceSource(data, mPreviewWidth, mPreviewHeight);
Expand Down Expand Up @@ -198,7 +206,6 @@ public CameraManager getCameraManager() {
* @return a new PointF array with transformed points
*/
private PointF[] transformToViewCoordinates(ResultPoint[] resultPoints) {

PointF[] transformedPoints = new PointF[resultPoints.length];
int index = 0;
if (resultPoints != null) {
Expand Down