Fix multiple current location marker issue (#3243)

This commit is contained in:
neslihanturan 2019-11-29 19:15:26 +03:00 committed by Vivek Maskara
parent 21503fc786
commit 1c470241e3
2 changed files with 5 additions and 3 deletions

View file

@ -315,6 +315,7 @@ public class NearbyMapFragment extends CommonsDaggerSupportFragment
*/
@Override
public void addCurrentLocationMarker(LatLng curLatLng) {
removeCurrentLocationMarker();
Timber.d("Adds current location marker");
Icon icon = IconFactory.getInstance(getContext()).fromResource(R.drawable.current_location_marker);
@ -336,9 +337,11 @@ public class NearbyMapFragment extends CommonsDaggerSupportFragment
@Override
public void removeCurrentLocationMarker() {
if (currentLocationMarker != null) {
mapboxMap.removeMarker(currentLocationMarker);
mapboxMap.removePolygon(currentLocationPolygon);
}
}
/**
* Filters markers based on selectedLabels and chips

View file

@ -842,7 +842,6 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
@Override
public void recenterMap(fr.free.nrw.commons.location.LatLng curLatLng) {
nearbyMapFragment.removeCurrentLocationMarker();
nearbyMapFragment.addCurrentLocationMarker(curLatLng);
CameraPosition position;