#2535 - Restoring default marker setting and adding null check. Making sprite field private to enforce using setter method for added protection.

This commit is contained in:
Brad Leege
2015-10-07 09:44:04 -05:00
parent 1179096dd8
commit 463c52fa7e
2 changed files with 6 additions and 4 deletions

View File

@@ -2,6 +2,7 @@ package com.mapbox.mapboxsdk.annotations;
import android.graphics.Point;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.View;
import com.mapbox.mapboxsdk.R;
import com.mapbox.mapboxsdk.geometry.LatLng;
@@ -19,7 +20,7 @@ public class Marker extends Annotation {
LatLng position;
float rotation;
String snippet;
String sprite;
private String sprite = "default_marker";
String title;
private InfoWindow infoWindow = null;
@@ -140,7 +141,9 @@ public class Marker extends Annotation {
* @param sprite The name of the sprite.
*/
public void setSprite(@Nullable String sprite) {
this.sprite = sprite;
if (!TextUtils.isEmpty(sprite)) {
this.sprite = sprite;
}
}
public String getSprite() {

View File

@@ -1,7 +1,6 @@
package com.mapbox.mapboxsdk.annotations;
import android.support.annotation.Nullable;
import com.mapbox.mapboxsdk.geometry.LatLng;
public class MarkerOptions extends AnnotationOptions {
@@ -101,7 +100,7 @@ public class MarkerOptions extends AnnotationOptions {
}
public MarkerOptions sprite(@Nullable String sprite) {
((Marker)annotation).sprite = sprite;
((Marker)annotation).setSprite(sprite);
return this;
}