Skip to content

Fix max-pixels compression not applying to ImageWidget#7284

Open
grzesiek2010 wants to merge 6 commits into
getodk:masterfrom
grzesiek2010:COLLECT-7277
Open

Fix max-pixels compression not applying to ImageWidget#7284
grzesiek2010 wants to merge 6 commits into
getodk:masterfrom
grzesiek2010:COLLECT-7277

Conversation

@grzesiek2010

@grzesiek2010 grzesiek2010 commented Jun 26, 2026

Copy link
Copy Markdown
Member

Closes #7277

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

We recently refactored ImageWidget and detached it from the old hierarchy (it previously extended BaseImageWidget). As a result, we now need to explicitly handle it in MediaLoadingTask, where we determine whether image compression should be triggered.

This is probably not the ideal architecture (although it has been working this way for a long time), as MediaLoadingTask is responsible for more than just image loading. A better long-term solution would be to move the compression logic into the image widgets themselves. However, that would require a larger refactoring, and with the release just around the corner, this doesn't seem like the right time for such a change.

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 fix is tiny and carries virtually no risk. A simple check to verify that compression works for basic image widgets is sufficient.

Do we need any specific form for testing your changes? If so, please attach one.

There's a form attached to the issue.

Does this change require updates to documentation? If so, please file an issue here and include the link below.

No.

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

@grzesiek2010 grzesiek2010 marked this pull request as ready for review June 26, 2026 07:27
@grzesiek2010 grzesiek2010 requested a review from seadowg June 26, 2026 07:27
@seadowg seadowg changed the title Fix max-pixels compression not applying to ImageWidge Fix max-pixels compression not applying to ImageWidget Jun 29, 2026
Comment thread collect_app/src/main/java/org/odk/collect/android/tasks/MediaLoadingTask.java Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Image widget with max-pixel parameter doesn't scale down the image

2 participants