added ability to specify sprite in marker #1716

This commit is contained in:
Nicholas Hallahan
2015-07-17 08:25:48 -07:00
parent ed650b4128
commit aafcdd2ef0
5 changed files with 69 additions and 9 deletions

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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);

View File

@@ -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!"));
}