CamView
CamView copied to clipboard
Set ScannerLiveView to Only Responds to QR Code
Hello, thanks for providing this CRAZY SIMPLE libray!!!
I have a little problem though.
-
How do you detect only QR Codes? I tried to scan other type of barcodes and the App BEEP. How do I make it to beep or responds only when a QR Code is scanned??
-
What is the purpose of setScanAreaPercent? (I am sorry for these newbie question)
ZXDecoder decoder=new ZXDecoder(); decoder.setScanAreaPercent(0.5); scannerLiveView = (ScannerLiveView) findViewById(R.id.scannerLiveView); scannerLiveView.setDecoder(decoder);
-
How do we make the Camera preview to square? I am tried to set it to square but the preview ended up distorted.
And thanks again for providing this great library for everyone!!!!
Hi ! Detectable codes management is a planned feature for the ScannerLiveView. Sadly I was very busy past weeks, but I hope to complete and push the outstanding issues for the new release during the coming weekend, so this one should be added too.
Will post here more info once it ready
@livotov I ended up creating a new custom decoder class derived from ZXDecoder and set the POSSIBLE_FORMATS to QR_CODE only.
Thank you for responding!!
@Jayvd I'm just having the same issue. Do you have a short sample how you did setup ZXDecoder?
@Jayvd Hi. Could you show us how to set the possible formats to QR code only? Please. That would be a big help for me! Thanks!
@GermanMontejo @hohl @livotov
What I did was, I copied the ZXDecoder.java file and name it something else. In this case I named it CustomDecoder Change the constructor content of the ZXDecoder
Original ZXDecoder.java constructor
public ZXDecoder()
{
reader = new MultiFormatReader();
hints.put(DecodeHintType.POSSIBLE_FORMATS, EnumSet.allOf(BarcodeFormat.class));
hints.put(DecodeHintType.CHARACTER_SET, "utf-8");
hints.put(DecodeHintType.TRY_HARDER, true);
reader.setHints(hints);
}
_ Modified class _
public CustomDecoder()
{
reader = new MultiFormatReader();
Map<DecodeHintType,Object> hints = new EnumMap<>(DecodeHintType.class);
Collection<BarcodeFormat> decodeFormats = EnumSet.of(BarcodeFormat.QR_CODE);
hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);
hints.put(DecodeHintType.CHARACTER_SET, "utf-8");
hints.put(DecodeHintType.TRY_HARDER, true);
reader.setHints(hints);
}
it should have an option that exposes as an API from decode to set decoding type.