Skip to content

Add button to toggle full screen scanning mode#6918

Merged
grzesiek2010 merged 26 commits intogetodk:v2025.3.xfrom
seadowg:rotate-prompt
Oct 12, 2025
Merged

Add button to toggle full screen scanning mode#6918
grzesiek2010 merged 26 commits intogetodk:v2025.3.xfrom
seadowg:rotate-prompt

Conversation

@seadowg
Copy link
Member

@seadowg seadowg commented Oct 3, 2025

Closes #6913
Blocked by #6916

Why is this the best possible solution? Were any other approaches considered?

I switched to Compose for the scanner controls here as I really wanted @Preview so that I didn't have manually test the combinations of full screen mode and rotations - I'm glad I did as it was super helpful!

Other than that, there's not a lot to mention. I'll leave comments inline for anything that might need it.

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?

The only thing that's changed is again the barcode (and reconfigure QR code scanner). The behaviour is basically the same as in #6916, but there is now a button that allows the "full screen mode" to be toggled from either orientation.

For the older scanner: I've made sure the rotate button does not appear and locked the orientation to portrait. This is not a long term solution, and we'll have to resolve as part of #6647.

There's also an ongoing conversation around whether we keep the current "full screen" look below.

Before submitting this PR, please make sure you have:

  • added or modified tests for any new or changed behavior
  • run ./gradlew connectedAndroidTest (or ./gradlew testLab) and confirmed all checks still pass
  • added a comment above any new strings describing it for translators
  • added any new strings with date formatting to DateFormatsTest
  • verified that any code or assets from external sources are properly credited in comments and/or in the about file.
  • verified that any new UI elements use theme colors. UI Components Style guidelines

@seadowg seadowg changed the base branch from master to v2025.3.x October 3, 2025 12:30
@seadowg seadowg added the blocked label Oct 3, 2025
@alyblenkin
Copy link
Collaborator

Looking good so far!

@alyblenkin
Copy link
Collaborator

Looks great and it's much faster. The extended fab is delightful.

I noticed we lost the bottom bar with the back button. You can pull up and it appears but I didn't realize that at first.

@seadowg
Copy link
Member Author

seadowg commented Oct 7, 2025

I noticed we lost the bottom bar with the back button. You can pull up and it appears but I didn't realize that at first.

I made the screen edge to edge and full screen (we hide the system bars). Newer Android phones default to gestural navigation (pull from the side for back, from the bottom to go home) so this works well, but it definitely isn't as nice with 3 button nav. To solve this I think there are three good options:

  1. We drop the "full screen" feel entirely and show the normal system bars
  2. We hide all the bars except for the navigation bar
  3. We do either 1 or 2 only if 3 button navigation is enabled

I think I'd prefer 2: I think keeping the nav bar obviously covers a bit of the camera preview, but it feels like a small trade-off (especially in gestural mode) for slightly easier navigation.

- run:
name: Check APK size isn't larger than 13MB
command: ./check-size.sh 13631488
name: Check APK size isn't larger than 13.1MB
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this is new icons.

@seadowg seadowg marked this pull request as ready for review October 7, 2025 10:31
@seadowg seadowg requested a review from grzesiek2010 October 7, 2025 10:31
@seadowg seadowg added high priority Should be looked at before other PRs/issues needs testing labels Oct 7, 2025
@seadowg
Copy link
Member Author

seadowg commented Oct 9, 2025

Has anything else changed that could affect this since the first APK you shared @seadowg? I wasn't able to get any partials and I really tried.

I'm not sure which APK you're referring to, but all that's happened (intentionally anyway) is to introduce the full screen mode.

The fact that it's getting a number out of a PDF147 with a bunch of data is really interesting. I'm also very interested in seeing whether you can get partials with other barcode types.

Good point. That almost suggests to me that there might be something else in frame that it thinks is a barcode. @srujner are you able to get this consistently and with just the barcode screen (no other text or symbols etc).

@dbemke
Copy link

dbemke commented Oct 9, 2025

We're going with "rotate device", but I think it's important for us to be distinct aroun the fact that we really have a full screen (landscape) and non-full screen (portrait) mode that both work if the device is in landscape or portrait mode.

