Skip to content
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

Fixed disappearing location icon #4875

Merged
merged 1 commit into from
Oct 27, 2021
Merged

Conversation

grzesiek2010
Copy link
Member

@grzesiek2010 grzesiek2010 commented Oct 20, 2021

Closes #4873

What has been done to verify that this works as intended?

I tested the fix manually.

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

We need to make sure that the location icon is above all the other layers. Since we have a placeholder layer (always on top) it was relatively easy (I just added .layerAbove(PLACEHOLDER_LAYER_ID)).
Unfortunately it started throwing exceptions because of how we implemented changing layers. When we change layers we set the whole map style what removes all layers and then we add all of them again: https://github.com/getodk/collect/blob/master/collect_app/src/main/java/org/odk/collect/android/geo/MapboxMapFragment.java#L268
before we do that mapbox internally makes some calls on the location component (which after adding .layerAbove(PLACEHOLDER_LAYER_ID) is tied to the placeholder layer) before we add that layer again (so it doesn't exist at that moment). That's why I had to add resetLocationComponent() to temporarily remove that relation.
I don't know why our implementation works in that way instead of for example just removing the existing layer and adding a new one but I didn't want to touch it here.

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?

It should just fix the issue so please verify it does the job.

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

No.

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:

  • 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

@mmarciniak90
Copy link
Contributor

Tested with success

Verified on Android versions: 8.1, 10.0

Verified cases:

  • set offline layer on map view -> crosshair is visible
  • minimize when the offline layer is applied and crosshair is visible
  • Mapbox, Google Maps, OSM
  • Geopoint with a map view, Geoshape, Geotrace
  • offline layer form shared directory
  • offline layer from project directory
  • different offline layers

@kkrawczyk123
Copy link
Contributor

Verified also on Androids 5.1, 9.0 and 11.

@seadowg seadowg merged commit 081bcb2 into getodk:master Oct 27, 2021
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.

Crosshair disappears when change offline layer and minimize app when use Mapbox
4 participants