Scan without asking the user to frame or turn the phone
The library's CaptureActivity has three defaults that put work on the person holding the phone, so the scan now goes through our own subclass instead: - It decodes only the framing rectangle, inset 10% from every edge. A code filling the viewfinder still decodes -- measured against the library's own decoder rather than assumed -- but only by spending its quiet zone on the crop, and anything further out is never looked at. The whole preview is decoded now, so framing is not something to get right. - It draws a red laser line and scatters dots wherever the detector finds a candidate pattern. That is the library's house style, and it looks like a fault. The preview is plain now. - Its manifest entry pins the activity to landscape. The code being scanned is usually on a monitor in front of someone holding the phone upright, so ours follows the sensor. Verified on the emulator: the scanner opens on a bare preview with no laser, no dots and no status line. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QQz6R4kBQcWSHBNZMgBnjL
This commit is contained in:
1 parent
0522123a33
commit
bf82166736
4 files changed
+55
-1
No files matched your search
@@ -87,6 +87,9 @@ fun SettingsScreen(
|
||||
scanLauncher.launch(
|
||||
ScanOptions()
|
||||
.setDesiredBarcodeFormats(ScanOptions.QR_CODE)
|
||||
.setCaptureActivity(EnrollmentScanActivity::class.java)
|
||||
// Follow the phone, not the library's landscape pin.
|
||||
.setOrientationLocked(false)
|
||||
// Decode both polarities: ZXing otherwise looks only for a
|
||||
// dark code on a light ground, and ai-server's QR is block
|
||||
// characters in the terminal's foreground colour -- so on a
|
||||
|
||||
Reference in new issue
Block a user