Replace mapboxMap with maplibreMap (#2314)
This commit is contained in:
@@ -70,18 +70,18 @@ public abstract class Annotation implements Comparable<Annotation> {
|
||||
/**
|
||||
* Do not use this method, used internally by the SDK.
|
||||
*
|
||||
* @param maplibreMap the hosting mapbox map
|
||||
* @param maplibreMap the hosting MapLibreMap
|
||||
*/
|
||||
public void setMapboxMap(MapLibreMap maplibreMap) {
|
||||
public void setMapLibreMap(MapLibreMap maplibreMap) {
|
||||
this.maplibreMap = maplibreMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hosting mapbox map.
|
||||
* Gets the hosting MapLibreMap.
|
||||
*
|
||||
* @return the MapboxMap
|
||||
* @return the MapLibreMap
|
||||
*/
|
||||
protected MapLibreMap getMapboxMap() {
|
||||
protected MapLibreMap getMapLibreMap() {
|
||||
return maplibreMap;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ import java.lang.ref.WeakReference;
|
||||
public class InfoWindow {
|
||||
|
||||
private WeakReference<Marker> boundMarker;
|
||||
private WeakReference<MapLibreMap> mapboxMap;
|
||||
private WeakReference<MapLibreMap> maplibreMap;
|
||||
protected WeakReference<View> view;
|
||||
|
||||
private float markerHeightOffset;
|
||||
@@ -64,14 +64,14 @@ public class InfoWindow {
|
||||
}
|
||||
|
||||
private void initialize(@NonNull View view, MapLibreMap maplibreMap) {
|
||||
this.mapboxMap = new WeakReference<>(maplibreMap);
|
||||
this.maplibreMap = new WeakReference<>(maplibreMap);
|
||||
isVisible = false;
|
||||
this.view = new WeakReference<>(view);
|
||||
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MapLibreMap maplibreMap = InfoWindow.this.mapboxMap.get();
|
||||
MapLibreMap maplibreMap = InfoWindow.this.maplibreMap.get();
|
||||
if (maplibreMap != null) {
|
||||
MapLibreMap.OnInfoWindowClickListener onInfoWindowClickListener = maplibreMap.getOnInfoWindowClickListener();
|
||||
boolean handledDefaultClick = false;
|
||||
@@ -90,7 +90,7 @@ public class InfoWindow {
|
||||
view.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
MapLibreMap maplibreMap = InfoWindow.this.mapboxMap.get();
|
||||
MapLibreMap maplibreMap = InfoWindow.this.maplibreMap.get();
|
||||
if (maplibreMap != null) {
|
||||
MapLibreMap.OnInfoWindowLongClickListener listener = maplibreMap.getOnInfoWindowLongClickListener();
|
||||
if (listener != null) {
|
||||
@@ -103,7 +103,7 @@ public class InfoWindow {
|
||||
}
|
||||
|
||||
private void closeInfoWindow() {
|
||||
MapLibreMap mapbox = mapboxMap.get();
|
||||
MapLibreMap mapbox = maplibreMap.get();
|
||||
Marker marker = boundMarker.get();
|
||||
if (marker != null && mapbox != null) {
|
||||
mapbox.deselectMarker(marker);
|
||||
@@ -129,7 +129,7 @@ public class InfoWindow {
|
||||
MapView.LayoutParams lp = new MapView.LayoutParams(MapView.LayoutParams.WRAP_CONTENT,
|
||||
MapView.LayoutParams.WRAP_CONTENT);
|
||||
|
||||
MapLibreMap maplibreMap = this.mapboxMap.get();
|
||||
MapLibreMap maplibreMap = this.maplibreMap.get();
|
||||
View view = this.view.get();
|
||||
if (view != null && maplibreMap != null) {
|
||||
view.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
|
||||
@@ -222,7 +222,7 @@ public class InfoWindow {
|
||||
*/
|
||||
@NonNull
|
||||
InfoWindow close() {
|
||||
MapLibreMap maplibreMap = this.mapboxMap.get();
|
||||
MapLibreMap maplibreMap = this.maplibreMap.get();
|
||||
if (isVisible && maplibreMap != null) {
|
||||
isVisible = false;
|
||||
View view = this.view.get();
|
||||
@@ -253,7 +253,7 @@ public class InfoWindow {
|
||||
view = LayoutInflater.from(mapView.getContext()).inflate(layoutRes, mapView, false);
|
||||
initialize(view, maplibreMap);
|
||||
}
|
||||
this.mapboxMap = new WeakReference<>(maplibreMap);
|
||||
this.maplibreMap = new WeakReference<>(maplibreMap);
|
||||
String title = overlayItem.getTitle();
|
||||
TextView titleTextView = ((TextView) view.findViewById(R.id.infowindow_title));
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
@@ -291,7 +291,7 @@ public class InfoWindow {
|
||||
* Will result in getting this {@link InfoWindow} and updating the view being displayed.
|
||||
*/
|
||||
public void update() {
|
||||
MapLibreMap maplibreMap = this.mapboxMap.get();
|
||||
MapLibreMap maplibreMap = this.maplibreMap.get();
|
||||
Marker marker = boundMarker.get();
|
||||
View view = this.view.get();
|
||||
if (maplibreMap != null && marker != null && view != null) {
|
||||
|
||||
@@ -123,7 +123,7 @@ public class Marker extends Annotation {
|
||||
*/
|
||||
public void setPosition(LatLng position) {
|
||||
this.position = position;
|
||||
MapLibreMap map = getMapboxMap();
|
||||
MapLibreMap map = getMapLibreMap();
|
||||
if (map != null) {
|
||||
map.updateMarker(this);
|
||||
}
|
||||
@@ -148,7 +148,7 @@ public class Marker extends Annotation {
|
||||
public void setIcon(@Nullable Icon icon) {
|
||||
this.icon = icon;
|
||||
this.iconId = icon != null ? icon.getId() : null;
|
||||
MapLibreMap map = getMapboxMap();
|
||||
MapLibreMap map = getMapLibreMap();
|
||||
if (map != null) {
|
||||
map.updateMarker(this);
|
||||
}
|
||||
@@ -196,7 +196,7 @@ public class Marker extends Annotation {
|
||||
if (mapView.getContext() != null) {
|
||||
infoWindow.adaptDefaultMarker(this, maplibreMap, mapView);
|
||||
}
|
||||
MapLibreMap map = getMapboxMap();
|
||||
MapLibreMap map = getMapLibreMap();
|
||||
if (map != null) {
|
||||
map.updateMarker(this);
|
||||
}
|
||||
@@ -208,15 +208,15 @@ public class Marker extends Annotation {
|
||||
* Do not use this method, used internally by the SDK. Use {@link MapLibreMap#selectMarker(Marker)}
|
||||
* if you want to programmatically display the markers info window.
|
||||
*
|
||||
* @param maplibreMap The hosting mapbox map.
|
||||
* @param maplibreMap The hosting MapLibreMap.
|
||||
* @param mapView The hosting map view.
|
||||
* @return The info window that was shown.
|
||||
*/
|
||||
@Nullable
|
||||
public InfoWindow showInfoWindow(@NonNull MapLibreMap maplibreMap, @NonNull MapView mapView) {
|
||||
setMapboxMap(maplibreMap);
|
||||
setMapLibreMap(maplibreMap);
|
||||
setMapView(mapView);
|
||||
MapLibreMap.InfoWindowAdapter infoWindowAdapter = getMapboxMap().getInfoWindowAdapter();
|
||||
MapLibreMap.InfoWindowAdapter infoWindowAdapter = getMapLibreMap().getInfoWindowAdapter();
|
||||
if (infoWindowAdapter != null) {
|
||||
// end developer is using a custom InfoWindowAdapter
|
||||
View content = infoWindowAdapter.getInfoWindow(this);
|
||||
@@ -244,7 +244,7 @@ public class Marker extends Annotation {
|
||||
@Nullable
|
||||
private InfoWindow getInfoWindow(@NonNull MapView mapView) {
|
||||
if (infoWindow == null && mapView.getContext() != null) {
|
||||
infoWindow = new InfoWindow(mapView, R.layout.maplibre_infowindow_content, getMapboxMap());
|
||||
infoWindow = new InfoWindow(mapView, R.layout.maplibre_infowindow_content, getMapLibreMap());
|
||||
}
|
||||
return infoWindow;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public final class Polygon extends BasePointCollection {
|
||||
|
||||
@Override
|
||||
void update() {
|
||||
MapLibreMap maplibreMap = getMapboxMap();
|
||||
MapLibreMap maplibreMap = getMapLibreMap();
|
||||
if (maplibreMap != null) {
|
||||
maplibreMap.updatePolygon(this);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public final class Polyline extends BasePointCollection {
|
||||
|
||||
@Override
|
||||
void update() {
|
||||
MapLibreMap maplibreMap = getMapboxMap();
|
||||
MapLibreMap maplibreMap = getMapLibreMap();
|
||||
if (maplibreMap != null) {
|
||||
maplibreMap.updatePolyline(this);
|
||||
}
|
||||
|
||||
@@ -365,54 +365,6 @@ object CameraUpdateFactory {
|
||||
}
|
||||
}
|
||||
|
||||
/* This class 1. Does not seem to be used 2. The code that calculates targetPoint seems to be a bit suspicious.
|
||||
commenting out for now.
|
||||
*/
|
||||
/*
|
||||
internal class CameraMoveUpdate(private val x: Float, private val y: Float) : CameraUpdate {
|
||||
override fun getCameraPosition(mapboxMap: MapboxMap): CameraPosition {
|
||||
val uiSettings = mapboxMap.uiSettings
|
||||
val projection = mapboxMap.projection
|
||||
// Calculate the new center point
|
||||
val viewPortWidth = uiSettings.width
|
||||
val viewPortHeight = uiSettings.height
|
||||
val padding = mapboxMap.cameraPosition.padding!!
|
||||
|
||||
// we inverse the map padding, is reapplied when using moveTo/easeTo or animateTo
|
||||
val targetPoint = PointF((viewPortWidth - padding[0].toFloat() + padding[1].toFloat()) / 2 + x,
|
||||
(viewPortHeight + padding[1].toFloat() - padding[3].toFloat()) / 2 + y)
|
||||
val latLng = projection.fromScreenLocation(targetPoint)
|
||||
val previousPosition = mapboxMap.cameraPosition
|
||||
return CameraPosition.Builder().target(latLng).zoom(previousPosition.zoom).tilt(previousPosition.tilt).bearing(previousPosition.bearing).build()
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) {
|
||||
return true
|
||||
}
|
||||
if (other == null || javaClass != other.javaClass) {
|
||||
return false
|
||||
}
|
||||
val that = other as CameraMoveUpdate
|
||||
return if (java.lang.Float.compare(that.x, x) != 0) {
|
||||
false
|
||||
} else {
|
||||
that.y.compareTo(y) == 0
|
||||
}
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = if (x != +0.0f) java.lang.Float.floatToIntBits(x) else 0
|
||||
result = 31 * result + if (y != +0.0f) java.lang.Float.floatToIntBits(y) else 0
|
||||
return result
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return ("CameraMoveUpdate{" + "x=" + x + ", y=" + y + '}')
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
class ZoomUpdate : CameraUpdate {
|
||||
@IntDef(ZOOM_IN, ZOOM_OUT, ZOOM_BY, ZOOM_TO, ZOOM_TO_POINT)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
|
||||
@@ -190,9 +190,9 @@ public class MapLibreConstants {
|
||||
public static final float ZOOM_RATE = 0.65f;
|
||||
|
||||
/**
|
||||
* Fragment Argument Key for MapboxMapOptions
|
||||
* Fragment Argument Key for MapLibreMapOptions
|
||||
*/
|
||||
public static final String FRAG_ARG_MAPLIBREMAPOPTIONS = "MapboxMapOptions";
|
||||
public static final String FRAG_ARG_MAPLIBREMAPOPTIONS = "MapLibreMapOptions";
|
||||
|
||||
/**
|
||||
* Layer Id of annotations layer
|
||||
|
||||
@@ -19,7 +19,7 @@ import androidx.annotation.NonNull;
|
||||
public class MapLibreConfigurationException extends RuntimeException {
|
||||
|
||||
/**
|
||||
* Creates a MapLibre configuration exception thrown by MapboxMap when the SDK hasn't been properly initialised.
|
||||
* Creates a MapLibre configuration exception thrown by MapLibreMap when the SDK hasn't been properly initialised.
|
||||
*/
|
||||
public MapLibreConfigurationException() {
|
||||
super("\nUsing MapView requires calling MapLibre.getInstance(Context context, String apiKey, "
|
||||
@@ -27,7 +27,7 @@ public class MapLibreConfigurationException extends RuntimeException {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a MapLibre configuration exception thrown by MapboxMap when the SDK hasn't been properly initialised.
|
||||
* Creates a MapLibre configuration exception thrown by MapLibreMap when the SDK hasn't been properly initialised.
|
||||
*/
|
||||
public MapLibreConfigurationException(@NonNull String message) {
|
||||
super(message);
|
||||
|
||||
@@ -75,8 +75,8 @@ class AnnotationManager {
|
||||
this.shapeAnnotations = shapeAnnotations;
|
||||
}
|
||||
|
||||
// TODO refactor MapboxMap out for Projection and Transform
|
||||
// Requires removing MapboxMap from Annotations by using Peer model from #6912
|
||||
// TODO refactor MapLibreMap out for Projection and Transform
|
||||
// Requires removing MapLibreMap from Annotations by using Peer model from #6912
|
||||
@NonNull
|
||||
AnnotationManager bind(MapLibreMap maplibreMap) {
|
||||
this.maplibreMap = maplibreMap;
|
||||
|
||||
@@ -211,7 +211,7 @@ public final class MapFragment extends Fragment implements OnMapReadyCallback {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a callback object which will be triggered when the MapboxMap instance is ready to be used.
|
||||
* Sets a callback object which will be triggered when the MapLibreMap instance is ready to be used.
|
||||
*
|
||||
* @param onMapReadyCallback The callback to be invoked.
|
||||
*/
|
||||
|
||||
@@ -52,13 +52,13 @@ import java.util.List;
|
||||
* you must obtain one from the getMapAsync() method on a MapFragment or MapView that you have
|
||||
* added to your application.
|
||||
* <p>
|
||||
* Note: Similar to a View object, a MapboxMap should only be read and modified from the main thread.
|
||||
* Note: Similar to a View object, a MapLibreMap should only be read and modified from the main thread.
|
||||
* </p>
|
||||
*/
|
||||
@UiThread
|
||||
public final class MapLibreMap {
|
||||
|
||||
private static final String TAG = "Mbgl-MapboxMap";
|
||||
private static final String TAG = "Mbgl-MapLibreMap";
|
||||
|
||||
private final NativeMap nativeMapView;
|
||||
private final UiSettings uiSettings;
|
||||
@@ -303,7 +303,7 @@ public final class MapLibreMap {
|
||||
* Set the tile pre-fetching zoom delta. Pre-fetching makes sure that a low-resolution
|
||||
* tile at the (current_zoom_level - delta) is rendered as soon as possible at the
|
||||
* expense of a little bandwidth.
|
||||
* Note: This operation will override the MapboxMapOptions#setPrefetchesTiles(boolean)
|
||||
* Note: This operation will override the MapLibreMapOptions#setPrefetchesTiles(boolean)
|
||||
* Setting zoom delta to 0 will disable pre-fetching.
|
||||
* Default zoom delta is 4.
|
||||
*
|
||||
|
||||
@@ -29,9 +29,9 @@ import java.util.Arrays;
|
||||
/**
|
||||
* Defines configuration MapLibreMapOptions for a MapLibreMap. These options can be used when adding a
|
||||
* map to your application programmatically (as opposed to via XML). If you are using a MapFragment,
|
||||
* you can pass these options in using the static factory method newInstance(MapboxMapOptions).
|
||||
* you can pass these options in using the static factory method newInstance(MapLibreMapOptions).
|
||||
* If you are using a MapView, you can pass these options in using the constructor
|
||||
* MapView(Context, MapboxMapOptions). If you add a map using XML, then you can apply these options
|
||||
* MapView(Context, MapLibreMapOptions). If you add a map using XML, then you can apply these options
|
||||
* using custom XML tags.
|
||||
*/
|
||||
public class MapLibreMapOptions implements Parcelable {
|
||||
@@ -95,7 +95,7 @@ public class MapLibreMapOptions implements Parcelable {
|
||||
private boolean crossSourceCollisions = true;
|
||||
|
||||
/**
|
||||
* Creates a new MapboxMapOptions object.
|
||||
* Creates a new MapLibreMapOptions object.
|
||||
*
|
||||
* @deprecated Use {@link #createFromAttributes(Context, AttributeSet)} instead.
|
||||
*/
|
||||
@@ -154,10 +154,10 @@ public class MapLibreMapOptions implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a default MapboxMapsOptions from a given context.
|
||||
* Creates a default MapLibreMapsOptions from a given context.
|
||||
*
|
||||
* @param context Context related to a map view.
|
||||
* @return the MapboxMapOptions created from attributes
|
||||
* @return the MapLibreMapOptions created from attributes
|
||||
*/
|
||||
@NonNull
|
||||
public static MapLibreMapOptions createFromAttributes(@NonNull Context context) {
|
||||
@@ -165,11 +165,11 @@ public class MapLibreMapOptions implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a MapboxMapsOptions from the attribute set.
|
||||
* Creates a MapLibreMapsOptions from the attribute set.
|
||||
*
|
||||
* @param context Context related to a map view.
|
||||
* @param attrs Attributeset containing configuration
|
||||
* @return the MapboxMapOptions created from attributes
|
||||
* @return the MapLibreMapOptions created from attributes
|
||||
*/
|
||||
@NonNull
|
||||
public static MapLibreMapOptions createFromAttributes(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
@@ -701,7 +701,7 @@ public class MapLibreMapOptions implements Parcelable {
|
||||
* Set the tile pre-fetching zoom delta. Pre-fetching makes sure that a low-resolution
|
||||
* tile at the (current_zoom_level - delta) is rendered as soon as possible at the
|
||||
* expense of a little bandwidth.
|
||||
* Note: This operation will override the MapboxMapOptions#setPrefetchesTiles(boolean)
|
||||
* Note: This operation will override the MapLibreMapOptions#setPrefetchesTiles(boolean)
|
||||
* Setting zoom delta to 0 will disable pre-fetching.
|
||||
* Default zoom delta is 4.
|
||||
*
|
||||
|
||||
@@ -122,7 +122,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
|
||||
@UiThread
|
||||
public MapView(@NonNull Context context, @Nullable MapLibreMapOptions options) {
|
||||
super(context);
|
||||
Timber.d("MapView constructed with context and MapboxMapOptions");
|
||||
Timber.d("MapView constructed with context and MapLibreMapOptions");
|
||||
initialize(context, options == null ? MapLibreMapOptions.createFromAttributes(context) : options);
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
|
||||
// callback for focal point invalidation
|
||||
focalInvalidator.addListener(createFocalPointChangeListener());
|
||||
|
||||
// setup components for MapboxMap creation
|
||||
// setup components for MapLibreMap creation
|
||||
Projection proj = new Projection(nativeMapView, this);
|
||||
UiSettings uiSettings = new UiSettings(proj, focalInvalidator, getPixelRatio(), this);
|
||||
LongSparseArray<Annotation> annotationsArray = new LongSparseArray<>();
|
||||
@@ -169,7 +169,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
|
||||
annotations, markers, polygons, polylines, shapeAnnotations);
|
||||
Transform transform = new Transform(this, nativeMapView, cameraDispatcher);
|
||||
|
||||
// MapboxMap
|
||||
// MapLibreMap
|
||||
List<MapLibreMap.OnDeveloperAnimationListener> developerAnimationListeners = new ArrayList<>();
|
||||
maplibreMap = new MapLibreMap(nativeMapView, transform, uiSettings, proj, registerTouchListener, cameraDispatcher,
|
||||
developerAnimationListeners);
|
||||
@@ -193,7 +193,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
|
||||
// notify Map object about current connectivity state
|
||||
nativeMapView.setReachability(MapLibre.isConnected());
|
||||
|
||||
// initialise MapboxMap
|
||||
// initialise MapLibreMap
|
||||
if (savedInstanceState == null) {
|
||||
maplibreMap.initialise(context, maplibreMapOptions);
|
||||
} else {
|
||||
@@ -226,7 +226,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
|
||||
attrView.setFocusable(true);
|
||||
attrView.setContentDescription(getResources().getString(R.string.maplibre_attributionsIconContentDescription));
|
||||
attrView.setImageDrawable(BitmapUtils.getDrawableFromRes(getContext(), R.drawable.maplibre_info_bg_selector));
|
||||
// inject widgets with MapboxMap
|
||||
// inject widgets with MapLibreMap
|
||||
attrView.setOnClickListener(attributionClickListener = new AttributionClickListener(getContext(), maplibreMap));
|
||||
return attrView;
|
||||
}
|
||||
@@ -1147,11 +1147,11 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
MapLibreMap getMapboxMap() {
|
||||
MapLibreMap getMapLibreMap() {
|
||||
return maplibreMap;
|
||||
}
|
||||
|
||||
void setMapboxMap(MapLibreMap maplibreMap) {
|
||||
void setMapLibreMap(MapLibreMap maplibreMap) {
|
||||
this.maplibreMap = maplibreMap;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class MarkerContainer implements Markers {
|
||||
public Marker addBy(@NonNull BaseMarkerOptions markerOptions, @NonNull MapLibreMap maplibreMap) {
|
||||
Marker marker = prepareMarker(markerOptions);
|
||||
long id = nativeMapView != null ? nativeMapView.addMarker(marker) : 0;
|
||||
marker.setMapboxMap(maplibreMap);
|
||||
marker.setMapLibreMap(maplibreMap);
|
||||
marker.setId(id);
|
||||
annotations.put(id, marker);
|
||||
return marker;
|
||||
@@ -57,7 +57,7 @@ class MarkerContainer implements Markers {
|
||||
long[] ids = nativeMapView.addMarkers(markers);
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
Marker createdMarker = markers.get(i);
|
||||
createdMarker.setMapboxMap(maplibreMap);
|
||||
createdMarker.setMapLibreMap(maplibreMap);
|
||||
createdMarker.setId(ids[i]);
|
||||
annotations.put(ids[i], createdMarker);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import androidx.annotation.NonNull;
|
||||
* Interface definition for a callback to be invoked when the map is ready to be used.
|
||||
* <p>
|
||||
* Once an instance of this interface is set on a {@link MapFragment} or {@link MapView} object,
|
||||
* the onMapReady(MapboxMap) method is triggered when the map is ready to be used and provides an instance of
|
||||
* the onMapReady(MapLibreMap) method is triggered when the map is ready to be used and provides an instance of
|
||||
* {@link MapLibreMap}.
|
||||
* </p>
|
||||
*/
|
||||
@@ -15,7 +15,7 @@ public interface OnMapReadyCallback {
|
||||
/**
|
||||
* Called when the map is ready to be used.
|
||||
*
|
||||
* @param maplibreMap An instance of MapboxMap associated with the {@link MapFragment} or
|
||||
* @param maplibreMap An instance of MapLibreMap associated with the {@link MapFragment} or
|
||||
* {@link MapView} that defines the callback.
|
||||
*/
|
||||
void onMapReady(@NonNull MapLibreMap maplibreMap);
|
||||
|
||||
@@ -30,7 +30,7 @@ class PolygonContainer implements Polygons {
|
||||
if (!polygon.getPoints().isEmpty()) {
|
||||
long id = nativeMap != null ? nativeMap.addPolygon(polygon) : 0;
|
||||
polygon.setId(id);
|
||||
polygon.setMapboxMap(maplibreMap);
|
||||
polygon.setMapLibreMap(maplibreMap);
|
||||
annotations.put(id, polygon);
|
||||
}
|
||||
return polygon;
|
||||
@@ -54,7 +54,7 @@ class PolygonContainer implements Polygons {
|
||||
long[] ids = nativeMap.addPolygons(polygons);
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
polygon = polygons.get(i);
|
||||
polygon.setMapboxMap(maplibreMap);
|
||||
polygon.setMapLibreMap(maplibreMap);
|
||||
polygon.setId(ids[i]);
|
||||
annotations.put(ids[i], polygon);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class PolylineContainer implements Polylines {
|
||||
Polyline polyline = polylineOptions.getPolyline();
|
||||
if (!polyline.getPoints().isEmpty()) {
|
||||
long id = nativeMap != null ? nativeMap.addPolyline(polyline) : 0;
|
||||
polyline.setMapboxMap(maplibreMap);
|
||||
polyline.setMapLibreMap(maplibreMap);
|
||||
polyline.setId(id);
|
||||
annotations.put(id, polyline);
|
||||
}
|
||||
@@ -53,7 +53,7 @@ class PolylineContainer implements Polylines {
|
||||
long[] ids = nativeMap.addPolylines(polylines);
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
Polyline polylineCreated = polylines.get(i);
|
||||
polylineCreated.setMapboxMap(maplibreMap);
|
||||
polylineCreated.setMapLibreMap(maplibreMap);
|
||||
polylineCreated.setId(ids[i]);
|
||||
annotations.put(ids[i], polylineCreated);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.util.Map;
|
||||
* The proxy object for current map style.
|
||||
* <p>
|
||||
* To create new instances of this object, create a new instance using a {@link Builder} and load the style with
|
||||
* MapboxMap. This object is returned from {@link MapLibreMap#getStyle()} once the style
|
||||
* MapLibreMap. This object is returned from {@link MapLibreMap#getStyle()} once the style
|
||||
* has been loaded by underlying map.
|
||||
* </p>
|
||||
*/
|
||||
@@ -814,7 +814,7 @@ public class Style {
|
||||
* <p>
|
||||
* This method is asynchronous and will return before the style finishes loading.
|
||||
* If you wish to wait for the map to finish loading, listen to the {@link MapView.OnDidFinishLoadingStyleListener}
|
||||
* callback or provide an {@link OnStyleLoaded} callback when setting the style on MapboxMap.
|
||||
* callback or provide an {@link OnStyleLoaded} callback when setting the style on MapLibreMap.
|
||||
* </p>
|
||||
* If the style fails to load or an invalid style URL is set, the map view will become blank.
|
||||
* An error message will be logged in the Android logcat and {@link MapView.OnDidFailLoadingMapListener} callback
|
||||
|
||||
@@ -206,7 +206,7 @@ public class SupportMapFragment extends Fragment implements OnMapReadyCallback {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a callback object which will be triggered when the MapboxMap instance is ready to be used.
|
||||
* Sets a callback object which will be triggered when the MapLibreMap instance is ready to be used.
|
||||
*
|
||||
* @param onMapReadyCallback The callback to be invoked.
|
||||
*/
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.maplibre.android.utils.BitmapUtils;
|
||||
import org.maplibre.android.utils.ColorUtils;
|
||||
|
||||
/**
|
||||
* Settings for the user interface of a MapboxMap. To obtain this interface, call getUiSettings().
|
||||
* Settings for the user interface of a MapLibreMap. To obtain this interface, call getUiSettings().
|
||||
*/
|
||||
public final class UiSettings {
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ interface OfflineRegionDefinition : Parcelable {
|
||||
* Defaults to `true`
|
||||
*
|
||||
* @return true if offline region will include ideographic glyphs
|
||||
* @see MapboxMapOptions.localIdeographFontFamily
|
||||
* @see MapLibreMapOptions.localIdeographFontFamily
|
||||
*/
|
||||
val includeIdeographs: Boolean
|
||||
|
||||
|
||||
@@ -3008,7 +3008,7 @@ public class Expression {
|
||||
* </p>
|
||||
* <pre>
|
||||
* {@code
|
||||
* mapboxMap.getStyle().addLayer(new SymbolLayer("layer-id", "source-id")
|
||||
* maplibreMap.getStyle().addLayer(new SymbolLayer("layer-id", "source-id")
|
||||
* .withProperties(
|
||||
* textField(
|
||||
* switchCase(
|
||||
@@ -3039,7 +3039,7 @@ public class Expression {
|
||||
* </p>
|
||||
* <pre>
|
||||
* {@code
|
||||
* mapboxMap.getStyle().addLayer(new SymbolLayer("layer-id", "source-id")
|
||||
* maplibreMap.getStyle().addLayer(new SymbolLayer("layer-id", "source-id")
|
||||
* .withProperties(
|
||||
* textField(
|
||||
* switchCase(
|
||||
|
||||
@@ -18,7 +18,7 @@ public class CustomLayer extends Layer {
|
||||
/**
|
||||
* Triggers map re-paint.
|
||||
*
|
||||
* @deprecated Use {@link MapboxMap#triggerRepaint()} instead.
|
||||
* @deprecated Use {@link MapLibreMap#triggerRepaint()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
@Keep
|
||||
|
||||
@@ -84,7 +84,7 @@ public abstract class Source {
|
||||
* Set the tile pre-fetching zoom delta for current source. Pre-fetching makes sure that a low-resolution
|
||||
* tile at the (current_zoom_level - delta) is rendered as soon as possible at the
|
||||
* expense of a little bandwidth.
|
||||
* If delta has not been set or set to null, it will use the value in MapboxMap instance.
|
||||
* If delta has not been set or set to null, it will use the value in MapLibreMap instance.
|
||||
*
|
||||
* @param delta zoom delta
|
||||
*/
|
||||
|
||||
@@ -21,9 +21,9 @@ import org.maplibre.android.maps.MapLibreMapOptions;
|
||||
public class MapFragmentUtils {
|
||||
|
||||
/**
|
||||
* Convert MapboxMapOptions to a bundle of fragment arguments.
|
||||
* Convert MapLibreMapOptions to a bundle of fragment arguments.
|
||||
*
|
||||
* @param options The MapboxMapOptions to convert
|
||||
* @param options The MapLibreMapOptions to convert
|
||||
* @return a bundle of converted fragment arguments
|
||||
*/
|
||||
@NonNull
|
||||
@@ -34,11 +34,11 @@ public class MapFragmentUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a bundle of fragment arguments to MapboxMapOptions.
|
||||
* Convert a bundle of fragment arguments to MapLibreMapOptions.
|
||||
*
|
||||
* @param context The context of the activity hosting the fragment
|
||||
* @param args The fragment arguments
|
||||
* @return converted MapboxMapOptions
|
||||
* @return converted MapLibreMapOptions
|
||||
*/
|
||||
@Nullable
|
||||
public static MapLibreMapOptions resolveArgs(@NonNull Context context, @Nullable Bundle args) {
|
||||
|
||||
Reference in New Issue
Block a user