Skip to content

Commit

Permalink
Fix CameraBarcodeScanView inconsistencies
Browse files Browse the repository at this point in the history
  • Loading branch information
DaSpood committed Dec 5, 2023
1 parent 54ff015 commit 24f497d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,13 @@ public void pauseCamera() {
public void resumeCamera() {
this.proxiedView.resumeCamera();
}

/**
* Get the JPEG data of the image used in the latest successful scan.
*
* @return a byte[] of JPEG data, or null if there is no previous scan data.
*/
public byte[] getLatestSuccessfulScanJpeg() {
return this.proxiedView.getLatestSuccessfulScanJpeg();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ private void setAreas(Camera.Parameters prms) {
}
}

@Override
protected void refreshAutofocusZone() {
if (this.cam == null) {
Log.w(VIEW_LOG_TAG, "refreshAutofocusZone: No camera instance, make sure camera was properly initialized and `cleanup()` or `closeCamera()` were not called previously");
Expand Down Expand Up @@ -331,6 +332,7 @@ protected void refreshAutofocusZone() {
});
}

@Override
public void setPreviewResolution(Point newResolution) {
if (this.cam == null) {
Log.w(VIEW_LOG_TAG, "setPreviewResolution: No camera instance, make sure camera was properly initialized and `cleanup()` or `closeCamera()` were not called previously");
Expand Down Expand Up @@ -492,6 +494,7 @@ public void onPreviewFrame(byte[] data, Camera camera) {
frameAnalyser.handleFrame(ctx);
}

@Override
public void giveBufferBackInternal(FrameAnalysisContext<byte[]> ctx) {
if (this.cam == null) {
Log.w(VIEW_LOG_TAG, "giveBufferBackInternal: No camera instance, make sure camera was properly initialized and `cleanup()` or `closeCamera()` were not called previously");
Expand All @@ -508,6 +511,7 @@ public void giveBufferBackInternal(FrameAnalysisContext<byte[]> ctx) {

////////////////////////////////////////////////////////////////////////////////////////////////
// Lifecycle external toggles
@Override
public void pauseCamera() {
if (this.cam != null) {
this.cam.setPreviewCallbackWithBuffer(null);
Expand All @@ -522,6 +526,7 @@ public void pauseCamera() {
});
}

@Override
public void resumeCamera() {
if (this.cam != null) {
this.cam.startPreview();
Expand Down Expand Up @@ -557,6 +562,7 @@ public void pauseScanner() {

////////////////////////////////////////////////////////////////////////////////////////////////
// Clean up methods
@Override
public void cleanUp() {
if (this.cam == null) {
Log.w(VIEW_LOG_TAG, "cleanup: No camera instance, make sure camera was properly initialized and `cleanup()` or `closeCamera()` were not called previously");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ private MeteringRectangle getMeteringZone() {
return new MeteringRectangle(x0, y0, x1 - x0, y1 - y0, 1000);
}

@Override
protected void refreshAutofocusZone() {
if (anyAttributeMissing("refreshAutofocusZone")) {
return;
Expand Down

0 comments on commit 24f497d

Please sign in to comment.