Skip to content

Conversation

Jason-Whitmore
Copy link
Contributor

Description (required)

Fixes #6242

What changes did you make and why?

The removeMarker() method was changed to match the Overlay's title with the BaseMarker's Place name during the linear search for the correct overlay. This causes the correct marker to be removed along with the label when a new marker is selected.

Prior to this change, the Place coordinates were used to find the overlay. However, since multiple images may be taken at the same Place, the wrong overlay could be removed. This results in multiple pin labels appearing at the same time since the labels are hidden by deleting the Overlay and creating a new one with the label hidden.

Also, null checking was added to the removeMarker() method.

Tests performed (required)

To test, find multiple images in the Explore map that are taken at the same place and tap each of them. On main, multiple labels will display. On this PR, a maximum of one label will appear.

Tested ProdDebug on Android Studio Emulator with API level 34.

Before this change, the removeMarker() method would determine the correct overlay to remove
by comparing an overlay's Place coordinates with the target BaseMarker's Place coordinates.
If two different markers had the same Place coordinates, the incorrect marker would be removed,
leading to more than one green label appearing on the screen.

After this change, the removeMarker() method now compares an overlay's title with the BaseMarker's
Place name. removeMarker() will work properly as long as all BaseMarker's Place names are unique.
Also, null checks were added to removeMarker().
Copy link

✅ Generated APK variants!

Copy link
Member

@nicolas-raoul nicolas-raoul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working great, thanks! :-)

@nicolas-raoul nicolas-raoul merged commit 262efe4 into commons-app:main Apr 10, 2025
1 check passed
sonalyadav1 pushed a commit to sonalyadav1/apps-android-commons that referenced this pull request May 22, 2025
…ker (commons-app#6279)

Before this change, the removeMarker() method would determine the correct overlay to remove
by comparing an overlay's Place coordinates with the target BaseMarker's Place coordinates.
If two different markers had the same Place coordinates, the incorrect marker would be removed,
leading to more than one green label appearing on the screen.

After this change, the removeMarker() method now compares an overlay's title with the BaseMarker's
Place name. removeMarker() will work properly as long as all BaseMarker's Place names are unique.
Also, null checks were added to removeMarker().
@Jason-Whitmore Jason-Whitmore deleted the issue_6242 branch May 30, 2025 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Explore>Map: Two pin labels appear at the same time
2 participants