Skip to content

Add info button to trace/shape questions#7021

Merged
seadowg merged 13 commits intogetodk:masterfrom
grzesiek2010:COLLECT-6961
Jan 30, 2026
Merged

Add info button to trace/shape questions#7021
seadowg merged 13 commits intogetodk:masterfrom
grzesiek2010:COLLECT-6961

Conversation

@grzesiek2010
Copy link
Copy Markdown
Member

@grzesiek2010 grzesiek2010 commented Jan 15, 2026

Closes #6961

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

The main thing worth mentioning is that I built the dialog’s UI using Jetpack Compose, but I wrapped it inside a ComposeView so it can be used from a regular DialogFragment. The rest of the screen where this “info” dialog is opened is still based on the legacy XML view system, so embedding Compose this way keeps the integration simple and avoids a bigger refactor.

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?

This is a fairly isolated change. It should be enough to ensure that the correct content is displayed depending on the circumstances described in the issue.

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

Any form with geotrace/geoshape questions.

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 force-pushed the COLLECT-6961 branch 4 times, most recently from 376d119 to ff5d41b Compare January 15, 2026 14:12
@alyblenkin
Copy link
Copy Markdown
Collaborator

alyblenkin commented Jan 15, 2026

Looking great - this will be so helpful beyond the invalid polygon work too! Explaining to data collectors how to use the different map actions has come up on the forum before, and it came up again just the other day.

Small thing - I noticed we reuse the same icon for tapping and moving. I was think we should use the location marker for tapping instead so we don't repeat the icon and they look more distinct.
Screenshot 2026-01-15 at 9 04 55 AM

@grzesiek2010 grzesiek2010 marked this pull request as ready for review January 22, 2026 04:24
@grzesiek2010 grzesiek2010 requested a review from seadowg January 22, 2026 04:24
Copy link
Copy Markdown
Member

@seadowg seadowg left a comment

Choose a reason for hiding this comment

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

These needs tests. It might be awkward to mix and match Espresso/Compose tests, but I think at least having tests for which items are shown in which "mode" would be enough.

If GeoPolyFragment stored the recordingAutomatic and recordingEnabled state in GeoPolyViewModel we could have a single Composable that gets passed that view model (and is contained in the ComposeView). That would make testing the bulk of the logic here pretty simple.

@seadowg seadowg mentioned this pull request Jan 28, 2026
6 tasks

@Before
public void setup() {
ApplicationProvider.getApplicationContext().setTheme(com.google.android.material.R.style.Theme_MaterialComponents);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is this change needed? If I take it out, then there's a failure, but it seems completely unrelated to everything else here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This happens because androidx.compose.ui:ui-test-manifest provides its own test manifest, which changes the default app theme used during tests. Robolectric picks up that manifest even for non-Compose tests, and the new default theme is not AppCompat/Material.


private fun clear() {
inputActive = false
viewModel.disableInput()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need this? The tests pass without it and I think whenever we call clear we've already had to call GeoPolyViewModel#stopRecording right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think whenever we call clear we've already had to call GeoPolyViewModel#stopRecording right?

No, it’s not guaranteed. I didn’t think much about whether it’s mandatory here or not I just tried to mirror the old implementation. So if we used to set the flag to false here, I’m doing the same now.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Gotcha. I can maybe just pull it out in the next PR if it's not needed.

@grzesiek2010 grzesiek2010 requested a review from seadowg January 29, 2026 19:32
@WKobus
Copy link
Copy Markdown

WKobus commented Feb 3, 2026

Tested with success

Verified on Android 16

Verified cases:

  • Info dialog from button map and from constraint snackbar
  • Geotrace and geoshape questions
  • Different map sources
  • Light / dark mode
  • RTL

@srujner
Copy link
Copy Markdown

srujner commented Feb 3, 2026

Tested with success

Verified on Android 14

@dbemke
Copy link
Copy Markdown

dbemke commented Feb 3, 2026

Tested with success

Verified on Android 10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add info button to trace/shape questions

6 participants