What do you think about features:
- Use
com.google.android.gms.vision.barcode.BarcodeDetector as singleton by default instead of creating new instance inside init() function. Do we really need different detectors in different readers?
class BarcodeDetectorHolder {
private static BarcodeDetector detector;
static BarcodeDetector getBarcodeDetector(Context context) {
if (detector == null)
detector = new BarcodeDetector.Builder(context.getApplicationContext()).setBarcodeFormats(Barcode.QR_CODE).build();
return detector;
}
}
public QREader(final Builder builder) {
if (barcodeDetector == null)
barcodeDetector = BarcodeDetectorHolder.getBarcodeDetector(builder.context);
...
}
- Allow to set external BarcodeDetector to Builder. It can be useful, if someone will want to scan not only qr codes.
BarcodeDetector myDetector = ...; //set few barcode formats.
QRReader r = QREader.Builder(MainActivity.this, surfaceView, listener).setDetector(myDetector)
I already made it in my project and can make PR. But I'm not sure about first case.
What do you think about features:
com.google.android.gms.vision.barcode.BarcodeDetectoras singleton by default instead of creating new instance inside init() function. Do we really need different detectors in different readers?I already made it in my project and can make PR. But I'm not sure about first case.