Barcode-Kaiteki
An easy to use library for barcode detection. Based on the new AndroidX Camera2 api. Uses the zxing barcode detection library.
Comes with a BarcodeView, which combines a camera preview and an automatic overlay for detected barcodes.
Also contains three differend ready to use dialogs:
- BarcodeDialog (DialogFragment)
- BarcodeBottomSheet (BottomSheetDialogFragment)
- BarcodeAlertDialog (AlertDialog)
Features
- camera permission handling
- customize the displayed result points
- customize the barcode type (can be a list)
- allows scanning of inverted barcodes (white barcode on black background)
Add library dependency
Add jitpack to your toplevel gradle file (if not already present):
Add barcode-kaiteki as dependency:
Usage
BarcodeDialog
Just let your Activity/Fragment implement BarcodeResultListener.
Then it is as easy as showing one of the provided dialogs.
BarcodeView
You can also use the BarcodeView directly in your Layout.
Then add in your onCreate/onViewCreated: bcode.bindToLifecycle(this)
and in your onStop: bcode.unbind()
.