Skip to content

Commit

Permalink
OsmNavigator - fix issue on markers anchor
Browse files Browse the repository at this point in the history
  • Loading branch information
MKergall committed Jul 20, 2018
1 parent a3ddbd2 commit 42b5a0f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions OSMNavigator/src/main/java/com/osmnavigator/MapActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -788,8 +788,6 @@ public void onMarkerDragStart(Marker marker) {
/** Update (or create if null) a marker in itineraryMarkers. */
public Marker updateItineraryMarker(Marker marker, GeoPoint p, int index,
int titleResId, int markerResId, int imageResId, String address) {
Drawable icon = ResourcesCompat.getDrawable(getResources(), markerResId, null);
String title = getResources().getString(titleResId);
if (marker == null){
marker = new Marker(map);
marker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
Expand All @@ -798,9 +796,12 @@ public Marker updateItineraryMarker(Marker marker, GeoPoint p, int index,
marker.setOnMarkerDragListener(mItineraryListener);
mItineraryMarkers.add(marker);
}
String title = getResources().getString(titleResId);
marker.setTitle(title);
marker.setPosition(p);
Drawable icon = ResourcesCompat.getDrawable(getResources(), markerResId, null);
marker.setIcon(icon);
marker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM); //because bug in osmdroid 6.0.2
if (imageResId != -1)
marker.setImage(ResourcesCompat.getDrawable(getResources(), imageResId, null));
marker.setRelatedObject(index);
Expand Down

0 comments on commit 42b5a0f

Please sign in to comment.