added ability to specify sprite in marker #1716
This commit is contained in:
@@ -14,6 +14,7 @@ public class Marker extends Annotation {
|
||||
LatLng position;
|
||||
float rotation;
|
||||
String snippet;
|
||||
String sprite = "default_marker";
|
||||
String title;
|
||||
|
||||
private boolean infoWindowShown = false;
|
||||
@@ -113,6 +114,10 @@ public class Marker extends Annotation {
|
||||
this.snippet = snippet;
|
||||
}
|
||||
|
||||
void setSprite(String sprite) {
|
||||
this.sprite = sprite;
|
||||
}
|
||||
|
||||
void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@@ -98,6 +98,11 @@ public class MarkerOptions extends AnnotationOptions {
|
||||
return this;
|
||||
}
|
||||
|
||||
public MarkerOptions sprite(String sprite) {
|
||||
((Marker)annotation).sprite = sprite;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MarkerOptions title(String title) {
|
||||
((Marker)annotation).title = title;
|
||||
return this;
|
||||
|
||||
@@ -217,8 +217,7 @@ class NativeMapView {
|
||||
}
|
||||
|
||||
public long addMarker(Marker marker) {
|
||||
LatLng latLng = marker.getPosition();
|
||||
return nativeAddMarker(mNativeMapViewPtr, latLng);
|
||||
return nativeAddMarker(mNativeMapViewPtr, marker);
|
||||
}
|
||||
|
||||
public long addPolyline(Polyline polyline) {
|
||||
@@ -467,7 +466,7 @@ class NativeMapView {
|
||||
private native void nativeSetLatLng(long nativeMapViewPtr, LatLng latLng,
|
||||
long duration);
|
||||
|
||||
private native long nativeAddMarker(long nativeMapViewPtr, LatLng latLng);
|
||||
private native long nativeAddMarker(long nativeMapViewPtr, Marker marker);
|
||||
|
||||
private native long nativeAddPolyline(long nativeMapViewPtr, Polyline polyline);
|
||||
|
||||
|
||||
@@ -300,6 +300,7 @@ public class MainActivity extends ActionBarActivity {
|
||||
LatLng cheeseRoom = new LatLng(38.531577,-122.010646);
|
||||
map.addMarker(new MarkerOptions()
|
||||
.position(cheeseRoom)
|
||||
.sprite("dog-park-15")
|
||||
.title("Cheese Room")
|
||||
.snippet("The only air conditioned room on the property!"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user