-
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
Merge Google and OSM GeoPoint activities into one activity using the common MapFragment interface. #2776
Merge Google and OSM GeoPoint activities into one activity using the common MapFragment interface. #2776
Conversation
254d2e9
to
915d30a
Compare
915d30a
to
e2d17f9
Compare
Rebased onto master. |
a1d0bb7
to
c674fe9
Compare
…Poly to PolyFeature.
…old and new GeoPoint activity.
c674fe9
to
090bcff
Compare
@opendatakit-bot label "needs-testing" |
ERROR: Label "needs-testing" does not exist and was thus not added to this pull request. |
@opendatakit-bot label "needs testing" |
The CircleCI failure looks to me like an intermittent network error:
Is there a way to re-run the checks? |
090bcff
to
121257f
Compare
121257f
to
2ca7710
Compare
double sd = 0; | ||
try { | ||
sd = Double.parseDouble(marker.getSubDescription()); | ||
} catch (NumberFormatException e) { /* ignore */ } |
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 think logging at least Timber.w would be good here? We usually don't ignore exceptions.
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.
Okay! I also fixed a similar ignored exception in GoogleMapFragment.
|
||
@Override public @Nullable MapPoint getMarkerPoint(int featureId) { | ||
MapFeature feature = features.get(featureId); | ||
if (feature instanceof MarkerFeature) { |
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.
Don't you like ternary operators? I would prefer it here?
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.
Sure! Sometimes I use them; in this case it didn't occur to me. Fixed.
|
||
@Override public @Nullable MapPoint getMarkerPoint(int featureId) { | ||
MapFeature feature = features.get(featureId); | ||
if (feature instanceof MarkerFeature) { |
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.
The same like above, ternary operator would be good here.
I found only some minor things to improve so I'm going to add EDIT: since #2797 is based on this branch let's test only that pr. |
Thanks for the review, @grzesiek2010! I've fixed the things you pointed out. |
@kkrawczyk123 @mmarciniak90 Is it helpful to have the old activities still accessible for comparison testing (with the ability to switch between new and old using the volume buttons), or can I remove them so that this PR is in its final state ready for merging? |
…corded point and not the GPS location).
@grzesiek2010 Hey, I discovered two bugs—so sorry I missed these before your review!
I've now fixed these in the recent commits. Could you have another quick look? |
8cbb742
to
ee12532
Compare
Found and fixed two more small issues. This'll be the last, I hope!
|
This pull request is now obsolete; it has been rolled into #2865. |
Overview
This pull request merges
GeoPointMapActivity
(which was Google-specific) andGeoPointOsmMapActivity
(which is OSM-specific) into a single activity,GeoPointMapActivity
, using the commonMapFragment
interface added in #2465. TheMapFragment
interface is extended to support point markers, which are used by the activity.Guidance to reviewers
This PR will probably be easiest to review by going through the commits one by one; most of the commits are straightforward. The biggest change is in c69bf44, which migrates the new activity to use MapFragment instead of GoogleMap. Because MapFragment is a higher-level interface, some of the logic and state in the GeoPointMapActivity got simplified away. If anything in there is confusing, please feel free to reach out to me with any questions—I'm also happy to talk it over with you. Sometimes a short conversation can really help speed up a review.
What has been done to verify that this works as intended?
I've manually tested, in both Google and OSM modes:
Why is this the best possible solution? Were any other approaches considered?
There is currently a great deal of code duplicated between
GeoPointMapActivity
andGeoPointOsmMapActivity
, including some vestigial code, member fields that are trivial or unused, and duplicated layouts. This solution eliminates most of that duplication.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 only user-visible behaviour changes should be:
Do we need any specific form for testing your changes? If so, please attach one.
Any form that uses the GeoPoint widget with "placement-map" or "map" appearance will do. Here's the one I've been using:
geo-widgets.zip
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:
./gradlew checkAll
and confirmed all checks still pass OR confirm CircleCI build passes and run./gradlew connectedDebugAndroidTest
locally.