Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Commit cc2ee3c

Browse files
ericrwolfetobrun
authored andcommitted
[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
1 parent 6b0e0a9 commit cc2ee3c

File tree

13 files changed

+62
-58
lines changed

13 files changed

+62
-58
lines changed

platform/android/CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
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.
44

55
## 5.1.0 - TBA
6-
6+
* Update attribution with new Mapbox wordmark [#8774](https://github.com/mapbox/mapbox-gl-native/pull/8774)
77

88
## 5.1.0-beta.1 - May 2, 2017
99

platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java

+14-16
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,8 @@
3535
*/
3636
public class MapboxMapOptions implements Parcelable {
3737

38-
private static final float DIMENSION_SEVEN_DP = 7f;
39-
private static final float DIMENSION_TEN_DP = 10f;
40-
private static final float DIMENSION_SIXTEEN_DP = 16f;
41-
private static final float DIMENSION_SEVENTY_SIX_DP = 76f;
38+
private static final float FOUR_DP = 4f;
39+
private static final float EIGHTY_NINE_DP = 92f;
4240

4341
private CameraPosition cameraPosition;
4442

@@ -206,13 +204,13 @@ public static MapboxMapOptions createFromAttributes(@NonNull Context context, @N
206204
Gravity.TOP | Gravity.END));
207205
mapboxMapOptions.compassMargins(new int[] {
208206
(int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiCompassMarginLeft,
209-
DIMENSION_TEN_DP * pxlRatio)),
207+
FOUR_DP * pxlRatio)),
210208
((int) typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiCompassMarginTop,
211-
DIMENSION_TEN_DP * pxlRatio)),
209+
FOUR_DP * pxlRatio)),
212210
((int) typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiCompassMarginRight,
213-
DIMENSION_TEN_DP * pxlRatio)),
211+
FOUR_DP * pxlRatio)),
214212
((int) typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiCompassMarginBottom,
215-
DIMENSION_TEN_DP * pxlRatio))});
213+
FOUR_DP * pxlRatio))});
216214
mapboxMapOptions.compassFadesWhenFacingNorth(typedArray.getBoolean(
217215
R.styleable.mapbox_MapView_mapbox_uiCompassFadeFacingNorth, true));
218216
Drawable compassDrawable = typedArray.getDrawable(
@@ -227,13 +225,13 @@ public static MapboxMapOptions createFromAttributes(@NonNull Context context, @N
227225
Gravity.BOTTOM | Gravity.START));
228226
mapboxMapOptions.logoMargins(new int[] {
229227
(int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiLogoMarginLeft,
230-
DIMENSION_SIXTEEN_DP * pxlRatio)),
228+
FOUR_DP * pxlRatio)),
231229
(int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiLogoMarginTop,
232-
DIMENSION_SIXTEEN_DP * pxlRatio)),
230+
FOUR_DP * pxlRatio)),
233231
(int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiLogoMarginRight,
234-
DIMENSION_SIXTEEN_DP * pxlRatio)),
232+
FOUR_DP * pxlRatio)),
235233
(int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiLogoMarginBottom,
236-
DIMENSION_SIXTEEN_DP * pxlRatio))});
234+
FOUR_DP * pxlRatio))});
237235

238236
mapboxMapOptions.attributionTintColor(typedArray.getColor(
239237
R.styleable.mapbox_MapView_mapbox_uiAttributionTintColor, -1));
@@ -243,13 +241,13 @@ public static MapboxMapOptions createFromAttributes(@NonNull Context context, @N
243241
R.styleable.mapbox_MapView_mapbox_uiAttributionGravity, Gravity.BOTTOM));
244242
mapboxMapOptions.attributionMargins(new int[] {
245243
(int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiAttributionMarginLeft,
246-
DIMENSION_SEVENTY_SIX_DP) * pxlRatio),
244+
EIGHTY_NINE_DP * pxlRatio)),
247245
(int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiAttributionMarginTop,
248-
DIMENSION_SEVEN_DP * pxlRatio)),
246+
FOUR_DP * pxlRatio)),
249247
(int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiAttributionMarginRight,
250-
DIMENSION_SEVEN_DP * pxlRatio)),
248+
FOUR_DP * pxlRatio)),
251249
(int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiAttributionMarginBottom,
252-
DIMENSION_SEVEN_DP * pxlRatio))});
250+
FOUR_DP * pxlRatio))});
253251

