From cc2ee3cd7af55f181403d24e2935ec72168d7613 Mon Sep 17 00:00:00 2001 From: Eric Wolfe Date: Fri, 12 May 2017 06:13:09 -0700 Subject: [android] Update attribution wordmark (#8774) * Update wordmark on android * Moved attribution i icon to the right of mapbox word (in mapview preview image) * update padding and margin --- platform/android/CHANGELOG.md | 2 +- .../mapbox/mapboxsdk/maps/MapboxMapOptions.java | 30 +++++++++--------- .../java/com/mapbox/mapboxsdk/maps/UiSettings.java | 23 +++++--------- .../main/res/drawable-hdpi/mapbox_logo_icon.png | Bin 3408 -> 4778 bytes .../main/res/drawable-mdpi/mapbox_logo_icon.png | Bin 1958 -> 2622 bytes .../main/res/drawable-xhdpi/mapbox_logo_icon.png | Bin 4492 -> 6579 bytes .../main/res/drawable-xxhdpi/mapbox_logo_icon.png | Bin 7059 -> 10802 bytes .../main/res/drawable-xxxhdpi/mapbox_logo_icon.png | Bin 9402 -> 14441 bytes .../main/res/drawable/mapbox_info_icon_default.xml | 8 ++--- .../res/drawable/mapbox_info_icon_selected.xml | 10 +++--- .../main/res/layout/mapbox_mapview_internal.xml | 3 +- .../src/main/res/layout/mapbox_mapview_preview.xml | 35 ++++++++++++++------- .../src/main/res/values/dimens.xml | 9 ++++-- 13 files changed, 62 insertions(+), 58 deletions(-) diff --git a/platform/android/CHANGELOG.md b/platform/android/CHANGELOG.md index fdc6343b7c..7807334c14 100644 --- a/platform/android/CHANGELOG.md +++ b/platform/android/CHANGELOG.md @@ -3,7 +3,7 @@ Mapbox welcomes participation and contributions from everyone. If you'd like to do so please see the [`Contributing Guide`](https://github.com/mapbox/mapbox-gl-native/blob/master/CONTRIBUTING.md) first to get started. ## 5.1.0 - TBA - +* Update attribution with new Mapbox wordmark [#8774](https://github.com/mapbox/mapbox-gl-native/pull/8774) ## 5.1.0-beta.1 - May 2, 2017 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 8fcfdd6db0..68603ab1a3 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 @@ -35,10 +35,8 @@ import java.util.Arrays; */ public class MapboxMapOptions implements Parcelable { - private static final float DIMENSION_SEVEN_DP = 7f; - private static final float DIMENSION_TEN_DP = 10f; - private static final float DIMENSION_SIXTEEN_DP = 16f; - private static final float DIMENSION_SEVENTY_SIX_DP = 76f; + private static final float FOUR_DP = 4f; + private static final float EIGHTY_NINE_DP = 92f; private CameraPosition cameraPosition; @@ -206,13 +204,13 @@ public class MapboxMapOptions implements Parcelable { Gravity.TOP | Gravity.END)); mapboxMapOptions.compassMargins(new int[] { (int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiCompassMarginLeft, - DIMENSION_TEN_DP * pxlRatio)), + FOUR_DP * pxlRatio)), ((int) typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiCompassMarginTop, - DIMENSION_TEN_DP * pxlRatio)), + FOUR_DP * pxlRatio)), ((int) typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiCompassMarginRight, - DIMENSION_TEN_DP * pxlRatio)), + FOUR_DP * pxlRatio)), ((int) typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiCompassMarginBottom, - DIMENSION_TEN_DP * pxlRatio))}); + FOUR_DP * pxlRatio))}); mapboxMapOptions.compassFadesWhenFacingNorth(typedArray.getBoolean( R.styleable.mapbox_MapView_mapbox_uiCompassFadeFacingNorth, true)); Drawable compassDrawable = typedArray.getDrawable( @@ -227,13 +225,13 @@ public class MapboxMapOptions implements Parcelable { Gravity.BOTTOM | Gravity.START)); mapboxMapOptions.logoMargins(new int[] { (int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiLogoMarginLeft, - DIMENSION_SIXTEEN_DP * pxlRatio)), + FOUR_DP * pxlRatio)), (int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiLogoMarginTop, - DIMENSION_SIXTEEN_DP * pxlRatio)), + FOUR_DP * pxlRatio)), (int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiLogoMarginRight, - DIMENSION_SIXTEEN_DP * pxlRatio)), + FOUR_DP * pxlRatio)), (int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiLogoMarginBottom, - DIMENSION_SIXTEEN_DP * pxlRatio))}); + FOUR_DP * pxlRatio))}); mapboxMapOptions.attributionTintColor(typedArray.getColor( R.styleable.mapbox_MapView_mapbox_uiAttributionTintColor, -1)); @@ -243,13 +241,13 @@ public class MapboxMapOptions implements Parcelable { R.styleable.mapbox_MapView_mapbox_uiAttributionGravity, Gravity.BOTTOM)); mapboxMapOptions.attributionMargins(new int[] { (int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiAttributionMarginLeft, - DIMENSION_SEVENTY_SIX_DP) * pxlRatio), + EIGHTY_NINE_DP * pxlRatio)), (int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiAttributionMarginTop, - DIMENSION_SEVEN_DP * pxlRatio)), + FOUR_DP * pxlRatio)), (int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiAttributionMarginRight, - DIMENSION_SEVEN_DP * pxlRatio)), + FOUR_DP * pxlRatio)), (int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiAttributionMarginBottom, - DIMENSION_SEVEN_DP * pxlRatio))}); + FOUR_DP * pxlRatio))}); mapboxMapOptions.locationEnabled(typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_myLocation, false)); mapboxMapOptions.myLocationForegroundTintColor( diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java index 354a42536a..1bcf8a70b9 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java @@ -146,7 +146,7 @@ public final class UiSettings { if (compassMargins != null) { setCompassMargins(compassMargins[0], compassMargins[1], compassMargins[2], compassMargins[3]); } else { - int tenDp = (int) resources.getDimension(R.dimen.mapbox_ten_dp); + int tenDp = (int) resources.getDimension(R.dimen.mapbox_four_dp); setCompassMargins(tenDp, tenDp, tenDp, tenDp); } setCompassFadeFacingNorth(options.getCompassFadeFacingNorth()); @@ -171,9 +171,7 @@ public final class UiSettings { private byte[] convert(Bitmap resource) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); resource.compress(Bitmap.CompressFormat.PNG, 100, stream); - byte[] byteArray = stream.toByteArray(); - - return byteArray; + return stream.toByteArray(); } private void restoreCompass(Bundle savedInstanceState) { @@ -189,10 +187,7 @@ public final class UiSettings { private Drawable decode(byte[] bitmap) { Bitmap compass = BitmapFactory.decodeByteArray(bitmap, 0, bitmap.length); - - Drawable compassImage = new BitmapDrawable(compassView.getResources(), compass); - - return compassImage; + return new BitmapDrawable(compassView.getResources(), compass); } private void initialiseLogo(MapboxMapOptions options, Resources resources) { @@ -202,8 +197,8 @@ public final class UiSettings { if (logoMargins != null) { setLogoMargins(logoMargins[0], logoMargins[1], logoMargins[2], logoMargins[3]); } else { - int sixteenDp = (int) resources.getDimension(R.dimen.mapbox_sixteen_dp); - setLogoMargins(sixteenDp, sixteenDp, sixteenDp, sixteenDp); + int twoDp = (int) resources.getDimension(R.dimen.mapbox_two_dp); + setLogoMargins(twoDp, twoDp, twoDp, twoDp); } } @@ -226,16 +221,12 @@ public final class UiSettings { } private void initialiseAttribution(Context context, MapboxMapOptions options) { - Resources resources = context.getResources(); setAttributionEnabled(options.getAttributionEnabled()); setAttributionGravity(options.getAttributionGravity()); int[] attributionMargins = options.getAttributionMargins(); if (attributionMargins != null) { - setAttributionMargins(attributionMargins[0], attributionMargins[1], attributionMargins[2], attributionMargins[3]); - } else { - int sevenDp = (int) resources.getDimension(R.dimen.mapbox_seven_dp); - int seventySixDp = (int) resources.getDimension(R.dimen.mapbox_seventy_six_dp); - setAttributionMargins(seventySixDp, sevenDp, sevenDp, sevenDp); + setAttributionMargins(attributionMargins[0], attributionMargins[1], + attributionMargins[2], attributionMargins[3]); } int attributionTintColor = options.getAttributionTintColor(); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-hdpi/mapbox_logo_icon.png b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-hdpi/mapbox_logo_icon.png index c0f4ed2c4c..7568387a8d 100644 Binary files a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-hdpi/mapbox_logo_icon.png and b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-hdpi/mapbox_logo_icon.png differ diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-mdpi/mapbox_logo_icon.png b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-mdpi/mapbox_logo_icon.png index 5a9da3fe39..9cdec5151c 100644 Binary files a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-mdpi/mapbox_logo_icon.png and b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-mdpi/mapbox_logo_icon.png differ diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-xhdpi/mapbox_logo_icon.png b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-xhdpi/mapbox_logo_icon.png index 194aa64da2..7eec45f4b1 100644 Binary files a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-xhdpi/mapbox_logo_icon.png and b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-xhdpi/mapbox_logo_icon.png differ diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-xxhdpi/mapbox_logo_icon.png b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-xxhdpi/mapbox_logo_icon.png index d1260a16f3..5876056f1c 100644 Binary files a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-xxhdpi/mapbox_logo_icon.png and b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-xxhdpi/mapbox_logo_icon.png differ diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-xxxhdpi/mapbox_logo_icon.png b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-xxxhdpi/mapbox_logo_icon.png index 5f9647610a..e5780ccc07 100644 Binary files a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-xxxhdpi/mapbox_logo_icon.png and b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-xxxhdpi/mapbox_logo_icon.png differ diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable/mapbox_info_icon_default.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable/mapbox_info_icon_default.xml index fa82bb8d9b..65837d65d0 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable/mapbox_info_icon_default.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable/mapbox_info_icon_default.xml @@ -1,8 +1,8 @@ + android:width="21dp" + android:height="21dp" + android:viewportHeight="24.0" + android:viewportWidth="24.0"> diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable/mapbox_info_icon_selected.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable/mapbox_info_icon_selected.xml index 074928d05a..ccbd1d8d39 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable/mapbox_info_icon_selected.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable/mapbox_info_icon_selected.xml @@ -1,9 +1,9 @@ + android:width="21dp" + android:height="21dp" + android:viewportHeight="24.0" + android:viewportWidth="24.0"> + android:pathData="M11,17h2v-6h-2v6zm1,-15C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zm0,18c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2V7h-2v2z"/> diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_internal.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_internal.xml index e6a2677785..6d07de7baa 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_internal.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_internal.xml @@ -39,10 +39,9 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:adjustViewBounds="true" - android:background="@drawable/mapbox_default_bg_selector" android:clickable="true" + android:focusable="true" android:contentDescription="@string/mapbox_attributionsIconContentDescription" - android:padding="7dp" android:src="@drawable/mapbox_info_bg_selector"/> diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_preview.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_preview.xml index d015bc5785..1c1ab0e71b 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_preview.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_preview.xml @@ -1,22 +1,29 @@ + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + android:contentDescription="@null" + android:src="@drawable/mapbox_mapview_preview" + android:layout_alignParentTop="true" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true"/> @@ -24,18 +31,22 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" - android:layout_marginBottom="@dimen/mapbox_seven_dp" - android:layout_marginLeft="@dimen/mapbox_seventy_six_dp" + android:layout_toEndOf="@+id/logoView" + android:contentDescription="@null" + android:layout_marginBottom="@dimen/mapbox_four_dp" android:background="@drawable/mapbox_default_bg_selector" - android:clickable="true" - android:contentDescription="@string/mapbox_attributionsIconContentDescription" - android:src="@drawable/mapbox_info_bg_selector" /> + android:src="@drawable/mapbox_info_bg_selector" + android:layout_marginLeft="@dimen/mapbox_four_dp" + android:layout_marginStart="@dimen/mapbox_four_dp" + android:layout_toRightOf="@+id/logoView"/> + android:contentDescription="@null" + android:src="@drawable/mapbox_compass_icon"/> diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values/dimens.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values/dimens.xml index df6983e11d..ce20cb9a8b 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values/dimens.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values/dimens.xml @@ -4,10 +4,15 @@ 8dp -2dp 1.5dp - 7dp + @dimen/mapbox_two_dp + @dimen/mapbox_two_dp + @dimen/mapbox_two_dp + @dimen/mapbox_two_dp + 2dp + 4dp 8dp 10dp 16dp - 76dp + 95dp 18dp -- cgit v1.2.1