Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Commit

Permalink
✨ [android] feat: add support for inverted barcodes (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
tafelnl authored Jun 30, 2021
1 parent b7a72ad commit b819f4c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.getcapacitor.annotation.PermissionCallback;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.ResultPoint;
import com.google.zxing.client.android.Intents;
import com.journeyapps.barcodescanner.BarcodeCallback;
import com.journeyapps.barcodescanner.BarcodeResult;
import com.journeyapps.barcodescanner.BarcodeView;
Expand Down Expand Up @@ -185,6 +186,8 @@ private void configureCamera() {
return;
}

DefaultDecoderFactory defaultDecoderFactory = new DefaultDecoderFactory(null, null, null, Intents.Scan.MIXED_SCAN);

if (call.hasOption("targetedFormats")) {
JSArray targetedFormats = call.getArray("targetedFormats");
ArrayList<BarcodeFormat> formatList = new ArrayList<>();
Expand All @@ -204,11 +207,13 @@ private void configureCamera() {
}

if (formatList.size() > 0) {
mBarcodeView.setDecoderFactory(new DefaultDecoderFactory(formatList));
defaultDecoderFactory = new DefaultDecoderFactory(formatList, null, null, Intents.Scan.MIXED_SCAN);
} else {
Log.d("scanner", "The property targetedFormats was not set correctly.");
}
}

mBarcodeView.setDecoderFactory(defaultDecoderFactory);
}
);
}
Expand Down

0 comments on commit b819f4c

Please sign in to comment.