diff options
author | Tobrun <tobrun@mapbox.com> | 2016-04-26 09:52:14 +0200 |
---|---|---|
committer | Tobrun <tobrun@mapbox.com> | 2016-04-26 12:28:36 +0200 |
commit | b39d289920ad805f4dc64b6fe452399046f2baf3 (patch) | |
tree | 69558bdd2fe9634487a31a15ca1be3602f20522e /platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java | |
parent | 3602fdc040de9dfd700e9130d8db68e045f133db (diff) | |
download | qtlocation-mapboxgl-b39d289920ad805f4dc64b6fe452399046f2baf3.tar.gz |
[android] #3231 - add support for tinting attribution icon through xml - MapboxMapOptions, AttributionDialog will use the same color values
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java index 6b7a0db8bd..764a901d8b 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java @@ -4,6 +4,7 @@ import android.content.Context; import android.content.res.TypedArray; import android.os.Parcel; import android.os.Parcelable; +import android.support.annotation.ColorInt; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.util.AttributeSet; @@ -40,6 +41,8 @@ public class MapboxMapOptions implements Parcelable { private int logoGravity = Gravity.BOTTOM | Gravity.START; private int logoMargins[]; + @ColorInt + private int attributionTintColor = -1; private boolean attributionEnabled = true; private int attributionGravity = Gravity.BOTTOM; private int attributionMargins[]; @@ -79,6 +82,7 @@ public class MapboxMapOptions implements Parcelable { attributionEnabled = in.readByte() != 0; attributionGravity = in.readInt(); attributionMargins = in.createIntArray(); + attributionTintColor = in.readInt(); minZoom = in.readFloat(); maxZoom = in.readFloat(); @@ -137,6 +141,7 @@ public class MapboxMapOptions implements Parcelable { , (int) (typedArray.getDimension(R.styleable.MapView_logo_margin_right, DIMENSION_SIXTEEN_DP) * screenDensity) , (int) (typedArray.getDimension(R.styleable.MapView_logo_margin_bottom, DIMENSION_SIXTEEN_DP) * screenDensity)}); + mapboxMapOptions.attributionTintColor(typedArray.getColor(R.styleable.MapView_attribution_tint, -1)); mapboxMapOptions.attributionEnabled(typedArray.getBoolean(R.styleable.MapView_attribution_enabled, true)); mapboxMapOptions.attributionGravity(typedArray.getInt(R.styleable.MapView_attribution_gravity, Gravity.BOTTOM)); mapboxMapOptions.attributionMargins(new int[]{(int) (typedArray.getDimension(R.styleable.MapView_attribution_margin_left, DIMENSION_SEVENTY_SIX_DP) * screenDensity) @@ -317,6 +322,17 @@ public class MapboxMapOptions implements Parcelable { } /** + * Specifies the tint color of the attribution for a map view + * + * @param color integer resembling a color + * @return This + */ + public MapboxMapOptions attributionTintColor(@ColorInt int color) { + attributionTintColor = color; + return this; + } + + /** * Specifies if the rotate gesture is enabled for a map view. * * @param enabled True and gesture will be enabled @@ -553,6 +569,11 @@ public class MapboxMapOptions implements Parcelable { return attributionMargins; } + @ColorInt + public int getAttributionTintColor() { + return attributionTintColor; + } + /** * Get the current configured user location view state for a map view. * @@ -603,6 +624,7 @@ public class MapboxMapOptions implements Parcelable { dest.writeByte((byte) (attributionEnabled ? 1 : 0)); dest.writeInt(attributionGravity); dest.writeIntArray(attributionMargins); + dest.writeInt(attributionTintColor); dest.writeFloat(minZoom); dest.writeFloat(maxZoom); |