[android] Dynamic update of InfowWindow with InfoWindowAdapter example

Fixes #5353
This commit is contained in:
Ivo van Dongen
2016-06-16 14:30:34 +02:00
committed by Antonio Zugaldia
parent cc1e2610c7
commit 2033d756c2
6 changed files with 218 additions and 1 deletions

View File

@@ -259,11 +259,20 @@ public class InfoWindow {
View view = mView.get();
if (mapboxMap != null && marker != null && view != null) {
mCoordinates = mapboxMap.getProjection().toScreenLocation(marker.getPosition());
view.setX(mCoordinates.x + mViewWidthOffset - mMarkerWidthOffset);
if (view instanceof InfoWindowView) {
view.setX(mCoordinates.x + mViewWidthOffset - mMarkerWidthOffset);
} else {
view.setX(mCoordinates.x - (view.getMeasuredWidth() / 2) - mMarkerWidthOffset);
}
view.setY(mCoordinates.y + mMarkerHeightOffset);
}
}
public View getView() {
return mView != null ? mView.get() : null;
}
boolean isVisible() {
return mIsVisible;
}

View File

@@ -117,6 +117,11 @@ public class Marker extends Annotation {
refreshInfoWindowContent();
}
@Nullable
public InfoWindow getInfoWindow() {
return infoWindow;
}
/**
* Update only for default Marker's InfoWindow content for Title and Snippet
*/