Skip to content

Use Fragment for geopoly UI#6985

Merged
grzesiek2010 merged 26 commits intogetodk:masterfrom
seadowg:geopoly-fragment
Dec 11, 2025
Merged

Use Fragment for geopoly UI#6985
grzesiek2010 merged 26 commits intogetodk:masterfrom
seadowg:geopoly-fragment

Conversation

@seadowg
Copy link
Member

@seadowg seadowg commented Dec 4, 2025

Work towards #6969

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

To make it easier for the geopoly UI to access the form to deal with constraints, I pulled it into a Fragment that could be hosted by a shared "widget answer dialog" component (WidgetAnswerDialogFragment) that "select one from map" also uses.

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?

There should be no changes in behaviour here other than that I'd expect #6984 to affect geotrace/geoshape as well now. The main thing to look at here is the geopoly question UI to check that there are no regressions. I think for the moment we can hold off on testing in different map engines.

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 marked this pull request as ready for review December 9, 2025 10:06
@seadowg seadowg marked this pull request as draft December 9, 2025 10:06
import org.odk.collect.material.MaterialFullScreenDialogFragment
import kotlin.reflect.KClass

abstract class WidgetAnswerDialogFragment<T : Fragment>(
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 imagine pretty soon we'll want this to be more general so that the "child" view doesn't have to be a Fragment (and allow Composables etc). I thought it'd be better to wait for that to be needed than try and anticipate the ideal structure now though.

public class GeoPolyActivity extends LocalizedActivity implements GeoPolySettingsDialogFragment.SettingsDialogCallback {
public static final String EXTRA_POLYGON = "answer";
public static final String OUTPUT_MODE_KEY = "output_mode";
public class GeoPolyFragment extends Fragment implements GeoPolySettingsDialogFragment.SettingsDialogCallback {
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've not converted this to Kotlin yet as I haven't really had to touch much of the implementation. We should convert before adding in the new UI though.

@seadowg seadowg marked this pull request as ready for review December 9, 2025 17:33
@seadowg seadowg requested a review from grzesiek2010 December 9, 2025 18:02
@grzesiek2010 grzesiek2010 merged commit d4a41fb into getodk:master Dec 11, 2025
7 checks passed
@seadowg seadowg deleted the geopoly-fragment branch December 12, 2025 08:51
@dbemke
Copy link

dbemke commented Dec 18, 2025

Tested with Success!

Verified on Androids: 10 and 16 (by WIktor)

Verified cases:

  • saving and removing answers in geoshape and geotrace
  • regression checks in geoshape and geotrace

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.

3 participants