254252
mapboxMapOptions.locationEnabled(typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_myLocation, false));
255253
mapboxMapOptions.myLocationForegroundTintColor(

platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java

+7-16
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ private void initialiseCompass(MapboxMapOptions options, Resources resources) {
146146
if (compassMargins != null) {
147147
setCompassMargins(compassMargins[0], compassMargins[1], compassMargins[2], compassMargins[3]);
148148
} else {
149-
int tenDp = (int) resources.getDimension(R.dimen.mapbox_ten_dp);
149+
int tenDp = (int) resources.getDimension(R.dimen.mapbox_four_dp);
150150
setCompassMargins(tenDp, tenDp, tenDp, tenDp);
151151
}
152152
setCompassFadeFacingNorth(options.getCompassFadeFacingNorth());
@@ -171,9 +171,7 @@ private void saveCompass(Bundle outState) {
171171
private byte[] convert(Bitmap resource) {
172172
ByteArrayOutputStream stream = new ByteArrayOutputStream();
173173
resource.compress(Bitmap.CompressFormat.PNG, 100, stream);
174-
byte[] byteArray = stream.toByteArray();
175-
176-
return byteArray;
174+
return stream.toByteArray();
177175
}
178176

179177
private void restoreCompass(Bundle savedInstanceState) {
@@ -189,10 +187,7 @@ private void restoreCompass(Bundle savedInstanceState) {
189187

190188
private Drawable decode(byte[] bitmap) {
191189
Bitmap compass = BitmapFactory.decodeByteArray(bitmap, 0, bitmap.length);
192-
193-
Drawable compassImage = new BitmapDrawable(compassView.getResources(), compass);
194-
195-
return compassImage;
190+
return new BitmapDrawable(compassView.getResources(), compass);
196191
}
197192

198193
private void initialiseLogo(MapboxMapOptions options, Resources resources) {
@@ -202,8 +197,8 @@ private void initialiseLogo(MapboxMapOptions options, Resources resources) {
202197
if (logoMargins != null) {
203198
setLogoMargins(logoMargins[0], logoMargins[1], logoMargins[2], logoMargins[3]);
204199
} else {
205-
int sixteenDp = (int) resources.getDimension(R.dimen.mapbox_sixteen_dp);
206-
setLogoMargins(sixteenDp, sixteenDp, sixteenDp, sixteenDp);
200+
int twoDp = (int) resources.getDimension(R.dimen.mapbox_two_dp);
201+
setLogoMargins(twoDp, twoDp, twoDp, twoDp);
207202
}
208203
}
209204

@@ -226,16 +221,12 @@ private void restoreLogo(Bundle savedInstanceState) {
226221
}
227222

228223
private void initialiseAttribution(Context context, MapboxMapOptions options) {
229-
Resources resources = context.getResources();
230224
setAttributionEnabled(options.getAttributionEnabled());
231225
setAttributionGravity(options.getAttributionGravity());
232226
int[] attributionMargins = options.getAttributionMargins();
233227
if (attributionMargins != null) {
234-
setAttributionMargins(attributionMargins[0], attributionMargins[1], attributionMargins[2], attributionMargins[3]);
235-
} else {
236-
int sevenDp = (int) resources.getDimension(R.dimen.mapbox_seven_dp);
237-
int seventySixDp = (int) resources.getDimension(R.dimen.mapbox_seventy_six_dp);
238-
setAttributionMargins(seventySixDp, sevenDp, sevenDp, sevenDp);
228+
setAttributionMargins(attributionMargins[0], attributionMargins[1],
229+
attributionMargins[2], attributionMargins[3]);
239230
}
240231

241232
int attributionTintColor = options.getAttributionTintColor();
Loading
Loading
Loading
Loading
Loading

platform/android/MapboxGLAndroidSDK/src/main/res/drawable/mapbox_info_icon_default.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2-
android:width="24dp"
3-
android:height="24dp"
4-
android:viewportWidth="24.0"
5-
android:viewportHeight="24.0">
2+
android:width="21dp"
3+
android:height="21dp"
4+
android:viewportHeight="24.0"
5+
android:viewportWidth="24.0">
66
<path
77
android:fillColor="#FF1E8CAB"
88
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"/>
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2-
android:width="24dp"
3-
android:height="24dp"
4-
android:viewportHeight="24.0"
5-
android:viewportWidth="24.0">
2+
android:width="21dp"
3+
android:height="21dp"
4+
android:viewportHeight="24.0"
5+
android:viewportWidth="24.0">
66
<path
77
android:fillColor="#551E8CAB"
8-
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" />
8+
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"/>
99
</vector>

platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_mapview_internal.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,9 @@
3939
android:layout_width="wrap_content"
4040
android:layout_height="wrap_content"
4141
android:adjustViewBounds="true"
42-
android:background="@drawable/mapbox_default_bg_selector"
4342
android:clickable="true"
43+
android:focusable="true"
4444
android:contentDescription="@string/mapbox_attributionsIconContentDescription"
45-
android:padding="7dp"
4645
android:src="@drawable/mapbox_info_bg_selector"/>
4746

4847
</merge>
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,52 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
android:layout_width="match_parent"
4-
android:layout_height="match_parent"
5-
android:orientation="vertical">
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:orientation="vertical">
66

77
<ImageView
88
android:layout_width="match_parent"
99
android:layout_height="match_parent"
1010
android:scaleType="centerCrop"
11-
android:src="@drawable/mapbox_mapview_preview" />
11+
android:contentDescription="@null"
12+
android:src="@drawable/mapbox_mapview_preview"
13+
android:layout_alignParentTop="true"
14+
android:layout_alignParentLeft="true"
15+
android:layout_alignParentStart="true"/>
1216

1317
<ImageView
18+
android:id="@id/logoView"
1419
android:layout_width="wrap_content"
1520
android:layout_height="wrap_content"
1621
android:layout_alignParentBottom="true"
1722
android:layout_alignParentLeft="true"
18-
android:layout_marginBottom="@dimen/mapbox_eight_dp"
19-
android:layout_marginLeft="@dimen/mapbox_eight_dp"
23+
android:layout_alignParentStart="true"
24+
android:layout_marginBottom="@dimen/mapbox_four_dp"
25+
android:layout_marginLeft="@dimen/mapbox_four_dp"
26+
android:layout_marginStart="@dimen/mapbox_four_dp"
2027
android:contentDescription="@null"
2128
android:src="@drawable/mapbox_logo_icon"/>
2229

2330
<ImageView
2431
android:layout_width="wrap_content"
2532
android:layout_height="wrap_content"
2633
android:layout_alignParentBottom="true"
27-
android:layout_marginBottom="@dimen/mapbox_seven_dp"
28-
android:layout_marginLeft="@dimen/mapbox_seventy_six_dp"
34+
android:layout_toEndOf="@+id/logoView"
35+
android:contentDescription="@null"
36+
android:layout_marginBottom="@dimen/mapbox_four_dp"
2937
android:background="@drawable/mapbox_default_bg_selector"
30-
android:clickable="true"
31-
android:contentDescription="@string/mapbox_attributionsIconContentDescription"
32-
android:src="@drawable/mapbox_info_bg_selector" />
38+
android:src="@drawable/mapbox_info_bg_selector"
39+
android:layout_marginLeft="@dimen/mapbox_four_dp"
40+
android:layout_marginStart="@dimen/mapbox_four_dp"
41+
android:layout_toRightOf="@+id/logoView"/>
3342

3443
<ImageView
3544
android:layout_width="48dp"
3645
android:layout_height="48dp"
46+
android:layout_alignParentEnd="true"
3747
android:layout_alignParentRight="true"
3848
android:layout_margin="10dp"
39-
android:src="@drawable/mapbox_compass_icon" />
49+
android:contentDescription="@null"
50+
android:src="@drawable/mapbox_compass_icon"/>
4051

4152
</RelativeLayout>

platform/android/MapboxGLAndroidSDK/src/main/res/values/dimens.xml

+7-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@
44
<dimen name="mapbox_infowindow_margin">8dp</dimen>
55
<dimen name="mapbox_infowindow_offset">-2dp</dimen>
66
<dimen name="mapbox_infowindow_line_width">1.5dp</dimen>
7-
<dimen name="mapbox_seven_dp">7dp</dimen>
7+
<dimen name="mapbox_attribution_icon_left_padding">@dimen/mapbox_two_dp</dimen>
8+
<dimen name="mapbox_attribution_icon_top_padding">@dimen/mapbox_two_dp</dimen>
9+
<dimen name="mapbox_attribution_icon_right_padding">@dimen/mapbox_two_dp</dimen>
10+
<dimen name="mapbox_attribution_icon_bottom_padding">@dimen/mapbox_two_dp</dimen>
11+
<dimen name="mapbox_two_dp">2dp</dimen>
12+
<dimen name="mapbox_four_dp">4dp</dimen>
813
<dimen name="mapbox_eight_dp">8dp</dimen>
914
<dimen name="mapbox_ten_dp">10dp</dimen>
1015
<dimen name="mapbox_sixteen_dp">16dp</dimen>
11-
<dimen name="mapbox_seventy_six_dp">76dp</dimen>
16+
<dimen name="mapbox_ninety_five_dp">95dp</dimen>
1217
<dimen name="mapbox_my_locationview_outer_circle">18dp</dimen>
1318
</resources>

0 commit comments

Comments
 (0)