Allows for setting the user location icon to transparent (#7393)

* allows for setting the user location icon to transparent

* removed color check
This commit is contained in:
Cameron Mace
2016-12-14 12:51:04 -05:00
committed by GitHub
parent 8f24119bd0
commit 3d5983f6f6
6 changed files with 73 additions and 25 deletions

View File

@@ -211,8 +211,8 @@ public class MapboxMapOptions implements Parcelable {
, (int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiAttributionMarginBottom, DIMENSION_SEVEN_DP * screenDensity))});
mapboxMapOptions.locationEnabled(typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_myLocation, false));
mapboxMapOptions.myLocationForegroundTintColor(typedArray.getColor(R.styleable.mapbox_MapView_mapbox_myLocationTintColor, Color.TRANSPARENT));
mapboxMapOptions.myLocationBackgroundTintColor(typedArray.getColor(R.styleable.mapbox_MapView_mapbox_myLocationBackgroundTintColor, Color.TRANSPARENT));
mapboxMapOptions.myLocationForegroundTintColor(typedArray.getColor(R.styleable.mapbox_MapView_mapbox_myLocationTintColor, ColorUtils.getPrimaryColor(context)));
mapboxMapOptions.myLocationBackgroundTintColor(typedArray.getColor(R.styleable.mapbox_MapView_mapbox_myLocationBackgroundTintColor, Color.WHITE));
Drawable foregroundDrawable = typedArray.getDrawable(R.styleable.mapbox_MapView_mapbox_myLocationDrawable);
if (foregroundDrawable == null) {

View File

@@ -173,13 +173,11 @@ public class MyLocationView extends View {
}
public final void setForegroundDrawableTint(@ColorInt int color) {
if (color != Color.TRANSPARENT) {
if (foregroundDrawable != null) {
foregroundDrawable.mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN);
}
if (foregroundBearingDrawable != null) {
foregroundBearingDrawable.mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN);
}
if (foregroundDrawable != null) {
foregroundDrawable.mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN);
}
if (foregroundBearingDrawable != null) {
foregroundBearingDrawable.mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN);
}
invalidate();
}
@@ -202,12 +200,10 @@ public class MyLocationView extends View {
}
public final void setShadowDrawableTint(@ColorInt int color) {
if (color != Color.TRANSPARENT) {
if (backgroundDrawable == null) {
return;
}
backgroundDrawable.mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN);
if (backgroundDrawable == null) {
return;
}
backgroundDrawable.mutate().setColorFilter(color, PorterDuff.Mode.SRC_IN);
invalidate();
}