After having spent 2 days testing the "rotate device" button I'm still confused - I don't know how to hold the device when the scanner is in the full-screen mode after tapping "rotate device" to get best scanning. I'm thinking about the case of Redmi 9t and scanning the PDF 417 in the ID:

  • the device struggles with scanning
  • the barcode needs to be positioned well so that the start pattern is on the left in horizontal position - if I use the "rotate" button to see the "horizontal"/ full-screen scanner I don't know where the start is in the camera - should I keep the device in vertical position or change it to horizontal position?
  • scanning the barcode in "real" landscape view is way easier (rotating by changing position of the device, not the button)
  • when I see "rotate device" button I feel the need to change the position of my device so that it's in the horizontal position so I tap "rotate device" button and then rotate the device and then I can't scan the barcode
  • I get the best results when I use portrait for scanning QR codes and open the scanner in the landscape mode (the device needs to be in the horizontal position before tapping "Get Barcode") for scanning barcodes

Other devices can scan the barcode in this case but I think it's an example that I don't know what I should do with my device after tapping "rotate device" - @seadowg @alyblenkin should I hold the device in horizontal or vertical position to scan a barcode?

@srujner
Copy link

srujner commented Oct 9, 2025

@seadowg I checked in #6784 and I was not able to get any scans of PDF417, either full or partial, but maybe my hand is not as steady as yesterday.
I tried with other 417 barcodes and I get an orange box few times but no partial scanning.

Could point. That almost suggests to me that there might be something else in frame that it thinks is a barcode. @srujner are you able to get this consistently and with just the barcode screen (no other text or symbols etc).

Yes on Pixel 3a and Samsung M23 almost every time, sometimes after ~5 seconds, other time around 30 seconds and I have only that one barcode on the screen. The answer of partial is different every time but it's always sequence of numbers.
Oh and it's only possible in the landscape mode.

@seadowg
Copy link
Member Author

seadowg commented Oct 9, 2025

First answers for @dbemke:

I'm thinking about the case of Redmi 9t and scanning the PDF 417 in the ID

We'd already discussed only using Pixel devices for testing compact PDF417 in #6916 right? Does the Redmi 9t not always have problems scanning the code no matter what we do?

the barcode needs to be positioned well so that the start pattern is on the left in horizontal position - if I use the "rotate" button to see the "horizontal"/ full-screen scanner I don't know where the start is in the camera - should I keep the device in vertical position or change it to horizontal position?

I don't really understand what you mean by the "start" here. If you hit "Rotate device" the full camera view should be used to scan - any barcode within the frame should be eligible.

scanning the barcode in "real" landscape view is way easier (rotating by changing position of the device, not the button)

Is that even after a2fe822? I fixed a problem where the full view wouldn't be used sometimes (it was still restricting to the view finder even when it wasn't displying).

when I see "rotate device" button I feel the need to change the position of my device so that it's in the horizontal position so I tap "rotate device" button and then rotate the device and then I can't scan the barcode

Can't scan it? Again is that after the change at a2fe822?

should I hold the device in horizontal or vertical position to scan a barcode?

To scan a compact PDF417 I'd expect you to need to hold the device horizontally or rotate the barcode itself after tapping "Rotate device". Those particular barcode are generally too wide to fit in the frame while also being readable for a standard mobile device.

And answers for @srujner:

Yes on Pixel 3a and Samsung M23 almost every time, sometimes after ~5 seconds, other time around 30 seconds and I have only that one barcode on the screen. The answer of partial is different every time but it's always sequence of numbers.
Oh and it's only possible in the landscape mode.

I'll have a go and see if I can reproduce. To be clear, I mean absolutely nothing on screen: in the video there's desktop UI which could be confusing the scanner.

@dbemke
Copy link

dbemke commented Oct 9, 2025

We'd already discussed only using Pixel devices for testing compact PDF417 in #6916 right? Does the Redmi 9t not always have problems scanning the code no matter what we do?

Now I can scan the barcode easily if I open the scanner in the landscape view (on Redmi 9t).

I don't really understand what you mean by the "start" here. If you hit "Rotate device" the full camera view should be used to scan - any barcode within the frame should be eligible.

