-
Notifications
You must be signed in to change notification settings - Fork 0
‐Fix for #5540 Unable to reopen a map…
Improve quick behaviour in SelectOneFromMapWidget
Fixes for #5540
Tested manually using form select-quick.xml defined in select-quick.xlsx.
Auto-advance now behaves exactly as for SelectOneMinimalWidget
and widget can be re-opened.
There are two independent aspects to this issue.
...and then skip to the next question...
In SelectOneFromMapWidget
, the Context
as AdvanceToNextListener
is now alerted in setData
on the lines of SelectOneMinimalWidget
. WidgetFactory
is adjusted to pass in isQuick
.
(Aligning the behaviour exactly with SelectOneMinimalWidget
was an interesting exercise in null safety, necessitated by a tiny detail in the internals of Selection
.)
...they should be able to change their selection...
SelectionMapFragment
implements quick by setting skipSummary
so that onFeatureClicked
jumps direct to setFragmentResult
in FragmentManager
; onFragmentResult
in SelectOneFromMapDialogFragment
then tidies up and calls dismiss
.
When the user tries to reopen the widget as described in the issue, onFeatureClicked
is called again from updateItems
to display (if skipSummary
is not set) the previouslySelectedItem
, so (since skipSummary
is set) SelectOneFromMapDialogFragment
quits immediately.
Making skipSummary
set previouslySelectedItem
to null
stops this happening.
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?
No impact on tests; SelectOneFromMapWidgetTest
, SelectOneFromMapDialogFragmentTest
and SelectionMapFragmentTest
all
pass unmodified (none of them currently tests for quick).
Form as above
Does this change require updates to documentation? If so, please file an issue here and include the link below.
No.
- run
./gradlew checkAll
and confirmed all checks still pass OR confirm CircleCI build passes and run./gradlew connectedDebugAndroidTest
locally. - 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
Having now explored this issue in detail, it turns out that appearance quick leads a double life.
Most obviously, it enables auto-advance via AdvanceToNextListener
in several of the classes returned in WidgetFactory
from getSelectOneWidget
, though not in SelectOneFromMapWidget
.
In SelectOneFromMapWidget
by contrast, quick is used to skip the summary toast, with a side effect of preventing reopening that might be either a bug or a feature.
Looking at the code for SelectOneFromMapWidget
, SelectOneFromMapDialogFragment
and SelectionMapFragment
(in particular onFeatureClicked
), skipping the toast is clearly a considered feature.
And the non-reopening behaviour has a certain logic - there's no reason to reopen the map unless you want to make a new selection, in which case just press Remove response first.
So do we want to treat this issue as worth further attention?
To see this in detail,
- Load form maps-quick.xml defined by maps-quick.xlsx.
- Enter data into items A, B, C in each of groups no-quick and with-quick.
- Note that
- none of the items in group with-quick interprets quick as auto-advance.
- item C in group no-quick responds to selection with a confirmation toast; it can be reopened.
- item C in group with-quick responds to selection by saving and exiting without a confirmation toast; it cannot be reopened.
I've raised this issue to formalise the subsidiary one raised in #5540.
As for #5540 - 2022.4.4, 2023.1.2, the master version db8f7ec
As for #5540 - 10, 13; also 7
As for #5540 - Redmi 9T, Galaxy A32; also Samsung SM719
From #5540:
...When the quick appearance is added to select one from map question, the form doesn’t advance immediately to the next question once a selection is made.
- Load select-one-quick.xml - defined in select-one-quick.xlsx
- In group no-map, verify quick (auto-advance) behaviour in widgets B, C, D.
- In group with-map, verify lack of auto-advance in widgets B, C, D.
Auto-advance behaviour should be identical in groups no-map and with-map.
I have a fix ready for PR
It's complicated, see Design notes below