Skip to content

Commit

Permalink
- android: hide default markers
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Vasin committed Oct 25, 2017
1 parent e627f46 commit 52d3136
Showing 1 changed file with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ public Object getFeature() {
@Override
public void addToMap(GoogleMap map) {
marker = map.addMarker(getMarkerOptions());

}

@Override
Expand Down Expand Up @@ -234,22 +233,13 @@ public void setScale(float scale) {
this.composeIcon();
}

private BitmapDescriptor getIcon() {
if (iconBitmapDescriptor != null) {
// use local image as a marker
return iconBitmapDescriptor;
} else {
// render the default marker pin
return BitmapDescriptorFactory.defaultMarker(10);
}
}

private MarkerOptions createMarkerOptions() {
MarkerOptions options = new MarkerOptions().position(position);
if (anchorIsSet)
options.anchor(anchorX, anchorY);
options.zIndex(zIndex);
options.icon(getIcon());
options.icon(iconBitmapDescriptor);
options.alpha(iconBitmapDescriptor == null ? 0.0f : 1.0f);
return options;
}

Expand Down Expand Up @@ -310,6 +300,11 @@ public void update() {
if (marker == null)
return;

marker.setIcon(getIcon());
if (iconBitmapDescriptor != null) {
marker.setIcon(iconBitmapDescriptor);
marker.setAlpha(1.0f);
} else {
marker.setAlpha(0.0f);
}
}
}

0 comments on commit 52d3136

Please sign in to comment.