ZXing QR code package library implemented by CameraX
- Simple to use
- Auto focus camera, improve decoding speed
- When scanning and decoding is successful, it will automatically stop scanning
- No need to consider camera destruction related actions
implementation 'io.github.clistery:camerax-scanner-qrcode:1.1.2'
-
in xml
<com.yh.cxqr.QRScannerView android:id="@+id/scanner" android:layout_width="match_parent" android:layout_height="match_parent" />
-
start scan
beginScan()
-
end scan
stopScan()
-
register scan result callback
resultCallback = object : QRScannerView.IScanResultCallback { override fun onCallback(result: Barcode) { } }
-
on/off flash
switchFlash()
-
decode ImageProxy
QRCodeParser().decodeImageProxy(imageProxy, success, fail)
-
decode image uri
QRCodeParser().decodeImageUri(context, fileUri, success, fail)
-
decode bitmap
QRCodeParser().decodeBitmap(originBitmap, success, fail)