Commit 699937b
committed
feat(scanner): migrate QR scanner to CameraX + ML Kit (bundled, offline)
Replace zxing-lite (ancient CameraX 1.0.x + weaker ZXing decoder) with a modern
CameraX 1.4.1 preview/ImageAnalysis pipeline feeding Google ML Kit's bundled barcode
model (com.google.mlkit:barcode-scanning) — far more robust on angled/low-light/dense
QR, and fully offline with no Google Play Services dependency (works on de-Googled ROMs).
- Live scan: CameraX ImageAnalysis -> ML Kit (QR format only), STRATEGY_KEEP_ONLY_LATEST.
- Image upload: decode bitmap -> ML Kit InputImage.fromBitmap (was ZXing CodeUtils);
multi-image still supported; clear 'no QR found' message.
- New ScannerOverlayView viewfinder (replaces king ViewfinderView) + Material torch FAB
(hidden when no flash unit) with flash on/off icons.
- Runtime CAMERA permission via ActivityResult API; torch via CameraControl.
- Kept com.google.zxing:core for QR *generation* (QRCodeDialog); ML Kit can't encode.
Compiles; APK +~5.7MB (bundled barcode model libbarhopper). On-device verification
pending (device disconnected from ADB during testing).1 parent b1c4fde commit 699937b
7 files changed
Lines changed: 305 additions & 138 deletions
File tree
- app
- src/main
- java/io/nekohasekai/sagernet
- ui
- widget
- res
- drawable
- layout
- values
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
64 | 75 | | |
65 | 76 | | |
66 | 77 | | |
| |||
0 commit comments