The start pattern of the barcode. In my experience when it comes to PDF 417 if you try to scan it upside down (so the start pattern is on the right) it is more difficult for a device to scan it

@seadowg
Copy link
Member Author

seadowg commented Oct 9, 2025

The start pattern of the barcode. In my experience when it comes to PDF 417 if you try to scan it upside down (so the start pattern is on the right) it is more difficult for a device to scan it

Oh interesting! I would imagine the model finds it slightly harder to scan barcodes that aren't positioned "canonically" as you'd imagine there'd be a bias in the training data. I'd generally expect people to try and position their device so that the barcode fits in correctly (the right way up) from their perspective though.

@seadowg
Copy link
Member Author

seadowg commented Oct 9, 2025

I'll have a go and see if I can reproduce. To be clear, I mean absolutely nothing on screen: in the video there's desktop UI which could be confusing the scanner.

Yup, I can reproduce! I've been debugging and playing around with showing myself where the barcode is, and it seems like I'm able to occasionally get a UPC barcode within our PDF417. It seems to be wide, short sections that can fool it. My guess is that these are only likely if you're scanning a code blown up on a screen, and I'm not sure how we can prevent these while still allowing the scanner to support any barcode (rather than having form designers state which one they expect).

Does it feel like we need to fix it @srujner or is it hard enough to get that we can probably allow it?

@srujner
Copy link

srujner commented Oct 9, 2025

@seadowg I think we can let this one go.
I stumbled upon it by accident and just wanted to let you know that this is a possibility.
In real-world conditions, it is difficult for me to imagine anyone intentionally wanting to get partial scanning.
Especially since if the entire barcode is visible, it scans it after 1-3 seconds.

@dbemke
Copy link

dbemke commented Oct 9, 2025

Is that even after a2fe822? I fixed a problem where the full view wouldn't be used sometimes (it was still restricting to the view finder even when it wasn't displying).

I think I found out why I feel I use 2 different ways of scanning barcodes in the landscape view. I added it to the Redmi 9t #6774 issue. The rotate button isn't involved.

@WKobus
Copy link

WKobus commented Oct 10, 2025

Tested with success

Verified on device with Android 16, 10, 11

Verified cases:

  • Rotate button in barcode widget and reconfigure
  • Scanning PDF 417, SA ID Card, Difficult QR codes from slack
  • Scanning in portrait view with fullscreen mode on
  • Scanning in portrait view with fullscreen mode off
  • Scanning in landscape view with fullscreen mode on
  • Scanning in landscape view with fullscreen mode off
  • Auto rotate setting On / Off
  • Regression checks in scanner
  • Old and new scanner

@dbemke
Copy link

dbemke commented Oct 10, 2025

Tested with success

Verified on device with Android 8.1, 10, 16

Verified cases:

  • scanning the PDF417 ID card on all devices
  • regression checks on Android 10
  • exploratory testing on Android 16 Pixel 7a

@srujner
Copy link

srujner commented Oct 10, 2025

Tested with success

Verified on device with Android 10, 12 and 14

<string name="barcode_scanned">Barcode erfolgreich gescannt</string>
<!--Label for button that exits barcode scanning after success-->
<string name="exit_scanning">Fertig</string>
<!--Label for button that exits barcode scanning after success-->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it ok to change the indentation here and in other string files?

Copy link
Member Author

@seadowg seadowg Oct 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to happen automatically when deleting strings with the "Translations Editor" annoyingly. The files will be replaced when we update translations, so I don't we should bother taking the time to fix it.

Copy link
Member

@grzesiek2010 grzesiek2010 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left a couple of comments.

@seadowg seadowg requested a review from grzesiek2010 October 12, 2025 14:37
@grzesiek2010 grzesiek2010 merged commit a1c2221 into getodk:v2025.3.x Oct 12, 2025
6 checks passed
@seadowg seadowg deleted the rotate-prompt branch October 13, 2025 07:45
grzesiek2010 added a commit to grzesiek2010/collect that referenced this pull request Oct 13, 2025
Add button to toggle full screen scanning mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

behavior verified high priority Should be looked at before other PRs/issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants