Skip to content

Don't allow rotation on larger devices when drawing#7132

Merged
grzesiek2010 merged 3 commits intogetodk:v2026.1.xfrom
seadowg:draw-rotate
Mar 15, 2026
Merged

Don't allow rotation on larger devices when drawing#7132
grzesiek2010 merged 3 commits intogetodk:v2026.1.xfrom
seadowg:draw-rotate

Conversation

@seadowg
Copy link
Copy Markdown
Member

@seadowg seadowg commented Mar 11, 2026

Closes #7124

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

On larger devices, even if the orientation is locked an Activity can still be resized when switching orientation as the device shows the locked screen letterboxd and still rotates it. This causes Activity recreation and leads to the drawing screen getting wiped when rotating. We can avoid this (for the current target Android version) by disabling resizing for the Activity (android:resizeableActivity="false").

That doesn't quite solve the problem for larger devices though: when switching from landscape to portrait orientation we still end up being resized even without recreation. The DrawView used did not have to deal with this on smaller devices/older Android versions so we also needed to disable resetting the Canvas on every size change (rather than just the first render).

Ideally the drawing screens should just handle resizing, but that's a new feature we'll need to discuss for either our Android 16 target version (or potentially Android 17 if opt-outs let us kick this can down the road). I'm not confident these fixes will work across the board as manufacturers are able to override a lot of the large screen behaviour here.

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?

On smaller devices, the app should behave exactly as before. On tablets, the drawing screens should no longer clear the user's work when rotating, but the image/canvas will not scale appropriately: whatever dimensions they first open in will be used regardless of orientation.

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 v2026.1.x March 11, 2026 14:00
@seadowg seadowg added the high priority Should be looked at before other PRs/issues label Mar 11, 2026
@seadowg seadowg marked this pull request as ready for review March 11, 2026 15:30
@dbemke
Copy link
Copy Markdown

dbemke commented Mar 12, 2026

In draw, signature and annotate widget the reset button doesn't remove the drawing. The issue doesn't occur on the master version.

reset

Steps to reproduce:

  1. In All question types form go to the draw widget.
  2. Tap "Sketch image".
  3. Draw something.
  4. Tap + and reset.

@seadowg
Copy link
Copy Markdown
Member Author

seadowg commented Mar 12, 2026

@dbemke good catch! That's fixed.

@dbemke
Copy link
Copy Markdown

dbemke commented Mar 12, 2026

Tested with Success!

Verified on device with Android 10

Verified cases:

  • opening, saving, resetting in draw, signature, annotate widget
  • locking orientation in the device and opening the widgets
  • signature widget with images
  • regression checks in the widgets

@seadowg
Copy link
Copy Markdown
Member Author

seadowg commented Mar 12, 2026

@dbemke just to check: you weren't able to check this on tablets right?

@dbemke
Copy link
Copy Markdown

dbemke commented Mar 12, 2026

you weren't able to check this on tablets right?

No. We don't have a tablet.

@seadowg seadowg requested a review from grzesiek2010 March 12, 2026 13:07
@WKobus
Copy link
Copy Markdown

WKobus commented Mar 12, 2026

Tested with success

Verified on Android 16

@seadowg
Copy link
Copy Markdown
Member Author

seadowg commented Mar 13, 2026

@grzesiek2010 given QA don't have a tablet to test on, could have a play with this on an emulator (or a physical tablet if you have one) using a couple of different Android versions? I've already done that, but it'd be good to make sure it's been checked by more than one person.

@grzesiek2010
Copy link
Copy Markdown
Member

Yes I have a tablet so I test it.

@grzesiek2010 grzesiek2010 merged commit f62dfbf into getodk:v2026.1.x Mar 15, 2026
8 checks passed
@seadowg seadowg deleted the draw-rotate branch March 16, 2026 08:55
seadowg pushed a commit to seadowg/collect that referenced this pull request Mar 19, 2026
Don't allow rotation on larger devices when drawing
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.

4 participants