Fix scanning compact PDF417 barcodes#6916
Conversation
We'ev decided to remove this for now while we work on balancing the benefits of it vs people who are scanning many QR codes.
| class ScannerWithFlashlightActivity : LocalizedActivity(), CollectComposeThemeProvider { | ||
| override fun onCreate(savedInstanceState: Bundle?) { | ||
| super.onCreate(savedInstanceState) | ||
| enableEdgeToEdge() |
There was a problem hiding this comment.
This allows the full screen to be used for scanning.
|
|
||
| override fun shouldConfirm(): Boolean { | ||
| return true | ||
| return false |
There was a problem hiding this comment.
We could entirely remove this feature, but I'd like to discuss whether we potentially want to offer an opt-in first.
|
O wow! It really makes a difference when the scanner is in the landscape view. I am even able to scan the drivers license and other barcodes which I wasn't able to scan at all before. |
collect_app/src/main/java/org/odk/collect/android/fragments/BarCodeScannerFragment.kt
Show resolved
Hide resolved
collect_app/src/main/java/org/odk/collect/android/fragments/BarCodeScannerFragment.kt
Show resolved
Hide resolved
|
I think I found a case in which scanning isn't super fast - I used a device which in other version struggled with scanning more complex barcodes and it isn't great at adjusting the focus. It's possible to make scanning more challenging after rotating when there was a different focus level ( I pointed the scanner at the desk). I don't think it's an issue but just wanted to show this might occur. At first I thought that the device struggles with scanning QR codes in the landscape view. XRecorder_03102025_121844.mp4 |
This seems ok. We're adding a manual button for toggling the full screen mode which I think makes this less problematic, and you're also able to tap to change focus. |
|
What should happen if I turn on the flashlight using the button in the portrait view and rotate to the landscape view (no flashlight button)? |
Nope! We could do that, but I think the current behaviour makes sense. |
Is this case ok? |
Yeah, I think so! We chose to keep these consistent for the moment so as not to add any extra maintenance burden. |
|
Tested with Success! Verified Cases:
|
Fix scanning compact PDF417 barcodes

Work towards #6913
This does not include the prompt to rotate ("Inform the user they can rotate") - that will be a follow-up. I've also removed the confirmation step (the 2-second pause after scanning) as discussed.
Why is this the best possible solution? Were any other approaches considered?
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
As discussed in the issue, the main goal here was to allow specific government ID cards using PDF417 barcodes to be scanned - it was not possible to scan these on Pixel 6a devices and this is now possible by rotating to landscape. We don't need to test those barcodes on non-Pixel devices (other devices can have less reliable cameras which makes defining good here hard work).
Other than that, we mainly want to check that the landscape mode works as expected (shows up in landscape orientation only, allows scanning anywhere on the screen) works on different Android OS levels and screen sizes. It's also important to check that QR code has is unaffected by these changes.
Before submitting this PR, please make sure you have:
./gradlew connectedAndroidTest(or./gradlew testLab) and confirmed all checks still passDateFormatsTest