-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a new MapActivity that shows saved forms on a map. #3447
Conversation
I've made the map markers clickable and customized the icons according to the status of each form instance. (Feels quite satisfying to tap a blue icon, mark finalized, save, and see it turn purple on the map!) I believe this PR is now feature-complete (as defined by the design document and ready for review! |
b11ccde
to
a4555b4
Compare
Hmm, looks like I can't directly add labels so I can't tag this |
This is fantastic.
The whole thing is super satisfying! 🎉 🗺 Zoom to bounds is a really nice addition. 💯 I'll be diving into the code now but I have a few UI/UX observations:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really not much to say here. The commit history is really straightforward to review, thank you.
collect_app/src/main/java/org/odk/collect/android/database/helpers/InstancesDatabaseHelper.java
Outdated
Show resolved
Hide resolved
collect_app/src/main/java/org/odk/collect/android/tasks/SaveToDiskTask.java
Outdated
Show resolved
Hide resolved
collect_app/src/main/java/org/odk/collect/android/adapters/FormListAdapter.java
Show resolved
Hide resolved
I'm travelling to DRC very soon, so @lognaturel is taking this PR forward from here. Thank you so much @lognaturel ! |
You've taken us most of the way to this fantastic feature, @zestyping! Safe travels and may the impact of your work continue to grow. For those who may not know, DRC has an ebola outbreak and @zestyping is going to be iterating on and deploying some software to support frontline workers there (including a bit of ODK!). This is what the icon looks like in black (CC @seadowg): I have a slight preference for this. @smoyth, @cooperka, since you also reviewed Material Design guidelines when you reworked this screen and have some interest in this feature, please consider weighing in. The immediate question is whether the icon should be filled blue or black but feel free to make other suggestions. |
Super cool functionality! Latest screenshot LGTM in terms of Material Design. Nice work all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few comments on Material Design/Theming things. The feature looks really cool though!
collect_app/src/main/res/layout/form_chooser_list_item_map_button.xml
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,9 @@ | |||
<vector xmlns:android="http://schemas.android.com/apk/res/android" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these icons coming from Studio's Vector Assests tool? If so could we leave the names the way they are when they are generated? That way it's easier to work out whether we already have an icon in our resources or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going through the Vector Assets tool gives name ic_room_black_24dp
no matter the tint. The icon already exists without a tint as ic_place_black
and is used for warning dialogs related to location.
For this feature, there are 4 colored variants needed as you can see in getDrawableIdForStatus
. Is there a way to do that other than introducing 4 resources?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add that the marker gets set by the setMarkerIcon
method defined by the MapFragment
interface. I believe that to use a single black icon and tint it, we'd have to introduce a new method there and make sure hat all three mapping engines (Mapbox, OSM, Google Maps) all support tinting across all API levels. Does that seem worth it, @seadowg?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see because it takes a resource int
I see. Yeah right now that does feel like a bigger disruption. For the moment can we just have them named like ic_room_red_24dp
, ic_room_blue_24dp
etc?
Just a not on tinting though: My impression is that we'd be able to use DrawableCompat.wrap
to create "tintable" drawables back to at least API 14. I guess that it might not work with map engines for some reason but I think we could probably just test at our min API level.
0232b7f
to
410ffd5
Compare
…(new version is 6).
@lognaturel after today's testing, I have a few thoughts
|
Yes, this is important because users want to be able to perform their data collection in the context of the map view. That is, they may use the map to navigate and to evaluate their progress.
Can you elaborate on your concerns? Do you think it’s distracting, possibly reveals information, something else? Our reasoning is that it’s broadly useful but also clearly a secondary action so not disruptive. We do have to be careful not to allow users to do things they couldn’t do before, though. For that reason, if Edit Saved Form is made unavailable from the admin menu, instances can’t be edited. Instances that are deleted won’t be mapped. I went back and forth on what to do when the View Sent Form button wasn’t available. Ultimately I decided that it’s reasonable to still make sent instances visible on the map because those instances are still on the device. If the issue is data sensitivity, it’s not a bad thing for users to more clearly see that the data is still on the device so that they can turn on delete after send, for example. I will look into 3-5, thank you! |
@lognaturel I continued testing and here are results:
You dispelled my doubts 😄 Cases verified with success:
Problems with removing response Use case:
Expected result
Use case 2:
Expected result
Problem with moving backward option Use case 3:
Expected result:
|
@opendatakit-bot unlabel "needs testing" |
Prior to 0a6bb3d, it was possible to open instances for viewing when moving backwards was disabled but 0a6bb3d broke that by moving the mode detection (view sent vs edit saved) into an else block. This logic needs some rethinking but I've left a TODO for now because it's not related to the form map view.
Thank you so much for the thorough review, @mmarciniak90!
Glad to hear it! I do think it's a very valid question and if you come up with any other concerns, please share them. Todo:
The two bugs you found should be fixed. 🙏 I haven't made much progress on the other three smaller issues you pointed out. Given that those three are relatively small, I think we could file them as separate issues? Alternately, we can see what I can get done during my Monday. For the tap surface, I think that adding an Another quick thing -- both forms and instance databases have been added to. If you haven't already, please check downgrading. |
@lognaturel I'm guessing the problem is that the whole list item is clickable and that surrounds the button? It looks like the style of the button is all good ( |
@obdulia-losantos It'd be great to get your feedback on this initial version of the feature! This forum post has a screen capture as well as information on how to download a beta with the functionality. |
9cf5a01 makes all space above and below the map outlined button as well as 16dp to the left and to the right tappable. I'm not proud of the approach but I looked into negative margins and they seem to be tolerated (see e.g. https://stackoverflow.com/a/10673572/137744). I could not reproduce the horizontal center issue after that change. Perhaps it has been addressed? The leak that is now happening frequently is the following which I can't figure out:
|
@lognaturel I focused on upgrade more today and I checked more cases than before. I noticed one thing that can be good to improve:
Expected result: |
I agree that this is really annoying. Unfortunately, I think trying to parse existing forms and instances to add the functionality is too risky. This is because form definitions can take a long time to parse depending on their length and the capacity of the device used. There could also potentially be several form definitions. That means we'd have to be sure to provide user feedback that this process is ongoing. We'd probably also want to let the user continue filling out forms. There are then lots of possible failure states to handle and I think it's cleaner to say that only forms downloaded with version 1.25 or later will be mapped. I'm disappointed because it is a big limitation but I don't see a good alternative. |
Is this (need to re-parse forms) something that is likely to come up again in the future? What about adding a manual "re-parse forms" action in the settings. It wouldn't be as smooth as just doing it automatically but for folks who don't have the option to easily re-download their forms, it could help. We could potentially/eventually pair this with a "new release notes" modal that lets users know about new features when they are released. Might that be a good practice anyway? |
That's a good question and concept, @smoyth. I don't see any immediate other need for parsing existing forms and instances in this way but I can imagine that we'll want to similarly cache other things from the form definition in the future. Do you see it as a must-have for this initial release of the map feature or do you think it's something we could add on if we get feedback that it's essential?
This has come up at various points and I'm not really sure how to reason about it because often the people who need to know about the new features are form designers or trainers rather than end users. Even in the case of a feature like this, it's a bit hard to know what to say because it's highly dependent on the structure of forms that will be put on the device. |
Definitely not a must-have for my purposes. I don't have a good sense of what other users might be needing... |
Tested with success Verified on Android: 10.0, 9.0, 8.1, 7.0, 6.0, 5.1, 4.4, 4.2 Final test cases:
@opendatakit-bot unlabel "needs testing" |
Closes #61
See the design document for background, details on the design of this feature, the supporting reasoning, and the implementation plan.
Related issues: #61, getodk/getodk#511
Forum discussion: Visualize ... the data collected with ODK on a map
Roadmap item: Collect: Map submissions on device
The new form chooser list:
The new MapActivity with custom icons:
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 user-visible behaviour changes in this PR are:
The affected areas of the codebase are:
What has been done to verify that this works as intended?
I manually tested each of the behaviour changes shown above. In particular:
Why is this the best possible solution? Were any other approaches considered?
See the design document for the background and rationale.
Does this change require updates to documentation? If so, please file an issue here and include the link below.
Yes: getodk/docs#1144
Before submitting this PR, please make sure you have:
./gradlew checkAll
and confirmed all checks still pass OR confirm CircleCI build passes and run./gradlew connectedDebugAndroidTest
locally.