-
-
Notifications
You must be signed in to change notification settings - Fork 108
Open
Labels
Description
What do you think about features:
- Use
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?
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.
Reactions are currently unavailable