Prefix library resources to avoid naming conflicts (#6878)

* [android] - add library resource prefix

* update SDK resources with prefix

* fixup tests
This commit is contained in:
Tobrun
2016-11-02 12:41:22 +01:00
committed by GitHub
parent 9ad5dd1585
commit 4d0c42e36a
97 changed files with 397 additions and 400 deletions

View File

@@ -120,14 +120,14 @@ public final class IconFactory {
public Icon defaultMarker() {
if (mDefaultMarker == null) {
mDefaultMarker = fromResource(R.drawable.default_marker);
mDefaultMarker = fromResource(R.drawable.mapbox_marker_icon_default);
}
return mDefaultMarker;
}
public Icon defaultMarkerView() {
if (mDefaultMarkerView == null) {
mDefaultMarkerView = fromResource(R.drawable.default_markerview);
mDefaultMarkerView = fromResource(R.drawable.mapbox_markerview_icon_default);
}
return mDefaultMarkerView;
}

View File

@@ -129,8 +129,8 @@ public class InfoWindow {
final float mapRight = mapView.getRight();
final float mapLeft = mapView.getLeft();
float marginHorizontal = resources.getDimension(R.dimen.infowindow_margin);
float tipViewOffset = resources.getDimension(R.dimen.infowindow_tipview_width) / 2;
float marginHorizontal = resources.getDimension(R.dimen.mapbox_infowindow_margin);
float tipViewOffset = resources.getDimension(R.dimen.mapbox_infowindow_tipview_width) / 2;
float tipViewMarginLeft = view.getMeasuredWidth() / 2 - tipViewOffset;
boolean outOfBoundsLeft = false;

View File

@@ -20,7 +20,7 @@ final class InfoWindowTipView extends View {
super(context, attrs);
mPath = new Path();
mLineWidth = (int) context.getResources().getDimension(R.dimen.infowindow_line_width);
mLineWidth = (int) context.getResources().getDimension(R.dimen.mapbox_infowindow_line_width);
mPaint = new Paint();
mPaint.setColor(Color.WHITE);
mPaint.setAntiAlias(true);

View File

@@ -25,7 +25,7 @@ class InfoWindowView extends RelativeLayout {
}
private void initialize(Context context) {
LayoutInflater.from(context).inflate(R.layout.infowindow_content, this);
LayoutInflater.from(context).inflate(R.layout.mapbox_infowindow_content, this);
mTipView = (InfoWindowTipView) findViewById(R.id.infowindow_tipview);
}
@@ -33,6 +33,6 @@ class InfoWindowView extends RelativeLayout {
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mTipView.getLayoutParams();
layoutParams.leftMargin = marginLeft;
// This is a bit of a hack but prevents an occasional gap between the InfoWindow
layoutParams.topMargin = (int) getResources().getDimension(R.dimen.infowindow_offset);
layoutParams.topMargin = (int) getResources().getDimension(R.dimen.mapbox_infowindow_offset);
}
}

View File

@@ -185,7 +185,7 @@ public class Marker extends Annotation {
private InfoWindow getInfoWindow(@NonNull MapView mapView) {
if (infoWindow == null && mapView.getContext() != null) {
infoWindow = new InfoWindow(mapView, R.layout.infowindow_view, getMapboxMap());
infoWindow = new InfoWindow(mapView, R.layout.mapbox_infowindow_view, getMapboxMap());
}
return infoWindow;
}

View File

@@ -538,7 +538,7 @@ public class MarkerViewManager {
ViewHolder viewHolder;
if (convertView == null) {
viewHolder = new ViewHolder();
convertView = inflater.inflate(R.layout.view_image_marker, parent, false);
convertView = inflater.inflate(R.layout.mapbox_view_image_marker, parent, false);
viewHolder.imageView = (ImageView) convertView.findViewById(R.id.image);
convertView.setTag(viewHolder);
} else {

View File

@@ -154,12 +154,12 @@ public final class CameraPosition implements Parcelable {
public Builder(TypedArray typedArray) {
super();
if (typedArray != null) {
this.bearing = typedArray.getFloat(R.styleable.MapView_direction, 0.0f);
double lat = typedArray.getFloat(R.styleable.MapView_center_latitude, 0.0f);
double lng = typedArray.getFloat(R.styleable.MapView_center_longitude, 0.0f);
this.bearing = typedArray.getFloat(R.styleable.mapbox_MapView_mapbox_direction, 0.0f);
double lat = typedArray.getFloat(R.styleable.mapbox_MapView_mapbox_center_latitude, 0.0f);
double lng = typedArray.getFloat(R.styleable.mapbox_MapView_mapbox_center_longitude, 0.0f);
this.target = new LatLng(lat, lng);
this.tilt = typedArray.getFloat(R.styleable.MapView_tilt, 0.0f);
this.zoom = typedArray.getFloat(R.styleable.MapView_zoom, 0.0f);
this.tilt = typedArray.getFloat(R.styleable.mapbox_MapView_mapbox_tilt, 0.0f);
this.zoom = typedArray.getFloat(R.styleable.mapbox_MapView_mapbox_zoom, 0.0f);
}
}

View File

@@ -94,16 +94,16 @@ public final class MapFragment extends Fragment {
Drawable foregroundBearingDrawable = options.getMyLocationForegroundBearingDrawable();
if (foregroundDrawable == null || foregroundBearingDrawable == null) {
if (foregroundDrawable == null) {
foregroundDrawable = ContextCompat.getDrawable(context, R.drawable.ic_mylocationview_normal);
foregroundDrawable = ContextCompat.getDrawable(context, R.drawable.mapbox_mylocationview_icon_default);
}
if (foregroundBearingDrawable == null) {
foregroundBearingDrawable = ContextCompat.getDrawable(context, R.drawable.ic_mylocationview_bearing);
foregroundBearingDrawable = ContextCompat.getDrawable(context, R.drawable.mapbox_mylocationview_icon_bearing);
}
options.myLocationForegroundDrawables(foregroundDrawable, foregroundBearingDrawable);
}
if (options.getMyLocationBackgroundDrawable() == null) {
options.myLocationBackgroundDrawable(ContextCompat.getDrawable(context, R.drawable.ic_mylocationview_background));
options.myLocationBackgroundDrawable(ContextCompat.getDrawable(context, R.drawable.mapbox_mylocationview_bg_shape));
}
return map = new MapView(inflater.getContext(), options);

View File

@@ -190,7 +190,7 @@ public class MapView extends FrameLayout {
private void initialize(@NonNull Context context, @NonNull MapboxMapOptions options) {
if (isInEditMode()) {
// if we are in an editor mode we show an image of a map
LayoutInflater.from(context).inflate(R.layout.mapview_preview, this);
LayoutInflater.from(context).inflate(R.layout.mapbox_mapview_preview, this);
return;
}
@@ -201,7 +201,7 @@ public class MapView extends FrameLayout {
projection = mapboxMap.getProjection();
icons = new ArrayList<>();
View view = LayoutInflater.from(context).inflate(R.layout.mapview_internal, this);
View view = LayoutInflater.from(context).inflate(R.layout.mapbox_mapview_internal, this);
setWillNotDraw(false);
if (options.getTextureMode()) {
@@ -329,7 +329,7 @@ public class MapView extends FrameLayout {
if (compassMargins != null) {
uiSettings.setCompassMargins(compassMargins[0], compassMargins[1], compassMargins[2], compassMargins[3]);
} else {
int tenDp = (int) getResources().getDimension(R.dimen.ten_dp);
int tenDp = (int) getResources().getDimension(R.dimen.mapbox_ten_dp);
uiSettings.setCompassMargins(tenDp, tenDp, tenDp, tenDp);
}
uiSettings.setCompassFadeFacingNorth(options.getCompassFadeFacingNorth());
@@ -341,7 +341,7 @@ public class MapView extends FrameLayout {
if (logoMargins != null) {
uiSettings.setLogoMargins(logoMargins[0], logoMargins[1], logoMargins[2], logoMargins[3]);
} else {
int sixteenDp = (int) getResources().getDimension(R.dimen.sixteen_dp);
int sixteenDp = (int) getResources().getDimension(R.dimen.mapbox_sixteen_dp);
uiSettings.setLogoMargins(sixteenDp, sixteenDp, sixteenDp, sixteenDp);
}
@@ -353,8 +353,8 @@ public class MapView extends FrameLayout {
uiSettings.setAttributionMargins(attributionMargins[0], attributionMargins[1], attributionMargins[2], attributionMargins[3]);
} else {
Resources resources = getResources();
int sevenDp = (int) resources.getDimension(R.dimen.seven_dp);
int seventySixDp = (int) resources.getDimension(R.dimen.seventy_six_dp);
int sevenDp = (int) resources.getDimension(R.dimen.mapbox_seven_dp);
int seventySixDp = (int) resources.getDimension(R.dimen.mapbox_seventy_six_dp);
uiSettings.setAttributionMargins(seventySixDp, sevenDp, sevenDp, sevenDp);
}
@@ -2930,10 +2930,10 @@ public class MapView extends FrameLayout {
@Override
public void onClick(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(mapView.getContext(), R.style.TelemAlertDialogStyle);
builder.setTitle(R.string.attributionsDialogTitle);
String[] items = mapView.getContext().getResources().getStringArray(R.array.attribution_names);
builder.setAdapter(new ArrayAdapter<>(mapView.getContext(), R.layout.attribution_list_item, items), this);
AlertDialog.Builder builder = new AlertDialog.Builder(mapView.getContext(), R.style.mapbox_AlertDialogStyle);
builder.setTitle(R.string.mapbox_attributionsDialogTitle);
String[] items = mapView.getContext().getResources().getStringArray(R.array.mapbox_attribution_names);
builder.setAdapter(new ArrayAdapter<>(mapView.getContext(), R.layout.mapbox_attribution_list_item, items), this);
AlertDialog attributionDialog = builder.show();
// TODO Change listview text color to mapView.getAttributionTintColor()
@@ -2944,27 +2944,27 @@ public class MapView extends FrameLayout {
public void onClick(DialogInterface dialog, int which) {
final Context context = ((Dialog) dialog).getContext();
if (which == ATTRIBUTION_INDEX_TELEMETRY_SETTINGS) {
AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.TelemAlertDialogStyle);
builder.setTitle(R.string.attributionTelemetryTitle);
builder.setMessage(R.string.attributionTelemetryMessage);
builder.setPositiveButton(R.string.attributionTelemetryPositive, new DialogInterface.OnClickListener() {
AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.mapbox_AlertDialogStyle);
builder.setTitle(R.string.mapbox_attributionTelemetryTitle);
builder.setMessage(R.string.mapbox_attributionTelemetryMessage);
builder.setPositiveButton(R.string.mapbox_attributionTelemetryPositive, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
MapboxEventManager.getMapboxEventManager().setTelemetryEnabled(true);
dialog.cancel();
}
});
builder.setNeutralButton(R.string.attributionTelemetryNeutral, new DialogInterface.OnClickListener() {
builder.setNeutralButton(R.string.mapbox_attributionTelemetryNeutral, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String url = context.getResources().getStringArray(R.array.attribution_links)[3];
String url = context.getResources().getStringArray(R.array.mapbox_attribution_links)[3];
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
context.startActivity(intent);
dialog.cancel();
}
});
builder.setNegativeButton(R.string.attributionTelemetryNegative, new DialogInterface.OnClickListener() {
builder.setNegativeButton(R.string.mapbox_attributionTelemetryNegative, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
MapboxEventManager.getMapboxEventManager().setTelemetryEnabled(false);
@@ -2978,7 +2978,7 @@ public class MapView extends FrameLayout {
telemDialog.getButton(AlertDialog.BUTTON_NEUTRAL).setTextColor(mapView.getAttributionTintColor());
return;
}
String url = context.getResources().getStringArray(R.array.attribution_links)[which];
String url = context.getResources().getStringArray(R.array.mapbox_attribution_links)[which];
if (which == ATTRIBUTION_INDEX_IMPROVE_THIS_MAP) {
LatLng latLng = mapView.getMapboxMap().getCameraPosition().target;
url = String.format(url, latLng.getLongitude(), latLng.getLatitude(), (int) mapView.getZoom());

View File

@@ -170,76 +170,76 @@ public class MapboxMapOptions implements Parcelable {
public static MapboxMapOptions createFromAttributes(@NonNull Context context, @Nullable AttributeSet attrs) {
MapboxMapOptions mapboxMapOptions = new MapboxMapOptions();
float screenDensity = context.getResources().getDisplayMetrics().density;
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.MapView, 0, 0);
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.mapbox_MapView, 0, 0);
try {
mapboxMapOptions.debugActive(typedArray.getBoolean(R.styleable.MapView_debug_active, false));
mapboxMapOptions.debugActive(typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_debug_active, false));
mapboxMapOptions.camera(new CameraPosition.Builder(typedArray).build());
mapboxMapOptions.accessToken(typedArray.getString(R.styleable.MapView_access_token));
mapboxMapOptions.styleUrl(typedArray.getString(R.styleable.MapView_style_url));
mapboxMapOptions.apiBaseUrl(typedArray.getString(R.styleable.MapView_api_base_url));
mapboxMapOptions.accessToken(typedArray.getString(R.styleable.mapbox_MapView_mapbox_access_token));
mapboxMapOptions.styleUrl(typedArray.getString(R.styleable.mapbox_MapView_mapbox_style_url));
mapboxMapOptions.apiBaseUrl(typedArray.getString(R.styleable.mapbox_MapView_mapbox_api_base_url));
mapboxMapOptions.zoomGesturesEnabled(typedArray.getBoolean(R.styleable.MapView_zoom_enabled, true));
mapboxMapOptions.scrollGesturesEnabled(typedArray.getBoolean(R.styleable.MapView_scroll_enabled, true));
mapboxMapOptions.rotateGesturesEnabled(typedArray.getBoolean(R.styleable.MapView_rotate_enabled, true));
mapboxMapOptions.tiltGesturesEnabled(typedArray.getBoolean(R.styleable.MapView_tilt_enabled, true));
mapboxMapOptions.zoomControlsEnabled(typedArray.getBoolean(R.styleable.MapView_zoom_controls_enabled, false));
mapboxMapOptions.zoomGesturesEnabled(typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_zoom_enabled, true));
mapboxMapOptions.scrollGesturesEnabled(typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_scroll_enabled, true));
mapboxMapOptions.rotateGesturesEnabled(typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_rotate_enabled, true));
mapboxMapOptions.tiltGesturesEnabled(typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_tilt_enabled, true));
mapboxMapOptions.zoomControlsEnabled(typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_zoom_controls_enabled, false));
mapboxMapOptions.maxZoom(typedArray.getFloat(R.styleable.MapView_zoom_max, MapboxConstants.MAXIMUM_ZOOM));
mapboxMapOptions.minZoom(typedArray.getFloat(R.styleable.MapView_zoom_min, MapboxConstants.MINIMUM_ZOOM));
mapboxMapOptions.maxZoom(typedArray.getFloat(R.styleable.mapbox_MapView_mapbox_zoom_max, MapboxConstants.MAXIMUM_ZOOM));
mapboxMapOptions.minZoom(typedArray.getFloat(R.styleable.mapbox_MapView_mapbox_zoom_min, MapboxConstants.MINIMUM_ZOOM));
mapboxMapOptions.compassEnabled(typedArray.getBoolean(R.styleable.MapView_compass_enabled, true));
mapboxMapOptions.compassGravity(typedArray.getInt(R.styleable.MapView_compass_gravity, Gravity.TOP | Gravity.END));
mapboxMapOptions.compassMargins(new int[]{(int) (typedArray.getDimension(R.styleable.MapView_compass_margin_left, DIMENSION_TEN_DP) * screenDensity)
, ((int) typedArray.getDimension(R.styleable.MapView_compass_margin_top, DIMENSION_TEN_DP * screenDensity))
, ((int) typedArray.getDimension(R.styleable.MapView_compass_margin_right, DIMENSION_TEN_DP * screenDensity))
, ((int) typedArray.getDimension(R.styleable.MapView_compass_margin_bottom, DIMENSION_TEN_DP * screenDensity))});
mapboxMapOptions.compassFadesWhenFacingNorth(typedArray.getBoolean(R.styleable.MapView_compass_fade_facing_north, true));
mapboxMapOptions.compassEnabled(typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_compass_enabled, true));
mapboxMapOptions.compassGravity(typedArray.getInt(R.styleable.mapbox_MapView_mapbox_compass_gravity, Gravity.TOP | Gravity.END));
mapboxMapOptions.compassMargins(new int[]{(int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_compass_margin_left, DIMENSION_TEN_DP) * screenDensity)
, ((int) typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_compass_margin_top, DIMENSION_TEN_DP * screenDensity))
, ((int) typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_compass_margin_right, DIMENSION_TEN_DP * screenDensity))
, ((int) typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_compass_margin_bottom, DIMENSION_TEN_DP * screenDensity))});
mapboxMapOptions.compassFadesWhenFacingNorth(typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_compass_fade_facing_north, true));
mapboxMapOptions.logoEnabled(typedArray.getBoolean(R.styleable.MapView_logo_enabled, true));
mapboxMapOptions.logoGravity(typedArray.getInt(R.styleable.MapView_logo_gravity, Gravity.BOTTOM | Gravity.START));
mapboxMapOptions.logoMargins(new int[]{(int) (typedArray.getDimension(R.styleable.MapView_logo_margin_left, DIMENSION_SIXTEEN_DP) * screenDensity)
, (int) (typedArray.getDimension(R.styleable.MapView_logo_margin_top, DIMENSION_SIXTEEN_DP) * screenDensity)
, (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.logoEnabled(typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_logo_enabled, true));
mapboxMapOptions.logoGravity(typedArray.getInt(R.styleable.mapbox_MapView_mapbox_logo_gravity, Gravity.BOTTOM | Gravity.START));
mapboxMapOptions.logoMargins(new int[]{(int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_logo_margin_left, DIMENSION_SIXTEEN_DP) * screenDensity)
, (int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_logo_margin_top, DIMENSION_SIXTEEN_DP) * screenDensity)
, (int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_logo_margin_right, DIMENSION_SIXTEEN_DP) * screenDensity)
, (int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_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)
, (int) (typedArray.getDimension(R.styleable.MapView_attribution_margin_top, DIMENSION_SEVEN_DP) * screenDensity)
, (int) (typedArray.getDimension(R.styleable.MapView_attribution_margin_right, DIMENSION_SEVEN_DP) * screenDensity)
, (int) (typedArray.getDimension(R.styleable.MapView_attribution_margin_bottom, DIMENSION_SEVEN_DP) * screenDensity)});
mapboxMapOptions.attributionTintColor(typedArray.getColor(R.styleable.mapbox_MapView_mapbox_attribution_tint, -1));
mapboxMapOptions.attributionEnabled(typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_attribution_enabled, true));
mapboxMapOptions.attributionGravity(typedArray.getInt(R.styleable.mapbox_MapView_mapbox_attribution_gravity, Gravity.BOTTOM));
mapboxMapOptions.attributionMargins(new int[]{(int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_attribution_margin_left, DIMENSION_SEVENTY_SIX_DP) * screenDensity)
, (int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_attribution_margin_top, DIMENSION_SEVEN_DP) * screenDensity)
, (int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_attribution_margin_right, DIMENSION_SEVEN_DP) * screenDensity)
, (int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_attribution_margin_bottom, DIMENSION_SEVEN_DP) * screenDensity)});
mapboxMapOptions.locationEnabled(typedArray.getBoolean(R.styleable.MapView_my_location_enabled, false));
mapboxMapOptions.myLocationForegroundTintColor(typedArray.getColor(R.styleable.MapView_my_location_foreground_tint, Color.TRANSPARENT));
mapboxMapOptions.myLocationBackgroundTintColor(typedArray.getColor(R.styleable.MapView_my_location_background_tint, Color.TRANSPARENT));
mapboxMapOptions.locationEnabled(typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_my_location_enabled, false));
mapboxMapOptions.myLocationForegroundTintColor(typedArray.getColor(R.styleable.mapbox_MapView_mapbox_my_location_foreground_tint, Color.TRANSPARENT));
mapboxMapOptions.myLocationBackgroundTintColor(typedArray.getColor(R.styleable.mapbox_MapView_mapbox_my_location_background_tint, Color.TRANSPARENT));
Drawable foregroundDrawable = typedArray.getDrawable(R.styleable.MapView_my_location_foreground);
Drawable foregroundDrawable = typedArray.getDrawable(R.styleable.mapbox_MapView_mapbox_my_location_foreground);
if (foregroundDrawable == null) {
foregroundDrawable = ContextCompat.getDrawable(context, R.drawable.ic_mylocationview_normal);
foregroundDrawable = ContextCompat.getDrawable(context, R.drawable.mapbox_mylocationview_icon_default);
}
Drawable foregroundBearingDrawable = typedArray.getDrawable(R.styleable.MapView_my_location_foreground_bearing);
Drawable foregroundBearingDrawable = typedArray.getDrawable(R.styleable.mapbox_MapView_mapbox_my_location_foreground_bearing);
if (foregroundBearingDrawable == null) {
foregroundBearingDrawable = ContextCompat.getDrawable(context, R.drawable.ic_mylocationview_bearing);
foregroundBearingDrawable = ContextCompat.getDrawable(context, R.drawable.mapbox_mylocationview_icon_bearing);
}
Drawable backgroundDrawable = typedArray.getDrawable(R.styleable.MapView_my_location_background);
Drawable backgroundDrawable = typedArray.getDrawable(R.styleable.mapbox_MapView_mapbox_my_location_background);
if (backgroundDrawable == null) {
backgroundDrawable = ContextCompat.getDrawable(context, R.drawable.ic_mylocationview_background);
backgroundDrawable = ContextCompat.getDrawable(context, R.drawable.mapbox_mylocationview_bg_shape);
}
mapboxMapOptions.myLocationForegroundDrawables(foregroundDrawable, foregroundBearingDrawable);
mapboxMapOptions.myLocationBackgroundDrawable(backgroundDrawable);
mapboxMapOptions.myLocationBackgroundPadding(new int[]{(int) (typedArray.getDimension(R.styleable.MapView_my_location_background_left, 0) * screenDensity)
, (int) (typedArray.getDimension(R.styleable.MapView_my_location_background_top, 0) * screenDensity)
, (int) (typedArray.getDimension(R.styleable.MapView_my_location_background_right, 0) * screenDensity)
, (int) (typedArray.getDimension(R.styleable.MapView_my_location_background_bottom, 0) * screenDensity)});
mapboxMapOptions.myLocationAccuracyAlpha(typedArray.getInt(R.styleable.MapView_my_location_accuracy_alpha, 100));
mapboxMapOptions.myLocationAccuracyTint(typedArray.getColor(R.styleable.MapView_my_location_accuracy_tint, ColorUtils.getPrimaryColor(context)));
mapboxMapOptions.textureMode(typedArray.getBoolean(R.styleable.MapView_texture_mode, false));
mapboxMapOptions.myLocationBackgroundPadding(new int[]{(int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_my_location_background_left, 0) * screenDensity)
, (int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_my_location_background_top, 0) * screenDensity)
, (int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_my_location_background_right, 0) * screenDensity)
, (int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_my_location_background_bottom, 0) * screenDensity)});
mapboxMapOptions.myLocationAccuracyAlpha(typedArray.getInt(R.styleable.mapbox_MapView_mapbox_my_location_accuracy_alpha, 100));
mapboxMapOptions.myLocationAccuracyTint(typedArray.getColor(R.styleable.mapbox_MapView_mapbox_my_location_accuracy_tint, ColorUtils.getPrimaryColor(context)));
mapboxMapOptions.textureMode(typedArray.getBoolean(R.styleable.mapbox_MapView_mapbox_texture_mode, false));
} finally {
typedArray.recycle();
}
@@ -329,9 +329,9 @@ public class MapboxMapOptions implements Parcelable {
}
/**
* Specifies the visibility state of a compass for a map view.
* Specifies the visibility state of a mapbox_compass_icon for a map view.
*
* @param enabled True and compass is shown
* @param enabled True and mapbox_compass_icon is shown
* @return This
*/
public MapboxMapOptions compassEnabled(boolean enabled) {
@@ -340,7 +340,7 @@ public class MapboxMapOptions implements Parcelable {
}
/**
* Specifies the gravity state of compass for a map view.
* Specifies the gravity state of mapbox_compass_icon for a map view.
*
* @param gravity see {@link android.view.Gravity}
* @return This
@@ -351,7 +351,7 @@ public class MapboxMapOptions implements Parcelable {
}
/**
* Specifies the margin state of compass for a map view
* Specifies the margin state of mapbox_compass_icon for a map view
*
* @param margins 4 long array for LTRB margins
* @return This
@@ -362,12 +362,12 @@ public class MapboxMapOptions implements Parcelable {
}
/**
* Specifies if the compass fades to invisible when facing north.
* Specifies if the mapbox_compass_icon fades to invisible when facing north.
* <p>
* By default this value is true.
* </p>
*
* @param compassFadeWhenFacingNorth true is compass fades to invisble
* @param compassFadeWhenFacingNorth true is mapbox_compass_icon fades to invisble
* @return This
*/
public MapboxMapOptions compassFadesWhenFacingNorth(boolean compassFadeWhenFacingNorth) {
@@ -670,45 +670,45 @@ public class MapboxMapOptions implements Parcelable {
}
/**
* Get the current configured visibility state for compass for a map view.
* Get the current configured visibility state for mapbox_compass_icon for a map view.
*
* @return Visibility state of the compass
* @return Visibility state of the mapbox_compass_icon
*/
public boolean getCompassEnabled() {
return compassEnabled;
}
/**
* Get the current configured gravity state for compass for a map view.
* Get the current configured gravity state for mapbox_compass_icon for a map view.
*
* @return Gravity state of the compass
* @return Gravity state of the mapbox_compass_icon
*/
public int getCompassGravity() {
return compassGravity;
}
/**
* Get the current configured margins for compass for a map view.
* Get the current configured margins for mapbox_compass_icon for a map view.
*
* @return Margins state of the compass
* @return Margins state of the mapbox_compass_icon
*/
public int[] getCompassMargins() {
return compassMargins;
}
/**
* Get the current configured state for fading the compass when facing north.
* Get the current configured state for fading the mapbox_compass_icon when facing north.
*
* @return True if compass fades to invisible when facing north
* @return True if mapbox_compass_icon fades to invisible when facing north
*/
public boolean getCompassFadeFacingNorth() {
return fadeCompassFacingNorth;
}
/**
* Get the current configured visibility state for compass for a map view.
* Get the current configured visibility state for mapbox_compass_icon for a map view.
*
* @return Visibility state of the compass
* @return Visibility state of the mapbox_compass_icon
*/
public boolean getLogoEnabled() {
return logoEnabled;

View File

@@ -103,16 +103,16 @@ public class SupportMapFragment extends Fragment {
Drawable foregroundBearingDrawable = options.getMyLocationForegroundBearingDrawable();
if (foregroundDrawable == null || foregroundBearingDrawable == null) {
if (foregroundDrawable == null) {
foregroundDrawable = ContextCompat.getDrawable(context, R.drawable.ic_mylocationview_normal);
foregroundDrawable = ContextCompat.getDrawable(context, R.drawable.mapbox_mylocationview_icon_default);
}
if (foregroundBearingDrawable == null) {
foregroundBearingDrawable = ContextCompat.getDrawable(context, R.drawable.ic_mylocationview_bearing);
foregroundBearingDrawable = ContextCompat.getDrawable(context, R.drawable.mapbox_mylocationview_icon_bearing);
}
options.myLocationForegroundDrawables(foregroundDrawable, foregroundBearingDrawable);
}
if (options.getMyLocationBackgroundDrawable() == null) {
options.myLocationBackgroundDrawable(ContextCompat.getDrawable(context, R.drawable.ic_mylocationview_background));
options.myLocationBackgroundDrawable(ContextCompat.getDrawable(context, R.drawable.mapbox_mylocationview_bg_shape));
}
return map = new MapView(inflater.getContext(), options);

View File

@@ -51,8 +51,8 @@ public final class CompassView extends ImageView implements Runnable {
}
private void initialize(Context context) {
setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.compass));
setContentDescription(getResources().getString(R.string.compassContentDescription));
setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.mapbox_compass_icon));
setContentDescription(getResources().getString(R.string.mapbox_compassContentDescription));
setEnabled(false);
// Layout params