[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
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user