Skip to content

Commit

Permalink
Updated Android SDK from 10.2.0 to 11.0.1 (#412)
Browse files Browse the repository at this point in the history
* Updated Android SDK from 10.2.0 to 11.0.1
See changelog https://github.com/maplibre/maplibre-native/blob/main/platform/android/CHANGELOG.md

---------

Co-authored-by: Dominik Ehret <[email protected]>
  • Loading branch information
dehret and CaptainCodeGmbH authored Jul 12, 2024
1 parent 5d6cac0 commit 599d8d6
Show file tree
Hide file tree
Showing 63 changed files with 339 additions and 336 deletions.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 16
compileSdkVersion = 33
compileSdkVersion = 34
targetSdkVersion = 33
supportLibVersion = "28.0.0"
}
Expand Down
10 changes: 5 additions & 5 deletions android/rctmln/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ dependencies {
implementation("com.facebook.react:react-android")

// MapLibre SDK
implementation "org.maplibre.gl:android-sdk:10.2.0"
implementation "org.maplibre.gl:android-sdk-turf:5.9.0"
implementation "org.maplibre.gl:android-sdk:11.0.1"
implementation "org.maplibre.gl:android-sdk-turf:6.0.1"

// Dependencies
implementation "androidx.vectordrawable:vectordrawable:1.1.0"
Expand All @@ -45,9 +45,9 @@ dependencies {


// MapLibre plugins
implementation ("org.maplibre.gl:android-plugin-localization-v9:2.0.1")
implementation ("org.maplibre.gl:android-plugin-annotation-v9:2.0.1")
implementation ("org.maplibre.gl:android-plugin-markerview-v9:2.0.1")
implementation ("org.maplibre.gl:android-plugin-localization-v9:3.0.0")
implementation ("org.maplibre.gl:android-plugin-annotation-v9:3.0.0")
implementation ("org.maplibre.gl:android-plugin-markerview-v9:3.0.0")
}

allprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

import androidx.annotation.NonNull;

import com.mapbox.mapboxsdk.geometry.LatLng;
import org.maplibre.android.geometry.LatLng;

/**
* Subclass of MarkerView so we MarkerViewManager can implement remove/restoreViews
*/
public class MarkerView extends com.mapbox.mapboxsdk.plugins.markerview.MarkerView {
public class MarkerView extends org.maplibre.android.plugins.markerview.MarkerView {
View view;

public MarkerView(@NonNull LatLng latLng, @NonNull View view) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import androidx.annotation.NonNull;

import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import org.maplibre.android.maps.MapView;
import org.maplibre.android.maps.MapLibreMap;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -13,15 +13,15 @@
/**
* Subclass of MarkerViewManager implementing removeViews and restoreViews
*/
public class MarkerViewManager extends com.mapbox.mapboxsdk.plugins.markerview.MarkerViewManager {
public class MarkerViewManager extends org.maplibre.android.plugins.markerview.MarkerViewManager {
private final List<MarkerView> markers = new ArrayList<>();
private MapView mapView;
private java.lang.reflect.Method markerUpdate;

public MarkerViewManager(MapView mapView, MapboxMap mapboxMap) {
super(mapView, mapboxMap);
public MarkerViewManager(MapView mapView, MapLibreMap map) {
super(mapView, map);
this.mapView = mapView;
// this.mapboxMap = mapboxMap;
// this.map = map;

try {
markerUpdate = MarkerView.class.getSuperclass().getDeclaredMethod("update");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

import androidx.annotation.NonNull;

import com.mapbox.geojson.Point;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
import org.maplibre.geojson.Point;
import org.maplibre.android.maps.MapLibreMap;
import org.maplibre.android.maps.OnMapReadyCallback;
import com.maplibre.rctmln.components.AbstractMapFeature;
import com.maplibre.rctmln.components.mapview.RCTMLNMapView;
import com.maplibre.rctmln.utils.GeoJSONUtils;
Expand Down Expand Up @@ -65,8 +65,8 @@ public void addToMap(RCTMLNMapView mapView) {
mMapView.getMapAsync(
new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull MapboxMap mapboxMap) {
mMarkerViewManager = mMapView.getMarkerViewManager(mapboxMap);
public void onMapReady(@NonNull MapLibreMap mapLibreMap) {
mMarkerViewManager = mMapView.getMarkerViewManager(mapLibreMap);

if (mChildView != null) {
mMarkerView = new MarkerView(GeoJSONUtils.toLatLng(mCoordinate), mChildView);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
import android.view.View;
import androidx.annotation.NonNull;

import com.mapbox.geojson.Point;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.maps.Style;
import com.mapbox.mapboxsdk.plugins.annotation.Symbol;
import com.mapbox.mapboxsdk.plugins.annotation.SymbolManager;
import com.mapbox.mapboxsdk.plugins.annotation.SymbolOptions;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import org.maplibre.geojson.Point;
import org.maplibre.android.geometry.LatLng;
import org.maplibre.android.maps.Style;
import org.maplibre.android.plugins.annotation.Symbol;
import org.maplibre.android.plugins.annotation.SymbolManager;
import org.maplibre.android.plugins.annotation.SymbolOptions;
import org.maplibre.android.maps.MapLibreMap;

import com.maplibre.rctmln.components.AbstractMapFeature;
import com.maplibre.rctmln.components.mapview.RCTMLNMapView;
import com.maplibre.rctmln.events.PointAnnotationClickEvent;
Expand All @@ -25,7 +26,7 @@ public class RCTMLNPointAnnotation extends AbstractMapFeature implements View.On
private Context mContext;
private RCTMLNPointAnnotationManager mManager;
private Symbol mAnnotation;
private MapboxMap mMap;
private MapLibreMap mMap;
private RCTMLNMapView mMapView;

private boolean mHasChildren;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@
import android.util.DisplayMetrics;

import com.facebook.react.bridge.ReadableMap;
import com.mapbox.geojson.FeatureCollection;
import com.mapbox.geojson.Point;
import com.mapbox.mapboxsdk.camera.CameraPosition;
import com.mapbox.mapboxsdk.camera.CameraUpdate;
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import org.maplibre.geojson.FeatureCollection;
import org.maplibre.geojson.Point;
import org.maplibre.android.camera.CameraPosition;
import org.maplibre.android.camera.CameraUpdate;
import org.maplibre.android.camera.CameraUpdateFactory;
import org.maplibre.android.geometry.LatLng;
import org.maplibre.android.geometry.LatLngBounds;
import org.maplibre.android.maps.MapLibreMap;
import com.maplibre.rctmln.components.camera.constants.CameraMode;
import com.maplibre.rctmln.utils.GeoJSONUtils;

import com.maplibre.rctmln.components.mapview.RCTMLNMapView;



/**
* Created by nickitaliano on 9/5/17.
*/
Expand All @@ -36,7 +38,7 @@ public class CameraStop {

private int mMode = CameraMode.EASE;
private int mDuration = 2000;
private MapboxMap.CancelableCallback mCallback;
private MapLibreMap.CancelableCallback mCallback;

public CameraStop() {
}
Expand All @@ -61,7 +63,7 @@ public void setDuration(int duration) {
mDuration = duration;
}

public void setCallback(MapboxMap.CancelableCallback callback) {
public void setCallback(MapLibreMap.CancelableCallback callback) {
mCallback = callback;
}

Expand All @@ -81,7 +83,7 @@ public void setMode(@CameraMode.Mode int mode) {
}

public CameraUpdateItem toCameraUpdate(RCTMLNMapView mapView) {
MapboxMap map = mapView.getMapboxMap();
MapLibreMap map = mapView.getMapboxMap();
CameraPosition currentCamera = map.getCameraPosition();
CameraPosition.Builder builder = new CameraPosition.Builder(currentCamera);

Expand Down Expand Up @@ -144,7 +146,7 @@ public CameraUpdateItem toCameraUpdate(RCTMLNMapView mapView) {
return new CameraUpdateItem(map, CameraUpdateFactory.newCameraPosition(builder.build()), mDuration, mCallback, mMode);
}

public static CameraStop fromReadableMap(Context context, @NonNull ReadableMap readableMap, MapboxMap.CancelableCallback callback) {
public static CameraStop fromReadableMap(Context context, @NonNull ReadableMap readableMap, MapLibreMap.CancelableCallback callback) {
CameraStop stop = new CameraStop();

if (readableMap.hasKey("pitch")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import androidx.annotation.NonNull;

import com.mapbox.mapboxsdk.camera.CameraUpdate;
import com.mapbox.mapboxsdk.constants.MapboxConstants;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import org.maplibre.android.camera.CameraUpdate;
import org.maplibre.android.constants.MapLibreConstants;
import org.maplibre.android.maps.MapLibreMap;
import com.maplibre.rctmln.components.camera.constants.CameraMode;

import java.lang.ref.WeakReference;
Expand All @@ -23,16 +23,16 @@

public class CameraUpdateItem implements RunnableFuture<Void> {
private int mDuration;
private MapboxMap.CancelableCallback mCallback;
private MapLibreMap.CancelableCallback mCallback;
private CameraUpdate mCameraUpdate;
private int mCameraMode;

private boolean isCameraActionFinished;
private boolean isCameraActionCancelled;

private WeakReference<MapboxMap> mMap;
private WeakReference<MapLibreMap> mMap;

public CameraUpdateItem(MapboxMap map, CameraUpdate update, int duration, MapboxMap.CancelableCallback callback, @CameraMode.Mode int cameraMode) {
public CameraUpdateItem(MapLibreMap map, CameraUpdate update, int duration, MapLibreMap.CancelableCallback callback, @CameraMode.Mode int cameraMode) {
mCameraUpdate = update;
mDuration = duration;
mCallback = callback;
Expand All @@ -46,7 +46,7 @@ public int getDuration() {

@Override
public void run() {
final MapboxMap.CancelableCallback callback = new MapboxMap.CancelableCallback() {
final MapLibreMap.CancelableCallback callback = new MapLibreMap.CancelableCallback() {
@Override
public void onCancel() {
handleCallbackResponse(true);
Expand All @@ -58,7 +58,7 @@ public void onFinish() {
}
};

MapboxMap map = mMap.get();
MapLibreMap map = mMap.get();
if (map == null) {
isCameraActionCancelled = true;
return;
Expand All @@ -71,8 +71,8 @@ public void onFinish() {
}

// On iOS a duration of -1 means default or dynamic duration (based on flight-path length)
// On Android we can fallback to Mapbox's default duration as there is no such API
int duration = mDuration < 0 ? MapboxConstants.ANIMATION_DURATION : mDuration;
// On Android we can fallback to MapLibre's default duration as there is no such API
int duration = mDuration < 0 ? MapLibreConstants.ANIMATION_DURATION : mDuration;

if (mCameraMode == CameraMode.FLIGHT) {
map.animateCamera(mCameraUpdate, duration, callback);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.maplibre.rctmln.components.camera;

import com.mapbox.mapboxsdk.maps.MapboxMap;
import org.maplibre.android.maps.MapLibreMap;
import com.maplibre.rctmln.components.mapview.RCTMLNMapView;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
import android.content.Context;
import android.location.Location;

import com.mapbox.mapboxsdk.camera.CameraPosition;
import com.mapbox.mapboxsdk.camera.CameraUpdate;
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
import com.mapbox.mapboxsdk.geometry.VisibleRegion;
import com.mapbox.mapboxsdk.location.OnCameraTrackingChangedListener;
import com.mapbox.mapboxsdk.location.modes.CameraMode;
import com.mapbox.mapboxsdk.location.modes.RenderMode;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.maps.Style;
import com.mapbox.mapboxsdk.location.LocationComponent;
import com.mapbox.mapboxsdk.location.LocationComponentOptions;
import com.mapbox.mapboxsdk.location.LocationComponentActivationOptions;
// import com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin;
import org.maplibre.android.camera.CameraPosition;
import org.maplibre.android.camera.CameraUpdate;
import org.maplibre.android.camera.CameraUpdateFactory;
import org.maplibre.android.geometry.LatLng;
import org.maplibre.android.geometry.LatLngBounds;
import org.maplibre.android.geometry.VisibleRegion;
import org.maplibre.android.location.OnCameraTrackingChangedListener;
import org.maplibre.android.location.modes.CameraMode;
import org.maplibre.android.location.modes.RenderMode;
import org.maplibre.android.maps.MapLibreMap;
import org.maplibre.android.maps.Style;
import org.maplibre.android.location.LocationComponent;
import org.maplibre.android.location.LocationComponentOptions;
import org.maplibre.android.location.LocationComponentActivationOptions;
// import org.maplibre.android.plugins.locationlayer.LocationLayerPlugin;
import com.maplibre.rctmln.components.AbstractMapFeature;
import com.maplibre.rctmln.components.location.LocationComponentManager;
import com.maplibre.rctmln.components.mapview.RCTMLNMapView;
Expand All @@ -38,9 +38,9 @@
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.bridge.WritableNativeMap;

import com.mapbox.geojson.Point;
import org.maplibre.geojson.Point;

import com.mapbox.mapboxsdk.location.permissions.PermissionsManager;
import org.maplibre.android.location.permissions.PermissionsManager;

import androidx.annotation.NonNull;

Expand Down Expand Up @@ -96,7 +96,7 @@ public void onLocationChange(Location nextLocation) {
}
};

private MapboxMap.CancelableCallback mCameraCallback = new MapboxMap.CancelableCallback() {
private MapLibreMap.CancelableCallback mCameraCallback = new MapLibreMap.CancelableCallback() {
@Override
public void onCancel() {
if (!hasSentFirstRegion) {
Expand Down Expand Up @@ -170,14 +170,14 @@ public void setMaxBounds(LatLngBounds bounds) {
}

private void updateMaxBounds() {
MapboxMap map = getMapboxMap();
MapLibreMap map = getMapboxMap();
if (map != null && mMaxBounds != null) {
map.setLatLngBoundsForCameraTarget(mMaxBounds);
}
}

private void updateMaxMinZoomLevel() {
MapboxMap map = getMapboxMap();
MapLibreMap map = getMapboxMap();
if (map != null) {
if (mMinZoomLevel >= 0.0) {
map.setMinZoomPreference(mMinZoomLevel);
Expand Down Expand Up @@ -281,15 +281,15 @@ private void updateUserLocationSignificantly(boolean isAnimated) {

double zoom = mZoomLevel;
if (zoom < 0) {
double camerZoom = mMapView.getMapboxMap().getCameraPosition().zoom;
if (camerZoom < minimumZoomLevelForUserTracking) {
double cameraZoom = mMapView.getMapboxMap().getCameraPosition().zoom;
if (cameraZoom < minimumZoomLevelForUserTracking) {
zoom = defaultZoomLevelForUserTracking;
} else {
zoom = camerZoom;
zoom = cameraZoom;
}
}
CameraUpdate cameraUpdate = CameraUpdateFactory.newCameraPosition(getUserLocationUpdateCameraPosition(zoom));
MapboxMap.CancelableCallback cameraCallback = new MapboxMap.CancelableCallback() {
MapLibreMap.CancelableCallback cameraCallback = new MapLibreMap.CancelableCallback() {
@Override
public void onCancel() {
mUserTrackingState = UserTrackingState.CHANGED;
Expand All @@ -314,7 +314,7 @@ private void updateUserLocationIncrementally(boolean isAnimated) {
CameraPosition cameraPosition = mMapView.getCameraPosition();
CameraUpdate cameraUpdate = CameraUpdateFactory.newCameraPosition(getUserLocationUpdateCameraPosition(cameraPosition.zoom));

MapboxMap.CancelableCallback callback = new MapboxMap.CancelableCallback() {
MapLibreMap.CancelableCallback callback = new MapLibreMap.CancelableCallback() {
@Override
public void onCancel() {
mUserTrackingState = UserTrackingState.CHANGED;
Expand Down Expand Up @@ -497,7 +497,7 @@ private void updatedFollowUserMode() {
}
}

MapboxMap getMapboxMap() {
MapLibreMap getMapboxMap() {
if (mMapView == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.maplibre.rctmln.components.camera;

import com.mapbox.geojson.FeatureCollection;
import org.maplibre.geojson.FeatureCollection;
import com.facebook.common.logging.FLog;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReadableMap;
Expand Down
Loading

0 comments on commit 599d8d6

Please sign in to comment.