[android] #3231 - add support for tinting attribution icon through xml - MapboxMapOptions, AttributionDialog will use the same color values

This commit is contained in:
Tobrun
2016-04-26 09:52:14 +02:00
parent 3602fdc040
commit b39d289920
9 changed files with 106 additions and 44 deletions

View File

@@ -41,6 +41,7 @@ public class PolygonActivity extends AppCompatActivity {
// configure inital map state
MapboxMapOptions options = new MapboxMapOptions()
.attributionTintColor(Color.RED)
.accessToken(getString(R.string.mapbox_access_token))
.styleUrl(Style.MAPBOX_STREETS)
.camera(new CameraPosition.Builder()

View File

@@ -19,6 +19,7 @@
android:layout_below="@+id/toolbar"
app:center_latitude="47.798202"
app:center_longitude="7.573781"
app:attribution_tint="@android:color/holo_green_dark"
app:style_url="@string/style_mapbox_streets"
app:zoom="4" />

View File

@@ -1,5 +1,6 @@
package com.mapbox.mapboxsdk.maps;
import android.graphics.Color;
import android.view.Gravity;
import com.mapbox.mapboxsdk.camera.CameraPosition;
@@ -70,6 +71,12 @@ public class MapboxMapOptionsTest {
assertFalse(Arrays.equals(new int[]{0, 1, 2, 3}, new MapboxMapOptions().logoMargins(new int[]{0, 0, 0, 0}).getLogoMargins()));
}
@Test
public void testAttributionTintColor() {
assertEquals(-1, new MapboxMapOptions().getAttributionTintColor());
assertEquals(Color.RED, new MapboxMapOptions().attributionTintColor(Color.RED).getAttributionTintColor());
}
@Test
public void testAttributionEnabled() {
assertTrue(new MapboxMapOptions().attributionEnabled(true).getAttributionEnabled());
@@ -166,6 +173,5 @@ public class MapboxMapOptionsTest {
assertEquals("test", new MapboxMapOptions().accessToken("test").getAccessToken());
assertNotEquals("nottest", new MapboxMapOptions().accessToken("test").getStyle());
}
}