diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93f443bd..dd6647f3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: BUILDTYPE: Release IS_LOCAL_DEVELOPMENT: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 0 diff --git a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/BaseActivityTest.java b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/BaseActivityTest.java index fe37af9b..d2341bcd 100644 --- a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/BaseActivityTest.java +++ b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/BaseActivityTest.java @@ -5,7 +5,6 @@ import android.net.ConnectivityManager; import android.net.NetworkInfo; -import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.plugins.annotation.MapboxMapAction; import com.mapbox.mapboxsdk.plugins.annotation.WaitAction; import com.mapbox.mapboxsdk.plugins.utils.OnMapReadyIdlingResource; @@ -16,6 +15,7 @@ import org.junit.Before; import org.junit.Rule; import org.junit.rules.TestName; +import org.maplibre.android.maps.MapLibreMap; import androidx.test.espresso.Espresso; import androidx.test.espresso.IdlingRegistry; @@ -38,7 +38,7 @@ public abstract class BaseActivityTest { @Rule public TestName testName = new TestName(); - protected MapboxMap mapboxMap; + protected MapLibreMap maplibreMap; protected OnMapReadyIdlingResource idlingResource; @Before @@ -47,7 +47,7 @@ public void beforeTest() { Timber.e("@Before %s: register idle resource", testName.getMethodName()); IdlingRegistry.getInstance().register(idlingResource = new OnMapReadyIdlingResource(rule.getActivity())); Espresso.onIdle(); - mapboxMap = idlingResource.getMapboxMap(); + maplibreMap = idlingResource.getMapLibreMap(); } catch (IdlingResourceTimeoutException idlingResourceTimeoutException) { throw new RuntimeException(String.format("Could not start %s test for %s.\n Either the ViewHierarchy doesn't " + "contain a view with resource id = R.id.mapView or \n the hosting Activity wasn't in an idle state.", @@ -60,11 +60,11 @@ public void beforeTest() { protected void validateTestSetup() { Assert.assertTrue("Device is not connected to the Internet.", isConnected(rule.getActivity())); checkViewIsDisplayed(android.R.id.content); - Assert.assertNotNull(mapboxMap); + Assert.assertNotNull(maplibreMap); } - protected MapboxMap getMapboxMap() { - return mapboxMap; + protected MapLibreMap getMapboxMap() { + return maplibreMap; } protected abstract Class getActivityClass(); @@ -93,7 +93,7 @@ protected ViewInteraction onMapView() { } protected MapboxMapAction getMapboxMapAction(MapboxMapAction.OnInvokeActionListener onInvokeActionListener) { - return new MapboxMapAction(onInvokeActionListener, mapboxMap); + return new MapboxMapAction(onInvokeActionListener, maplibreMap); } @After diff --git a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/CircleManagerTest.java b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/CircleManagerTest.java index c40f872c..9dbd046a 100644 --- a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/CircleManagerTest.java +++ b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/CircleManagerTest.java @@ -4,7 +4,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; -import com.mapbox.mapboxsdk.geometry.LatLng; +import org.maplibre.android.geometry.LatLng; import com.mapbox.mapboxsdk.plugins.testapp.activity.TestActivity; import com.mapbox.mapboxsdk.plugins.BaseActivityTest; @@ -17,7 +17,7 @@ import static com.mapbox.mapboxsdk.plugins.annotation.MapboxMapAction.invoke; import static org.junit.Assert.*; -import static com.mapbox.mapboxsdk.style.layers.Property.*; +import static org.maplibre.android.style.layers.Property.*; /** * Basic smoke tests for CircleManager @@ -34,8 +34,8 @@ protected Class getActivityClass() { private void setupCircleManager() { Timber.i("Retrieving layer"); - invoke(mapboxMap, (uiController, mapboxMap) -> { - circleManager = new CircleManager(idlingResource.getMapView(), mapboxMap, Objects.requireNonNull(mapboxMap.getStyle())); + invoke(maplibreMap, (uiController, maplibreMap) -> { + circleManager = new CircleManager(idlingResource.getMapView(), maplibreMap, Objects.requireNonNull(maplibreMap.getStyle())); }); } @@ -44,7 +44,7 @@ public void testCircleTranslateAsConstant() { validateTestSetup(); setupCircleManager(); Timber.i("circle-translate"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(circleManager); circleManager.setCircleTranslate(new Float[]{0f, 0f}); @@ -57,7 +57,7 @@ public void testCircleTranslateAnchorAsConstant() { validateTestSetup(); setupCircleManager(); Timber.i("circle-translate-anchor"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(circleManager); circleManager.setCircleTranslateAnchor(CIRCLE_TRANSLATE_ANCHOR_MAP); @@ -70,7 +70,7 @@ public void testCirclePitchScaleAsConstant() { validateTestSetup(); setupCircleManager(); Timber.i("circle-pitch-scale"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(circleManager); circleManager.setCirclePitchScale(CIRCLE_PITCH_SCALE_MAP); @@ -83,7 +83,7 @@ public void testCirclePitchAlignmentAsConstant() { validateTestSetup(); setupCircleManager(); Timber.i("circle-pitch-alignment"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(circleManager); circleManager.setCirclePitchAlignment(CIRCLE_PITCH_ALIGNMENT_MAP); diff --git a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/CircleTest.java b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/CircleTest.java index a68af720..8a0ecbd2 100644 --- a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/CircleTest.java +++ b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/CircleTest.java @@ -1,3 +1,4 @@ + // This file is generated. package com.mapbox.mapboxsdk.plugins.annotation; @@ -6,10 +7,10 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; -import com.mapbox.mapboxsdk.geometry.LatLng; +import org.maplibre.android.geometry.LatLng; import com.mapbox.mapboxsdk.plugins.BaseActivityTest; import com.mapbox.mapboxsdk.plugins.testapp.activity.TestActivity; -import com.mapbox.mapboxsdk.utils.ColorUtils; +import org.maplibre.android.utils.ColorUtils; import timber.log.Timber; @@ -20,7 +21,7 @@ import static com.mapbox.mapboxsdk.plugins.annotation.MapboxMapAction.invoke; import static org.junit.Assert.*; -import static com.mapbox.mapboxsdk.style.layers.Property.*; +import static org.maplibre.android.style.layers.Property.*; import java.util.ArrayList; import java.util.List; @@ -40,8 +41,8 @@ protected Class getActivityClass() { private void setupAnnotation() { Timber.i("Retrieving layer"); - invoke(mapboxMap, (uiController, mapboxMap) -> { - CircleManager circleManager = new CircleManager(idlingResource.getMapView(), mapboxMap, Objects.requireNonNull(mapboxMap.getStyle())); + invoke(maplibreMap, (uiController, maplibreMap) -> { + CircleManager circleManager = new CircleManager(idlingResource.getMapView(), maplibreMap, Objects.requireNonNull(maplibreMap.getStyle())); circle = circleManager.create(new CircleOptions().withLatLng(new LatLng())); }); } @@ -51,7 +52,7 @@ public void testCircleRadius() { validateTestSetup(); setupAnnotation(); Timber.i("circle-radius"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(circle); circle.setCircleRadius(2.0f); @@ -64,7 +65,7 @@ public void testCircleColor() { validateTestSetup(); setupAnnotation(); Timber.i("circle-color"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(circle); circle.setCircleColor("rgba(0, 0, 0, 1)"); @@ -77,7 +78,7 @@ public void testCircleColorAsInt() { validateTestSetup(); setupAnnotation(); Timber.i("circle-color"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(circle); circle.setCircleColor(ColorUtils.rgbaToColor("rgba(0, 0, 0, 1)")); assertEquals(circle.getCircleColorAsInt(), ColorUtils.rgbaToColor("rgba(0, 0, 0, 1)")); @@ -90,7 +91,7 @@ public void testCircleBlur() { validateTestSetup(); setupAnnotation(); Timber.i("circle-blur"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(circle); circle.setCircleBlur(2.0f); @@ -103,7 +104,7 @@ public void testCircleOpacity() { validateTestSetup(); setupAnnotation(); Timber.i("circle-opacity"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(circle); circle.setCircleOpacity(2.0f); @@ -116,7 +117,7 @@ public void testCircleStrokeWidth() { validateTestSetup(); setupAnnotation(); Timber.i("circle-stroke-width"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(circle); circle.setCircleStrokeWidth(2.0f); @@ -129,7 +130,7 @@ public void testCircleStrokeColor() { validateTestSetup(); setupAnnotation(); Timber.i("circle-stroke-color"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(circle); circle.setCircleStrokeColor("rgba(0, 0, 0, 1)"); @@ -142,7 +143,7 @@ public void testCircleStrokeColorAsInt() { validateTestSetup(); setupAnnotation(); Timber.i("circle-stroke-color"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(circle); circle.setCircleStrokeColor(ColorUtils.rgbaToColor("rgba(0, 0, 0, 1)")); assertEquals(circle.getCircleStrokeColorAsInt(), ColorUtils.rgbaToColor("rgba(0, 0, 0, 1)")); @@ -155,7 +156,7 @@ public void testCircleStrokeOpacity() { validateTestSetup(); setupAnnotation(); Timber.i("circle-stroke-opacity"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(circle); circle.setCircleStrokeOpacity(2.0f); diff --git a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/FillManagerTest.java b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/FillManagerTest.java index 33a814a7..bd7651a9 100644 --- a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/FillManagerTest.java +++ b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/FillManagerTest.java @@ -4,7 +4,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; -import com.mapbox.mapboxsdk.geometry.LatLng; +import org.maplibre.android.geometry.LatLng; import com.mapbox.mapboxsdk.plugins.testapp.activity.TestActivity; import com.mapbox.mapboxsdk.plugins.BaseActivityTest; @@ -17,7 +17,7 @@ import static com.mapbox.mapboxsdk.plugins.annotation.MapboxMapAction.invoke; import static org.junit.Assert.*; -import static com.mapbox.mapboxsdk.style.layers.Property.*; +import static org.maplibre.android.style.layers.Property.*; /** * Basic smoke tests for FillManager @@ -34,8 +34,8 @@ protected Class getActivityClass() { private void setupFillManager() { Timber.i("Retrieving layer"); - invoke(mapboxMap, (uiController, mapboxMap) -> { - fillManager = new FillManager(idlingResource.getMapView(), mapboxMap, Objects.requireNonNull(mapboxMap.getStyle())); + invoke(maplibreMap, (uiController, maplibreMap) -> { + fillManager = new FillManager(idlingResource.getMapView(), maplibreMap, Objects.requireNonNull(maplibreMap.getStyle())); }); } @@ -44,7 +44,7 @@ public void testFillAntialiasAsConstant() { validateTestSetup(); setupFillManager(); Timber.i("fill-antialias"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(fillManager); fillManager.setFillAntialias(true); @@ -57,7 +57,7 @@ public void testFillTranslateAsConstant() { validateTestSetup(); setupFillManager(); Timber.i("fill-translate"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(fillManager); fillManager.setFillTranslate(new Float[]{0f, 0f}); @@ -70,7 +70,7 @@ public void testFillTranslateAnchorAsConstant() { validateTestSetup(); setupFillManager(); Timber.i("fill-translate-anchor"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(fillManager); fillManager.setFillTranslateAnchor(FILL_TRANSLATE_ANCHOR_MAP); diff --git a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/FillTest.java b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/FillTest.java index 596628dc..4f88235c 100644 --- a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/FillTest.java +++ b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/FillTest.java @@ -1,3 +1,4 @@ + // This file is generated. package com.mapbox.mapboxsdk.plugins.annotation; @@ -6,10 +7,10 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; -import com.mapbox.mapboxsdk.geometry.LatLng; +import org.maplibre.android.geometry.LatLng; import com.mapbox.mapboxsdk.plugins.BaseActivityTest; import com.mapbox.mapboxsdk.plugins.testapp.activity.TestActivity; -import com.mapbox.mapboxsdk.utils.ColorUtils; +import org.maplibre.android.utils.ColorUtils; import timber.log.Timber; @@ -20,7 +21,7 @@ import static com.mapbox.mapboxsdk.plugins.annotation.MapboxMapAction.invoke; import static org.junit.Assert.*; -import static com.mapbox.mapboxsdk.style.layers.Property.*; +import static org.maplibre.android.style.layers.Property.*; import java.util.ArrayList; import java.util.List; @@ -40,8 +41,8 @@ protected Class getActivityClass() { private void setupAnnotation() { Timber.i("Retrieving layer"); - invoke(mapboxMap, (uiController, mapboxMap) -> { - FillManager fillManager = new FillManager(idlingResource.getMapView(), mapboxMap, Objects.requireNonNull(mapboxMap.getStyle())); + invoke(maplibreMap, (uiController, maplibreMap) -> { + FillManager fillManager = new FillManager(idlingResource.getMapView(), maplibreMap, Objects.requireNonNull(maplibreMap.getStyle())); List innerLatLngs = new ArrayList<>(); innerLatLngs.add(new LatLng()); innerLatLngs.add(new LatLng(1, 1)); @@ -57,7 +58,7 @@ public void testFillOpacity() { validateTestSetup(); setupAnnotation(); Timber.i("fill-opacity"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(fill); fill.setFillOpacity(2.0f); @@ -70,7 +71,7 @@ public void testFillColor() { validateTestSetup(); setupAnnotation(); Timber.i("fill-color"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(fill); fill.setFillColor("rgba(0, 0, 0, 1)"); @@ -83,7 +84,7 @@ public void testFillColorAsInt() { validateTestSetup(); setupAnnotation(); Timber.i("fill-color"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(fill); fill.setFillColor(ColorUtils.rgbaToColor("rgba(0, 0, 0, 1)")); assertEquals(fill.getFillColorAsInt(), ColorUtils.rgbaToColor("rgba(0, 0, 0, 1)")); @@ -96,7 +97,7 @@ public void testFillOutlineColor() { validateTestSetup(); setupAnnotation(); Timber.i("fill-outline-color"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(fill); fill.setFillOutlineColor("rgba(0, 0, 0, 1)"); @@ -109,7 +110,7 @@ public void testFillOutlineColorAsInt() { validateTestSetup(); setupAnnotation(); Timber.i("fill-outline-color"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(fill); fill.setFillOutlineColor(ColorUtils.rgbaToColor("rgba(0, 0, 0, 1)")); assertEquals(fill.getFillOutlineColorAsInt(), ColorUtils.rgbaToColor("rgba(0, 0, 0, 1)")); @@ -122,7 +123,7 @@ public void testFillPattern() { validateTestSetup(); setupAnnotation(); Timber.i("fill-pattern"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(fill); fill.setFillPattern("pedestrian-polygon"); diff --git a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/LineManagerTest.java b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/LineManagerTest.java index bb193040..fb18c879 100644 --- a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/LineManagerTest.java +++ b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/LineManagerTest.java @@ -4,7 +4,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; -import com.mapbox.mapboxsdk.geometry.LatLng; +import org.maplibre.android.geometry.LatLng; import com.mapbox.mapboxsdk.plugins.testapp.activity.TestActivity; import com.mapbox.mapboxsdk.plugins.BaseActivityTest; @@ -17,7 +17,7 @@ import static com.mapbox.mapboxsdk.plugins.annotation.MapboxMapAction.invoke; import static org.junit.Assert.*; -import static com.mapbox.mapboxsdk.style.layers.Property.*; +import static org.maplibre.android.style.layers.Property.*; /** * Basic smoke tests for LineManager @@ -34,8 +34,8 @@ protected Class getActivityClass() { private void setupLineManager() { Timber.i("Retrieving layer"); - invoke(mapboxMap, (uiController, mapboxMap) -> { - lineManager = new LineManager(idlingResource.getMapView(), mapboxMap, Objects.requireNonNull(mapboxMap.getStyle())); + invoke(maplibreMap, (uiController, maplibreMap) -> { + lineManager = new LineManager(idlingResource.getMapView(), maplibreMap, Objects.requireNonNull(maplibreMap.getStyle())); }); } @@ -44,7 +44,7 @@ public void testLineCapAsConstant() { validateTestSetup(); setupLineManager(); Timber.i("line-cap"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(lineManager); lineManager.setLineCap(LINE_CAP_BUTT); @@ -57,7 +57,7 @@ public void testLineMiterLimitAsConstant() { validateTestSetup(); setupLineManager(); Timber.i("line-miter-limit"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(lineManager); lineManager.setLineMiterLimit(2.0f); @@ -70,7 +70,7 @@ public void testLineRoundLimitAsConstant() { validateTestSetup(); setupLineManager(); Timber.i("line-round-limit"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(lineManager); lineManager.setLineRoundLimit(2.0f); @@ -83,7 +83,7 @@ public void testLineTranslateAsConstant() { validateTestSetup(); setupLineManager(); Timber.i("line-translate"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(lineManager); lineManager.setLineTranslate(new Float[]{0f, 0f}); @@ -96,7 +96,7 @@ public void testLineTranslateAnchorAsConstant() { validateTestSetup(); setupLineManager(); Timber.i("line-translate-anchor"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(lineManager); lineManager.setLineTranslateAnchor(LINE_TRANSLATE_ANCHOR_MAP); @@ -109,7 +109,7 @@ public void testLineDasharrayAsConstant() { validateTestSetup(); setupLineManager(); Timber.i("line-dasharray"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(lineManager); lineManager.setLineDasharray(new Float[]{}); diff --git a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/LineTest.java b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/LineTest.java index fb2e889a..b6c5eb56 100644 --- a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/LineTest.java +++ b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/LineTest.java @@ -1,3 +1,4 @@ + // This file is generated. package com.mapbox.mapboxsdk.plugins.annotation; @@ -6,10 +7,10 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; -import com.mapbox.mapboxsdk.geometry.LatLng; +import org.maplibre.android.geometry.LatLng; import com.mapbox.mapboxsdk.plugins.BaseActivityTest; import com.mapbox.mapboxsdk.plugins.testapp.activity.TestActivity; -import com.mapbox.mapboxsdk.utils.ColorUtils; +import org.maplibre.android.utils.ColorUtils; import timber.log.Timber; @@ -20,7 +21,7 @@ import static com.mapbox.mapboxsdk.plugins.annotation.MapboxMapAction.invoke; import static org.junit.Assert.*; -import static com.mapbox.mapboxsdk.style.layers.Property.*; +import static org.maplibre.android.style.layers.Property.*; import java.util.ArrayList; import java.util.List; @@ -40,8 +41,8 @@ protected Class getActivityClass() { private void setupAnnotation() { Timber.i("Retrieving layer"); - invoke(mapboxMap, (uiController, mapboxMap) -> { - LineManager lineManager = new LineManager(idlingResource.getMapView(), mapboxMap, Objects.requireNonNull(mapboxMap.getStyle())); + invoke(maplibreMap, (uiController, maplibreMap) -> { + LineManager lineManager = new LineManager(idlingResource.getMapView(), maplibreMap, Objects.requireNonNull(maplibreMap.getStyle())); List latLngs = new ArrayList<>(); latLngs.add(new LatLng()); latLngs.add(new LatLng(1, 1)); @@ -54,7 +55,7 @@ public void testLineJoin() { validateTestSetup(); setupAnnotation(); Timber.i("line-join"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(line); line.setLineJoin(LINE_JOIN_BEVEL); @@ -67,7 +68,7 @@ public void testLineOpacity() { validateTestSetup(); setupAnnotation(); Timber.i("line-opacity"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(line); line.setLineOpacity(2.0f); @@ -80,7 +81,7 @@ public void testLineColor() { validateTestSetup(); setupAnnotation(); Timber.i("line-color"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(line); line.setLineColor("rgba(0, 0, 0, 1)"); @@ -93,7 +94,7 @@ public void testLineColorAsInt() { validateTestSetup(); setupAnnotation(); Timber.i("line-color"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(line); line.setLineColor(ColorUtils.rgbaToColor("rgba(0, 0, 0, 1)")); assertEquals(line.getLineColorAsInt(), ColorUtils.rgbaToColor("rgba(0, 0, 0, 1)")); @@ -106,7 +107,7 @@ public void testLineWidth() { validateTestSetup(); setupAnnotation(); Timber.i("line-width"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(line); line.setLineWidth(2.0f); @@ -119,7 +120,7 @@ public void testLineGapWidth() { validateTestSetup(); setupAnnotation(); Timber.i("line-gap-width"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(line); line.setLineGapWidth(2.0f); @@ -132,7 +133,7 @@ public void testLineOffset() { validateTestSetup(); setupAnnotation(); Timber.i("line-offset"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(line); line.setLineOffset(2.0f); @@ -145,7 +146,7 @@ public void testLineBlur() { validateTestSetup(); setupAnnotation(); Timber.i("line-blur"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(line); line.setLineBlur(2.0f); @@ -158,7 +159,7 @@ public void testLinePattern() { validateTestSetup(); setupAnnotation(); Timber.i("line-pattern"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(line); line.setLinePattern("pedestrian-polygon"); diff --git a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/MapboxMapAction.java b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/MapboxMapAction.java index 8ebeab18..0f02d562 100644 --- a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/MapboxMapAction.java +++ b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/MapboxMapAction.java @@ -2,12 +2,13 @@ import android.view.View; -import com.mapbox.mapboxsdk.maps.MapboxMap; +import org.maplibre.android.maps.MapLibreMap; import org.hamcrest.Matcher; import androidx.test.espresso.UiController; import androidx.test.espresso.ViewAction; +import org.maplibre.android.maps.MapLibreMap; import static androidx.test.espresso.Espresso.onView; import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; @@ -16,11 +17,11 @@ public class MapboxMapAction implements ViewAction { private OnInvokeActionListener invokeViewAction; - private MapboxMap mapboxMap; + private MapLibreMap maplibreMap; - public MapboxMapAction(OnInvokeActionListener invokeViewAction, MapboxMap mapboxMap) { + public MapboxMapAction(OnInvokeActionListener invokeViewAction, MapLibreMap maplibreMap) { this.invokeViewAction = invokeViewAction; - this.mapboxMap = mapboxMap; + this.maplibreMap = maplibreMap; } @Override @@ -35,15 +36,15 @@ public String getDescription() { @Override public void perform(UiController uiController, View view) { - invokeViewAction.onInvokeAction(uiController, mapboxMap); + invokeViewAction.onInvokeAction(uiController, maplibreMap); } - public static void invoke(MapboxMap mapboxMap, OnInvokeActionListener invokeViewAction) { - onView(withId(android.R.id.content)).perform(new MapboxMapAction(invokeViewAction, mapboxMap)); + public static void invoke(MapLibreMap maplibreMap, OnInvokeActionListener invokeViewAction) { + onView(withId(android.R.id.content)).perform(new MapboxMapAction(invokeViewAction, maplibreMap)); } public interface OnInvokeActionListener { - void onInvokeAction(UiController uiController, MapboxMap mapboxMap); + void onInvokeAction(UiController uiController, MapLibreMap maplibreMap); } } diff --git a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolManagerTest.java b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolManagerTest.java index d8c9ade4..31794324 100644 --- a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolManagerTest.java +++ b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolManagerTest.java @@ -4,7 +4,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; -import com.mapbox.mapboxsdk.geometry.LatLng; +import org.maplibre.android.geometry.LatLng; import com.mapbox.mapboxsdk.plugins.testapp.activity.TestActivity; import com.mapbox.mapboxsdk.plugins.BaseActivityTest; @@ -17,7 +17,7 @@ import static com.mapbox.mapboxsdk.plugins.annotation.MapboxMapAction.invoke; import static org.junit.Assert.*; -import static com.mapbox.mapboxsdk.style.layers.Property.*; +import static org.maplibre.android.style.layers.Property.*; /** * Basic smoke tests for SymbolManager @@ -34,8 +34,8 @@ protected Class getActivityClass() { private void setupSymbolManager() { Timber.i("Retrieving layer"); - invoke(mapboxMap, (uiController, mapboxMap) -> { - symbolManager = new SymbolManager(idlingResource.getMapView(), mapboxMap, Objects.requireNonNull(mapboxMap.getStyle())); + invoke(maplibreMap, (uiController, maplibreMap) -> { + symbolManager = new SymbolManager(idlingResource.getMapView(), maplibreMap, Objects.requireNonNull(maplibreMap.getStyle())); }); } @@ -44,7 +44,7 @@ public void testSymbolPlacementAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("symbol-placement"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setSymbolPlacement(SYMBOL_PLACEMENT_POINT); @@ -57,7 +57,7 @@ public void testSymbolSpacingAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("symbol-spacing"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setSymbolSpacing(2.0f); @@ -70,7 +70,7 @@ public void testSymbolAvoidEdgesAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("symbol-avoid-edges"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setSymbolAvoidEdges(true); @@ -83,7 +83,7 @@ public void testIconAllowOverlapAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("icon-allow-overlap"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setIconAllowOverlap(true); @@ -96,7 +96,7 @@ public void testIconIgnorePlacementAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("icon-ignore-placement"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setIconIgnorePlacement(true); @@ -109,7 +109,7 @@ public void testIconOptionalAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("icon-optional"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setIconOptional(true); @@ -122,7 +122,7 @@ public void testIconRotationAlignmentAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("icon-rotation-alignment"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setIconRotationAlignment(ICON_ROTATION_ALIGNMENT_MAP); @@ -135,7 +135,7 @@ public void testIconTextFitAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("icon-text-fit"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setIconTextFit(ICON_TEXT_FIT_NONE); @@ -148,7 +148,7 @@ public void testIconTextFitPaddingAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("icon-text-fit-padding"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setIconTextFitPadding(new Float[]{0f, 0f, 0f, 0f}); @@ -161,7 +161,7 @@ public void testIconPaddingAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("icon-padding"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setIconPadding(2.0f); @@ -174,7 +174,7 @@ public void testIconKeepUprightAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("icon-keep-upright"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setIconKeepUpright(true); @@ -187,7 +187,7 @@ public void testIconPitchAlignmentAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("icon-pitch-alignment"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setIconPitchAlignment(ICON_PITCH_ALIGNMENT_MAP); @@ -200,7 +200,7 @@ public void testTextPitchAlignmentAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("text-pitch-alignment"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setTextPitchAlignment(TEXT_PITCH_ALIGNMENT_MAP); @@ -213,7 +213,7 @@ public void testTextRotationAlignmentAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("text-rotation-alignment"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setTextRotationAlignment(TEXT_ROTATION_ALIGNMENT_MAP); @@ -226,7 +226,7 @@ public void testTextLineHeightAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("text-line-height"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setTextLineHeight(2.0f); @@ -239,7 +239,7 @@ public void testTextVariableAnchorAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("text-variable-anchor"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setTextVariableAnchor(new String[]{TEXT_ANCHOR_RIGHT, TEXT_ANCHOR_TOP}); @@ -252,7 +252,7 @@ public void testTextMaxAngleAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("text-max-angle"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setTextMaxAngle(2.0f); @@ -265,7 +265,7 @@ public void testTextPaddingAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("text-padding"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setTextPadding(2.0f); @@ -278,7 +278,7 @@ public void testTextKeepUprightAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("text-keep-upright"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setTextKeepUpright(true); @@ -291,7 +291,7 @@ public void testTextAllowOverlapAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("text-allow-overlap"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setTextAllowOverlap(true); @@ -304,7 +304,7 @@ public void testTextIgnorePlacementAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("text-ignore-placement"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setTextIgnorePlacement(true); @@ -317,7 +317,7 @@ public void testTextOptionalAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("text-optional"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setTextOptional(true); @@ -330,7 +330,7 @@ public void testIconTranslateAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("icon-translate"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setIconTranslate(new Float[]{0f, 0f}); @@ -343,7 +343,7 @@ public void testIconTranslateAnchorAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("icon-translate-anchor"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setIconTranslateAnchor(ICON_TRANSLATE_ANCHOR_MAP); @@ -356,7 +356,7 @@ public void testTextTranslateAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("text-translate"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setTextTranslate(new Float[]{0f, 0f}); @@ -369,7 +369,7 @@ public void testTextTranslateAnchorAsConstant() { validateTestSetup(); setupSymbolManager(); Timber.i("text-translate-anchor"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbolManager); symbolManager.setTextTranslateAnchor(TEXT_TRANSLATE_ANCHOR_MAP); diff --git a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolTest.java b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolTest.java index 0ec100e0..74accd4d 100644 --- a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolTest.java +++ b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolTest.java @@ -1,3 +1,4 @@ + // This file is generated. package com.mapbox.mapboxsdk.plugins.annotation; @@ -6,10 +7,10 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; -import com.mapbox.mapboxsdk.geometry.LatLng; +import org.maplibre.android.geometry.LatLng; import com.mapbox.mapboxsdk.plugins.BaseActivityTest; import com.mapbox.mapboxsdk.plugins.testapp.activity.TestActivity; -import com.mapbox.mapboxsdk.utils.ColorUtils; +import org.maplibre.android.utils.ColorUtils; import timber.log.Timber; @@ -20,7 +21,7 @@ import static com.mapbox.mapboxsdk.plugins.annotation.MapboxMapAction.invoke; import static org.junit.Assert.*; -import static com.mapbox.mapboxsdk.style.layers.Property.*; +import static org.maplibre.android.style.layers.Property.*; import java.util.ArrayList; import java.util.List; @@ -40,8 +41,8 @@ protected Class getActivityClass() { private void setupAnnotation() { Timber.i("Retrieving layer"); - invoke(mapboxMap, (uiController, mapboxMap) -> { - SymbolManager symbolManager = new SymbolManager(idlingResource.getMapView(), mapboxMap, Objects.requireNonNull(mapboxMap.getStyle())); + invoke(maplibreMap, (uiController, maplibreMap) -> { + SymbolManager symbolManager = new SymbolManager(idlingResource.getMapView(), maplibreMap, Objects.requireNonNull(maplibreMap.getStyle())); symbol = symbolManager.create(new SymbolOptions().withLatLng(new LatLng())); }); } @@ -51,7 +52,7 @@ public void testSymbolSortKey() { validateTestSetup(); setupAnnotation(); Timber.i("symbol-sort-key"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setSymbolSortKey(2.0f); @@ -64,7 +65,7 @@ public void testIconSize() { validateTestSetup(); setupAnnotation(); Timber.i("icon-size"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setIconSize(2.0f); @@ -77,7 +78,7 @@ public void testIconImage() { validateTestSetup(); setupAnnotation(); Timber.i("icon-image"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setIconImage("undefined"); @@ -90,7 +91,7 @@ public void testIconRotate() { validateTestSetup(); setupAnnotation(); Timber.i("icon-rotate"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setIconRotate(2.0f); @@ -103,7 +104,7 @@ public void testIconOffset() { validateTestSetup(); setupAnnotation(); Timber.i("icon-offset"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setIconOffset(new PointF(1.0f, 1.0f)); @@ -116,7 +117,7 @@ public void testIconAnchor() { validateTestSetup(); setupAnnotation(); Timber.i("icon-anchor"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setIconAnchor(ICON_ANCHOR_CENTER); @@ -129,7 +130,7 @@ public void testTextField() { validateTestSetup(); setupAnnotation(); Timber.i("text-field"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setTextField(""); @@ -142,7 +143,7 @@ public void testTextFont() { validateTestSetup(); setupAnnotation(); Timber.i("text-font"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setTextFont(new String[]{"Open Sans Regular", "Arial Unicode MS Regular"}); @@ -155,7 +156,7 @@ public void testTextSize() { validateTestSetup(); setupAnnotation(); Timber.i("text-size"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setTextSize(2.0f); @@ -168,7 +169,7 @@ public void testTextMaxWidth() { validateTestSetup(); setupAnnotation(); Timber.i("text-max-width"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setTextMaxWidth(2.0f); @@ -181,7 +182,7 @@ public void testTextLetterSpacing() { validateTestSetup(); setupAnnotation(); Timber.i("text-letter-spacing"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setTextLetterSpacing(2.0f); @@ -194,7 +195,7 @@ public void testTextJustify() { validateTestSetup(); setupAnnotation(); Timber.i("text-justify"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setTextJustify(TEXT_JUSTIFY_AUTO); @@ -207,7 +208,7 @@ public void testTextRadialOffset() { validateTestSetup(); setupAnnotation(); Timber.i("text-radial-offset"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setTextRadialOffset(2.0f); @@ -220,7 +221,7 @@ public void testTextAnchor() { validateTestSetup(); setupAnnotation(); Timber.i("text-anchor"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setTextAnchor(TEXT_ANCHOR_CENTER); @@ -233,7 +234,7 @@ public void testTextRotate() { validateTestSetup(); setupAnnotation(); Timber.i("text-rotate"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setTextRotate(2.0f); @@ -246,7 +247,7 @@ public void testTextTransform() { validateTestSetup(); setupAnnotation(); Timber.i("text-transform"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setTextTransform(TEXT_TRANSFORM_NONE); @@ -259,7 +260,7 @@ public void testTextOffset() { validateTestSetup(); setupAnnotation(); Timber.i("text-offset"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setTextOffset(new PointF(1.0f, 1.0f)); @@ -272,7 +273,7 @@ public void testIconOpacity() { validateTestSetup(); setupAnnotation(); Timber.i("icon-opacity"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setIconOpacity(2.0f); @@ -285,7 +286,7 @@ public void testIconColor() { validateTestSetup(); setupAnnotation(); Timber.i("icon-color"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setIconColor("rgba(0, 0, 0, 1)"); @@ -298,7 +299,7 @@ public void testIconColorAsInt() { validateTestSetup(); setupAnnotation(); Timber.i("icon-color"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setIconColor(ColorUtils.rgbaToColor("rgba(0, 0, 0, 1)")); assertEquals(symbol.getIconColorAsInt(), ColorUtils.rgbaToColor("rgba(0, 0, 0, 1)")); @@ -311,7 +312,7 @@ public void testIconHaloColor() { validateTestSetup(); setupAnnotation(); Timber.i("icon-halo-color"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setIconHaloColor("rgba(0, 0, 0, 1)"); @@ -324,7 +325,7 @@ public void testIconHaloColorAsInt() { validateTestSetup(); setupAnnotation(); Timber.i("icon-halo-color"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setIconHaloColor(ColorUtils.rgbaToColor("rgba(0, 0, 0, 1)")); assertEquals(symbol.getIconHaloColorAsInt(), ColorUtils.rgbaToColor("rgba(0, 0, 0, 1)")); @@ -337,7 +338,7 @@ public void testIconHaloWidth() { validateTestSetup(); setupAnnotation(); Timber.i("icon-halo-width"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setIconHaloWidth(2.0f); @@ -350,7 +351,7 @@ public void testIconHaloBlur() { validateTestSetup(); setupAnnotation(); Timber.i("icon-halo-blur"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setIconHaloBlur(2.0f); @@ -363,7 +364,7 @@ public void testTextOpacity() { validateTestSetup(); setupAnnotation(); Timber.i("text-opacity"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setTextOpacity(2.0f); @@ -376,7 +377,7 @@ public void testTextColor() { validateTestSetup(); setupAnnotation(); Timber.i("text-color"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setTextColor("rgba(0, 0, 0, 1)"); @@ -389,7 +390,7 @@ public void testTextColorAsInt() { validateTestSetup(); setupAnnotation(); Timber.i("text-color"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setTextColor(ColorUtils.rgbaToColor("rgba(0, 0, 0, 1)")); assertEquals(symbol.getTextColorAsInt(), ColorUtils.rgbaToColor("rgba(0, 0, 0, 1)")); @@ -402,7 +403,7 @@ public void testTextHaloColor() { validateTestSetup(); setupAnnotation(); Timber.i("text-halo-color"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setTextHaloColor("rgba(0, 0, 0, 1)"); @@ -415,7 +416,7 @@ public void testTextHaloColorAsInt() { validateTestSetup(); setupAnnotation(); Timber.i("text-halo-color"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setTextHaloColor(ColorUtils.rgbaToColor("rgba(0, 0, 0, 1)")); assertEquals(symbol.getTextHaloColorAsInt(), ColorUtils.rgbaToColor("rgba(0, 0, 0, 1)")); @@ -428,7 +429,7 @@ public void testTextHaloWidth() { validateTestSetup(); setupAnnotation(); Timber.i("text-halo-width"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setTextHaloWidth(2.0f); @@ -441,7 +442,7 @@ public void testTextHaloBlur() { validateTestSetup(); setupAnnotation(); Timber.i("text-halo-blur"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(symbol); symbol.setTextHaloBlur(2.0f); diff --git a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/scalebar/ScaleBarTest.java b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/scalebar/ScaleBarTest.java index 6ade6f99..fb5f619e 100644 --- a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/scalebar/ScaleBarTest.java +++ b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/scalebar/ScaleBarTest.java @@ -4,7 +4,6 @@ import android.app.Activity; import android.view.View; -import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.plugins.BaseActivityTest; import com.mapbox.mapboxsdk.plugins.testapp.R; import com.mapbox.mapboxsdk.plugins.testapp.activity.TestActivity; @@ -14,6 +13,7 @@ import org.junit.Test; import org.junit.runner.RunWith; +import org.maplibre.android.maps.MapView; import androidx.core.content.ContextCompat; import androidx.test.ext.junit.runners.AndroidJUnit4; @@ -42,8 +42,8 @@ protected Class getActivityClass() { private void setupScaleBar() { Timber.i("Retrieving layer"); - invoke(mapboxMap, (uiController, mapboxMap) -> { - scaleBarPlugin = new ScaleBarPlugin(idlingResource.getMapView(), mapboxMap); + invoke(maplibreMap, (uiController, maplibreMap) -> { + scaleBarPlugin = new ScaleBarPlugin(idlingResource.getMapView(), maplibreMap); activity = rule.getActivity(); scaleBarWidget = scaleBarPlugin.create(new ScaleBarOptions(activity)); assertNotNull(scaleBarPlugin); @@ -55,7 +55,7 @@ private void setupScaleBar() { public void testScaleBarEnable() { validateTestSetup(); setupScaleBar(); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertEquals(View.VISIBLE, scaleBarWidget.getVisibility()); assertTrue(scaleBarPlugin.isEnabled()); scaleBarPlugin.setEnabled(false); @@ -68,7 +68,7 @@ public void testScaleBarEnable() { public void testScaleBarColor() { validateTestSetup(); setupScaleBar(); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertEquals(ContextCompat.getColor(activity, android.R.color.black), scaleBarWidget.getTextColor()); assertEquals(ContextCompat.getColor(activity, android.R.color.black), scaleBarWidget.getPrimaryColor()); assertEquals(ContextCompat.getColor(activity, android.R.color.white), scaleBarWidget.getSecondaryColor()); @@ -94,7 +94,7 @@ public void testScaleBarColor() { public void testTextBorder() { validateTestSetup(); setupScaleBar(); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertEquals(activity.getResources().getDimension(R.dimen.mapbox_scale_bar_text_border_width), scaleBarWidget.getTextBorderWidth(), 0); assertTrue(scaleBarWidget.isShowTextBorder()); @@ -125,7 +125,7 @@ public void testTextBorder() { public void testScaleBarWidth() { validateTestSetup(); setupScaleBar(); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertEquals(MapView.class, scaleBarWidget.getParent().getClass()); MapView parent = (MapView) scaleBarWidget.getParent(); assertEquals(parent.getWidth(), scaleBarWidget.getMapViewWidth()); @@ -136,7 +136,7 @@ public void testScaleBarWidth() { public void testMargin() { validateTestSetup(); setupScaleBar(); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertEquals(activity.getResources().getDimension(R.dimen.mapbox_scale_bar_margin_left), scaleBarWidget.getMarginLeft(), 0); assertEquals(activity.getResources().getDimension(R.dimen.mapbox_scale_bar_margin_top), @@ -174,7 +174,7 @@ public void testMargin() { public void testBarHeight() { validateTestSetup(); setupScaleBar(); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertEquals(activity.getResources().getDimension(R.dimen.mapbox_scale_bar_height), scaleBarWidget.getBarHeight(), 0); @@ -198,7 +198,7 @@ public void testBarHeight() { public void testTextSize() { validateTestSetup(); setupScaleBar(); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertEquals(activity.getResources().getDimension(R.dimen.mapbox_scale_bar_text_size), scaleBarWidget.getTextSize(), 0); @@ -222,7 +222,7 @@ public void testTextSize() { public void testBorderWidth() { validateTestSetup(); setupScaleBar(); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertEquals(activity.getResources().getDimension(R.dimen.mapbox_scale_bar_border_width), scaleBarWidget.getBorderWidth(), 0); @@ -247,7 +247,7 @@ public void testBorderWidth() { public void testRefreshInterval() { validateTestSetup(); setupScaleBar(); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertEquals(ScaleBarOptions.REFRESH_INTERVAL_DEFAULT, scaleBarWidget.getRefreshInterval(), 0); ScaleBarOptions option = new ScaleBarOptions(activity); @@ -263,7 +263,7 @@ public void testRefreshInterval() { public void testMetrics() { validateTestSetup(); setupScaleBar(); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertEquals(ScaleBarOptions.LocaleUnitResolver.isMetricSystem(), scaleBarWidget.isMetricUnit()); ScaleBarOptions option = new ScaleBarOptions(activity); @@ -285,14 +285,14 @@ public void testRatio() { validateTestSetup(); setupScaleBar(); assertEquals(0.5f, scaleBarWidget.getRatio(), 0f); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { ScaleBarOptions option = new ScaleBarOptions(activity); option.setMaxWidthRatio(0.1f); scaleBarWidget = scaleBarPlugin.create(option); assertNotNull(scaleBarWidget); assertEquals(0.1f, scaleBarWidget.getRatio(), 0f); }); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { ScaleBarOptions option = new ScaleBarOptions(activity); option.setMaxWidthRatio(1.0f); scaleBarWidget = scaleBarPlugin.create(option); diff --git a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/utils/OnMapReadyIdlingResource.java b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/utils/OnMapReadyIdlingResource.java index 6a9a6f23..6a6dac3b 100644 --- a/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/utils/OnMapReadyIdlingResource.java +++ b/app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/utils/OnMapReadyIdlingResource.java @@ -4,18 +4,19 @@ import android.os.Handler; import android.os.Looper; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; -import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.plugins.testapp.R; import androidx.annotation.NonNull; import androidx.test.espresso.IdlingResource; +import org.maplibre.android.maps.MapLibreMap; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.OnMapReadyCallback; +import org.maplibre.android.maps.Style; + public class OnMapReadyIdlingResource implements IdlingResource, OnMapReadyCallback { - private MapboxMap mapboxMap; + private MapLibreMap mapLibreMap; private MapView mapView; private IdlingResource.ResourceCallback resourceCallback; @@ -35,7 +36,7 @@ public String getName() { @Override public boolean isIdleNow() { - return mapboxMap != null && mapboxMap.getStyle() != null && mapboxMap.getStyle().isFullyLoaded(); + return mapLibreMap != null && mapLibreMap.getStyle() != null && mapLibreMap.getStyle().isFullyLoaded(); } @Override @@ -47,14 +48,14 @@ public MapView getMapView() { return mapView; } - public MapboxMap getMapboxMap() { - return mapboxMap; + public MapLibreMap getMapLibreMap() { + return mapLibreMap; } @Override - public void onMapReady(@NonNull MapboxMap mapboxMap) { - this.mapboxMap = mapboxMap; - mapboxMap.setStyle(Style.getPredefinedStyle("Streets"), style -> { + public void onMapReady(@NonNull MapLibreMap mapLibreMap) { + this.mapLibreMap = mapLibreMap; + mapLibreMap.setStyle(Style.getPredefinedStyle("Streets"), style -> { if (resourceCallback != null) { resourceCallback.onTransitionToIdle(); } diff --git a/app/src/debug/java/com/mapbox/mapboxsdk/plugins/testapp/activity/TestActivity.kt b/app/src/debug/java/com/mapbox/mapboxsdk/plugins/testapp/activity/TestActivity.kt index 9fff25ec..19657f43 100644 --- a/app/src/debug/java/com/mapbox/mapboxsdk/plugins/testapp/activity/TestActivity.kt +++ b/app/src/debug/java/com/mapbox/mapboxsdk/plugins/testapp/activity/TestActivity.kt @@ -2,8 +2,8 @@ package com.mapbox.mapboxsdk.plugins.testapp.activity import android.os.Bundle import androidx.appcompat.app.AppCompatActivity -import com.mapbox.mapboxsdk.maps.MapView import com.mapbox.mapboxsdk.plugins.testapp.R +import org.maplibre.android.maps.MapView class TestActivity : AppCompatActivity() { diff --git a/app/src/debug/res/layout/activity_test.xml b/app/src/debug/res/layout/activity_test.xml index f0f8818b..eca34e5b 100644 --- a/app/src/debug/res/layout/activity_test.xml +++ b/app/src/debug/res/layout/activity_test.xml @@ -5,7 +5,7 @@ android:layout_height="match_parent" tools:context=".activity.TestActivity"> - diff --git a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/PluginApplication.kt b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/PluginApplication.kt index 301ab570..8cad90a7 100644 --- a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/PluginApplication.kt +++ b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/PluginApplication.kt @@ -1,8 +1,8 @@ package com.mapbox.mapboxsdk.plugins.testapp import android.app.Application -import com.mapbox.mapboxsdk.Mapbox import com.squareup.leakcanary.LeakCanary +import org.maplibre.android.MapLibre import timber.log.Timber class PluginApplication : Application() { @@ -15,7 +15,7 @@ class PluginApplication : Application() { LeakCanary.install(this) initializeLogger() - Mapbox.getInstance(this) + MapLibre.getInstance(this) } private fun initializeLogger() { diff --git a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/Utils.kt b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/Utils.kt index f854a32e..6bf52ef9 100644 --- a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/Utils.kt +++ b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/Utils.kt @@ -3,7 +3,7 @@ package com.mapbox.mapboxsdk.plugins.testapp import android.content.Context import android.location.Location import com.mapbox.core.utils.TextUtils -import com.mapbox.mapboxsdk.maps.Style +import org.maplibre.android.maps.Style import timber.log.Timber import java.io.BufferedReader import java.io.IOException diff --git a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/BulkSymbolActivity.java b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/BulkSymbolActivity.java index 4f4f70ae..1afca133 100644 --- a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/BulkSymbolActivity.java +++ b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/BulkSymbolActivity.java @@ -15,16 +15,6 @@ import android.widget.ArrayAdapter; import android.widget.Spinner; -import com.mapbox.geojson.Feature; -import com.mapbox.geojson.FeatureCollection; -import com.mapbox.geojson.Point; -import com.mapbox.mapboxsdk.Mapbox; -import com.mapbox.mapboxsdk.WellKnownTileServer; -import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -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; @@ -32,6 +22,17 @@ import com.mapbox.mapboxsdk.plugins.testapp.R; import com.mapbox.mapboxsdk.plugins.testapp.Utils; +import org.maplibre.android.MapLibre; +import org.maplibre.android.WellKnownTileServer; +import org.maplibre.android.camera.CameraUpdateFactory; +import org.maplibre.android.geometry.LatLng; +import org.maplibre.android.maps.MapLibreMap; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.Style; +import org.maplibre.geojson.Feature; +import org.maplibre.geojson.FeatureCollection; +import org.maplibre.geojson.Point; + import timber.log.Timber; import java.io.*; @@ -51,7 +52,7 @@ public class BulkSymbolActivity extends AppCompatActivity implements AdapterView private SymbolManager symbolManager; private List symbols = new ArrayList<>(); - private MapboxMap mapboxMap; + private MapLibreMap mapLibreMap; private MapView mapView; private FeatureCollection locations; private ProgressDialog progressDialog; @@ -60,26 +61,26 @@ public class BulkSymbolActivity extends AppCompatActivity implements AdapterView protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_annotation); - Mapbox.getInstance(this, BuildConfig.MAPTILER_API_KEY, WellKnownTileServer.MapTiler); + MapLibre.getInstance(this, BuildConfig.MAPTILER_API_KEY, WellKnownTileServer.MapTiler); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(this::initMap); } - private void initMap(MapboxMap mapboxMap) { - this.mapboxMap = mapboxMap; - mapboxMap.moveCamera( + private void initMap(MapLibreMap mapLibreMap) { + this.mapLibreMap = mapLibreMap; + mapLibreMap.moveCamera( CameraUpdateFactory.newLatLngZoom( new LatLng(38.87031, -77.00897), 10 ) ); - mapboxMap.setStyle(new Style.Builder() + mapLibreMap.setStyle(new Style.Builder() .fromUri(Style.getPredefinedStyle("Streets")) .withImage(IMAGE_ID_FIRE_HYDRANT, getDrawable(R.drawable.ic_fire_hydrant)), style -> { - findViewById(R.id.fabStyles).setOnClickListener(v -> mapboxMap.setStyle(Utils.INSTANCE.getNextStyle())); - symbolManager = new SymbolManager(mapView, mapboxMap, style); + findViewById(R.id.fabStyles).setOnClickListener(v -> mapLibreMap.setStyle(Utils.INSTANCE.getNextStyle())); + symbolManager = new SymbolManager(mapView, mapLibreMap, style); symbolManager.setIconAllowOverlap(true); loadData(0); }); @@ -101,7 +102,7 @@ public boolean onCreateOptionsMenu(Menu menu) { @Override public void onItemSelected(AdapterView parent, View view, int position, long id) { - if (mapboxMap.getStyle() == null || !mapboxMap.getStyle().isFullyLoaded()) { + if (mapLibreMap.getStyle() == null || !mapLibreMap.getStyle().isFullyLoaded()) { return; } @@ -131,7 +132,7 @@ private void onLatLngListLoaded(FeatureCollection featureCollection, int amount) private void showMarkers(int amount) { Timber.i("Showing markers"); - if (mapboxMap == null || locations == null || locations.features() == null || mapView.isDestroyed()) { + if (mapLibreMap == null || locations == null || locations.features() == null || mapView.isDestroyed()) { Timber.i("Not showing markers"); return; } diff --git a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/CircleActivity.java b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/CircleActivity.java index b6874f3b..4075f49f 100644 --- a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/CircleActivity.java +++ b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/CircleActivity.java @@ -8,17 +8,12 @@ import android.widget.TextView; import android.widget.Toast; -import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.plugins.annotation.Circle; import com.mapbox.mapboxsdk.plugins.annotation.CircleManager; import com.mapbox.mapboxsdk.plugins.annotation.CircleOptions; import com.mapbox.mapboxsdk.plugins.annotation.OnCircleDragListener; import com.mapbox.mapboxsdk.plugins.testapp.R; import com.mapbox.mapboxsdk.plugins.testapp.Utils; -import com.mapbox.mapboxsdk.utils.ColorUtils; import java.io.IOException; import java.util.ArrayList; @@ -28,6 +23,12 @@ import androidx.appcompat.app.AppCompatActivity; +import org.maplibre.android.camera.CameraUpdateFactory; +import org.maplibre.android.geometry.LatLng; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.Style; +import org.maplibre.android.utils.ColorUtils; + /** * Activity showcasing adding circles using the annotation plugin */ @@ -47,13 +48,13 @@ protected void onCreate(Bundle savedInstanceState) { mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(mapboxMap -> mapboxMap.setStyle(Style.getPredefinedStyle("Streets"), style -> { - findViewById(R.id.fabStyles).setOnClickListener(v -> mapboxMap.setStyle(Utils.INSTANCE.getNextStyle())); + mapView.getMapAsync(maplibreMap -> maplibreMap.setStyle(Style.getPredefinedStyle("Streets"), style -> { + findViewById(R.id.fabStyles).setOnClickListener(v -> maplibreMap.setStyle(Utils.INSTANCE.getNextStyle())); - mapboxMap.moveCamera(CameraUpdateFactory.zoomTo(2)); + maplibreMap.moveCamera(CameraUpdateFactory.zoomTo(2)); // create circle manager - circleManager = new CircleManager(mapView, mapboxMap, style); + circleManager = new CircleManager(mapView, maplibreMap, style); circleManager.addClickListener(circle -> { Toast.makeText(CircleActivity.this, String.format("Circle clicked %s", circle.getId()), diff --git a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/ClusterSymbolActivity.java b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/ClusterSymbolActivity.java index 7a1402ed..e66ca71f 100644 --- a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/ClusterSymbolActivity.java +++ b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/ClusterSymbolActivity.java @@ -8,20 +8,21 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.core.util.Pair; -import com.mapbox.geojson.Feature; -import com.mapbox.geojson.FeatureCollection; -import com.mapbox.geojson.Point; -import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.plugins.annotation.ClusterOptions; 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.plugins.testapp.R; +import org.maplibre.android.camera.CameraUpdateFactory; +import org.maplibre.android.geometry.LatLng; +import org.maplibre.android.maps.MapLibreMap; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.Style; +import org.maplibre.geojson.Feature; +import org.maplibre.geojson.FeatureCollection; +import org.maplibre.geojson.Point; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -43,7 +44,7 @@ public class ClusterSymbolActivity extends AppCompatActivity { private SymbolManager symbolManager; private List symbols = new ArrayList<>(); - private MapboxMap mapboxMap; + private MapLibreMap maplibreMap; private MapView mapView; private FeatureCollection locations; @@ -57,9 +58,9 @@ protected void onCreate(Bundle savedInstanceState) { mapView.getMapAsync(this::initMap); } - private void initMap(MapboxMap mapboxMap) { - this.mapboxMap = mapboxMap; - mapboxMap.moveCamera( + private void initMap(MapLibreMap maplibreMap) { + this.maplibreMap = maplibreMap; + maplibreMap.moveCamera( CameraUpdateFactory.newLatLngZoom( new LatLng(38.87031, -77.00897), 10 ) @@ -72,8 +73,8 @@ private void initMap(MapboxMap mapboxMap) { new Pair(0, Color.GREEN) }); - mapboxMap.setStyle(new Style.Builder().fromUri(Style.getPredefinedStyle("Streets")), style -> { - symbolManager = new SymbolManager(mapView, mapboxMap, style, null, null, clusterOptions); + maplibreMap.setStyle(new Style.Builder().fromUri(Style.getPredefinedStyle("Streets")), style -> { + symbolManager = new SymbolManager(mapView, maplibreMap, style, null, null, clusterOptions); symbolManager.setIconAllowOverlap(true); loadData(); }); @@ -94,7 +95,7 @@ private void onLatLngListLoaded(FeatureCollection featureCollection, int amount) } private void showMarkers(int amount) { - if (mapboxMap == null || locations == null || locations.features() == null || mapView.isDestroyed()) { + if (maplibreMap == null || locations == null || locations.features() == null || mapView.isDestroyed()) { return; } // delete old symbols diff --git a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/DynamicSymbolChangeActivity.java b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/DynamicSymbolChangeActivity.java index 6cc50dea..a1b4daf8 100644 --- a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/DynamicSymbolChangeActivity.java +++ b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/DynamicSymbolChangeActivity.java @@ -7,12 +7,6 @@ import android.os.Bundle; import com.google.android.material.floatingactionbutton.FloatingActionButton; -import com.mapbox.mapboxsdk.camera.CameraPosition; -import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -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; @@ -21,6 +15,13 @@ import androidx.annotation.DrawableRes; import androidx.appcompat.app.AppCompatActivity; +import org.maplibre.android.camera.CameraPosition; +import org.maplibre.android.camera.CameraUpdateFactory; +import org.maplibre.android.geometry.LatLng; +import org.maplibre.android.maps.MapLibreMap; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.Style; + /** * Test activity showcasing updating a Marker position, title, icon and snippet. */ @@ -34,7 +35,7 @@ public class DynamicSymbolChangeActivity extends AppCompatActivity { private SymbolManager symbolManager; private MapView mapView; - private MapboxMap mapboxMap; + private MapLibreMap maplibreMap; private Symbol symbol; @Override @@ -45,12 +46,12 @@ protected void onCreate(Bundle savedInstanceState) { mapView = findViewById(R.id.mapView); mapView.setTag(false); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(mapboxMap -> { - DynamicSymbolChangeActivity.this.mapboxMap = mapboxMap; + mapView.getMapAsync(maplibreMap -> { + DynamicSymbolChangeActivity.this.maplibreMap = maplibreMap; LatLng target = new LatLng(51.506675, -0.128699); - mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition( + maplibreMap.moveCamera(CameraUpdateFactory.newCameraPosition( new CameraPosition.Builder() .bearing(90) .tilt(40) @@ -59,12 +60,12 @@ protected void onCreate(Bundle savedInstanceState) { .build() )); - mapboxMap.setStyle(new Style.Builder() + maplibreMap.setStyle(new Style.Builder() .fromUri(Style.getPredefinedStyle("Streets")) //.withImage(ID_ICON_1, generateBitmap(R.drawable.mapbox_ic_place), true) //.withImage(ID_ICON_2, generateBitmap(R.drawable.mapbox_ic_offline), true) , style -> { - symbolManager = new SymbolManager(mapView, mapboxMap, style); + symbolManager = new SymbolManager(mapView, maplibreMap, style); symbolManager.setIconAllowOverlap(true); symbolManager.setTextAllowOverlap(true); @@ -82,7 +83,7 @@ protected void onCreate(Bundle savedInstanceState) { FloatingActionButton fab = findViewById(R.id.fabStyles); fab.setVisibility(MapView.VISIBLE); fab.setOnClickListener(view -> { - if (mapboxMap != null) { + if (maplibreMap != null) { updateSymbol(); } }); diff --git a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/FillActivity.java b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/FillActivity.java index 58425752..f4ea8dd4 100644 --- a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/FillActivity.java +++ b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/FillActivity.java @@ -8,17 +8,11 @@ import com.google.gson.JsonElement; import com.google.gson.JsonPrimitive; -import com.mapbox.geojson.FeatureCollection; -import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.plugins.annotation.Fill; import com.mapbox.mapboxsdk.plugins.annotation.FillManager; import com.mapbox.mapboxsdk.plugins.annotation.FillOptions; import com.mapbox.mapboxsdk.plugins.testapp.R; import com.mapbox.mapboxsdk.plugins.testapp.Utils; -import com.mapbox.mapboxsdk.utils.ColorUtils; import java.io.IOException; import java.util.ArrayList; @@ -27,6 +21,13 @@ import androidx.appcompat.app.AppCompatActivity; +import org.maplibre.android.camera.CameraUpdateFactory; +import org.maplibre.android.geometry.LatLng; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.Style; +import org.maplibre.android.utils.ColorUtils; +import org.maplibre.geojson.FeatureCollection; + /** * Activity showcasing adding fills using the annotation plugin */ @@ -43,12 +44,12 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_annotation); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(mapboxMap -> mapboxMap.setStyle(Style.getPredefinedStyle("Streets"), style -> { - findViewById(R.id.fabStyles).setOnClickListener(v -> mapboxMap.setStyle(Utils.INSTANCE.getNextStyle())); + mapView.getMapAsync(maplibreMap -> maplibreMap.setStyle(Style.getPredefinedStyle("Streets"), style -> { + findViewById(R.id.fabStyles).setOnClickListener(v -> maplibreMap.setStyle(Utils.INSTANCE.getNextStyle())); - mapboxMap.moveCamera(CameraUpdateFactory.zoomTo(2)); + maplibreMap.moveCamera(CameraUpdateFactory.zoomTo(2)); - fillManager = new FillManager(mapView, mapboxMap, style); + fillManager = new FillManager(mapView, maplibreMap, style); fillManager.addClickListener(fill -> { Toast.makeText(FillActivity.this, String.format("Fill clicked %s with title: %s", fill.getId(), getTitleFromFill(fill)), diff --git a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/FillChangeActivity.java b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/FillChangeActivity.java index 989f3432..05d8b6bb 100644 --- a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/FillChangeActivity.java +++ b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/FillChangeActivity.java @@ -6,18 +6,10 @@ import android.view.MenuItem; import android.widget.Toast; -import com.mapbox.mapboxsdk.camera.CameraPosition; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.MapboxMapOptions; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; -import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.plugins.annotation.Fill; import com.mapbox.mapboxsdk.plugins.annotation.FillManager; import com.mapbox.mapboxsdk.plugins.annotation.FillOptions; import com.mapbox.mapboxsdk.plugins.testapp.R; -import com.mapbox.mapboxsdk.utils.ColorUtils; import java.util.ArrayList; import java.util.List; @@ -34,6 +26,15 @@ import static com.mapbox.mapboxsdk.plugins.testapp.activity.annotation.FillChangeActivity.Config.STAR_SHAPE_HOLES; import static com.mapbox.mapboxsdk.plugins.testapp.activity.annotation.FillChangeActivity.Config.STAR_SHAPE_POINTS; +import org.maplibre.android.camera.CameraPosition; +import org.maplibre.android.geometry.LatLng; +import org.maplibre.android.maps.MapLibreMap; +import org.maplibre.android.maps.MapLibreMapOptions; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.OnMapReadyCallback; +import org.maplibre.android.maps.Style; +import org.maplibre.android.utils.ColorUtils; + /** * Test activity to showcase the Polygon annotation API & programmatically creating a MapView. *

@@ -58,7 +59,7 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // configure initial map state - MapboxMapOptions options = new MapboxMapOptions() + MapLibreMapOptions options = new MapLibreMapOptions() .attributionTintColor(RED_COLOR) .compassFadesWhenFacingNorth(false) .camera(new CameraPosition.Builder() @@ -77,7 +78,7 @@ protected void onCreate(Bundle savedInstanceState) { } @Override - public void onMapReady(@NonNull MapboxMap map) { + public void onMapReady(@NonNull MapLibreMap map) { map.setStyle(new Style.Builder().fromUri(Style.getPredefinedStyle("Streets")), style -> { fillManager = new FillManager(mapView, map, style, "aerialway", null); fillManager.addClickListener(fill -> { diff --git a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/LineActivity.java b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/LineActivity.java index b2661374..dfb732c8 100644 --- a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/LineActivity.java +++ b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/LineActivity.java @@ -6,16 +6,11 @@ import android.view.MenuItem; import android.widget.Toast; -import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.plugins.annotation.Line; import com.mapbox.mapboxsdk.plugins.annotation.LineManager; import com.mapbox.mapboxsdk.plugins.annotation.LineOptions; import com.mapbox.mapboxsdk.plugins.testapp.R; import com.mapbox.mapboxsdk.plugins.testapp.Utils; -import com.mapbox.mapboxsdk.utils.ColorUtils; import java.io.IOException; import java.util.ArrayList; @@ -24,6 +19,12 @@ import androidx.appcompat.app.AppCompatActivity; +import org.maplibre.android.camera.CameraUpdateFactory; +import org.maplibre.android.geometry.LatLng; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.Style; +import org.maplibre.android.utils.ColorUtils; + /** * Activity showcasing adding lines using the annotation plugin */ @@ -40,12 +41,12 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_annotation); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(mapboxMap -> mapboxMap.setStyle(Style.getPredefinedStyle("Streets"), style -> { - findViewById(R.id.fabStyles).setOnClickListener(v -> mapboxMap.setStyle(Utils.INSTANCE.getNextStyle())); + mapView.getMapAsync(maplibreMap -> maplibreMap.setStyle(Style.getPredefinedStyle("Streets"), style -> { + findViewById(R.id.fabStyles).setOnClickListener(v -> maplibreMap.setStyle(Utils.INSTANCE.getNextStyle())); - mapboxMap.moveCamera(CameraUpdateFactory.zoomTo(2)); + maplibreMap.moveCamera(CameraUpdateFactory.zoomTo(2)); - lineManager = new LineManager(mapView, mapboxMap, style); + lineManager = new LineManager(mapView, maplibreMap, style); lineManager.addClickListener(line -> { Toast.makeText(LineActivity.this, String.format("Line clicked %s", line.getId()), diff --git a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/LineChangeActivity.java b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/LineChangeActivity.java index 4a1aadd9..9fb8380e 100644 --- a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/LineChangeActivity.java +++ b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/LineChangeActivity.java @@ -7,18 +7,11 @@ import android.view.View; import android.widget.Toast; -import com.mapbox.geojson.LineString; -import com.mapbox.geojson.Point; -import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.plugins.annotation.Line; import com.mapbox.mapboxsdk.plugins.annotation.LineManager; import com.mapbox.mapboxsdk.plugins.annotation.LineOptions; import com.mapbox.mapboxsdk.plugins.testapp.R; import com.mapbox.mapboxsdk.plugins.testapp.Utils; -import com.mapbox.mapboxsdk.utils.ColorUtils; import java.util.ArrayList; import java.util.Collections; @@ -26,6 +19,14 @@ import androidx.appcompat.app.AppCompatActivity; +import org.maplibre.android.camera.CameraUpdateFactory; +import org.maplibre.android.geometry.LatLng; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.Style; +import org.maplibre.android.utils.ColorUtils; +import org.maplibre.geojson.LineString; +import org.maplibre.geojson.Point; + /** * Test activity showcasing the Polyline annotations API. *

@@ -62,17 +63,17 @@ protected void onCreate(Bundle savedInstanceState) { mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(mapboxMap -> { - mapboxMap.moveCamera( + mapView.getMapAsync(maplibreMap -> { + maplibreMap.moveCamera( CameraUpdateFactory.newLatLngZoom( new LatLng(47.798202, 7.573781), 4) ); - mapboxMap.setStyle(new Style.Builder().fromUri(Style.getPredefinedStyle("Streets")), style -> { - findViewById(R.id.fabStyles).setOnClickListener(v -> mapboxMap.setStyle(Utils.INSTANCE.getNextStyle())); + maplibreMap.setStyle(new Style.Builder().fromUri(Style.getPredefinedStyle("Streets")), style -> { + findViewById(R.id.fabStyles).setOnClickListener(v -> maplibreMap.setStyle(Utils.INSTANCE.getNextStyle())); - lineManager = new LineManager(mapView, mapboxMap, style); + lineManager = new LineManager(mapView, maplibreMap, style); lines = lineManager.create(getAllPolylines()); lineManager.addClickListener(line -> { Toast.makeText( @@ -82,7 +83,7 @@ protected void onCreate(Bundle savedInstanceState) { return false; }); - LineManager dottedLineManger = new LineManager(mapView, mapboxMap, style); + LineManager dottedLineManger = new LineManager(mapView, maplibreMap, style); dottedLineManger.create(new LineOptions() .withLinePattern("airfield-11") .withLineWidth(5.0f) diff --git a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/PressForSymbolActivity.java b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/PressForSymbolActivity.java index cb390ab7..b8dbd0c9 100644 --- a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/PressForSymbolActivity.java +++ b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/PressForSymbolActivity.java @@ -1,21 +1,17 @@ package com.mapbox.mapboxsdk.plugins.testapp.activity.annotation; +import static org.maplibre.android.style.layers.Property.ICON_ANCHOR_BOTTOM; + import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Bundle; -import com.mapbox.mapboxsdk.camera.CameraPosition; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.plugins.annotation.SymbolManager; import com.mapbox.mapboxsdk.plugins.annotation.SymbolOptions; import com.mapbox.mapboxsdk.plugins.testapp.R; import com.mapbox.mapboxsdk.plugins.testapp.Utils; -import com.mapbox.mapboxsdk.style.layers.Property; import androidx.annotation.DrawableRes; import androidx.annotation.NonNull; @@ -23,7 +19,11 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; -import static com.mapbox.mapboxsdk.style.layers.Property.ICON_ANCHOR_BOTTOM; +import org.maplibre.android.camera.CameraPosition; +import org.maplibre.android.geometry.LatLng; +import org.maplibre.android.maps.MapLibreMap; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.Style; /** * Test activity showcasing to add a Symbol on click. @@ -36,7 +36,7 @@ public class PressForSymbolActivity extends AppCompatActivity { public static final String ID_ICON = "id-icon"; private SymbolManager symbolManager; private MapView mapView; - private MapboxMap mapboxMap; + private MapLibreMap maplibreMap; @Override protected void onCreate(@Nullable final Bundle savedInstanceState) { @@ -46,21 +46,21 @@ protected void onCreate(@Nullable final Bundle savedInstanceState) { mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(map -> { - mapboxMap = map; - mapboxMap.setCameraPosition(new CameraPosition.Builder() + maplibreMap = map; + maplibreMap.setCameraPosition(new CameraPosition.Builder() .target(new LatLng(60.169091, 24.939876)) .zoom(12) .tilt(20) .bearing(90) .build() ); - mapboxMap.addOnMapLongClickListener(this::addSymbol); - mapboxMap.addOnMapClickListener(this::addSymbol); - mapboxMap.setStyle(getStyleBuilder(Style.getPredefinedStyle("Streets")), style -> { + maplibreMap.addOnMapLongClickListener(this::addSymbol); + maplibreMap.addOnMapClickListener(this::addSymbol); + maplibreMap.setStyle(getStyleBuilder(Style.getPredefinedStyle("Streets")), style -> { findViewById(R.id.fabStyles).setOnClickListener(v -> - mapboxMap.setStyle(getStyleBuilder(Utils.INSTANCE.getNextStyle()))); + maplibreMap.setStyle(getStyleBuilder(Utils.INSTANCE.getNextStyle()))); - symbolManager = new SymbolManager(mapView, mapboxMap, style); + symbolManager = new SymbolManager(mapView, maplibreMap, style); symbolManager.setIconAllowOverlap(true); symbolManager.setTextAllowOverlap(true); }); @@ -118,8 +118,8 @@ protected void onStop() { @Override protected void onDestroy() { super.onDestroy(); - mapboxMap.removeOnMapClickListener(this::addSymbol); - mapboxMap.removeOnMapLongClickListener(this::addSymbol); + maplibreMap.removeOnMapClickListener(this::addSymbol); + maplibreMap.removeOnMapLongClickListener(this::addSymbol); if (symbolManager != null) { symbolManager.onDestroy(); diff --git a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/SymbolActivity.java b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/SymbolActivity.java index b81031b0..c449f90a 100644 --- a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/SymbolActivity.java +++ b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/annotation/SymbolActivity.java @@ -1,5 +1,10 @@ package com.mapbox.mapboxsdk.plugins.testapp.activity.annotation; +import static org.maplibre.android.style.expressions.Expression.eq; +import static org.maplibre.android.style.expressions.Expression.get; +import static org.maplibre.android.style.expressions.Expression.not; +import static org.maplibre.android.style.expressions.Expression.toNumber; + import android.animation.ValueAnimator; import android.graphics.Color; import android.graphics.PointF; @@ -11,23 +16,12 @@ import android.widget.TextView; import android.widget.Toast; -import com.mapbox.geojson.FeatureCollection; -import com.mapbox.geojson.Point; -import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.plugins.annotation.OnSymbolDragListener; 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.plugins.testapp.R; import com.mapbox.mapboxsdk.plugins.testapp.Utils; -import com.mapbox.mapboxsdk.style.expressions.Expression; -import com.mapbox.mapboxsdk.style.layers.Property; -import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; -import com.mapbox.mapboxsdk.utils.BitmapUtils; -import com.mapbox.mapboxsdk.utils.ColorUtils; import java.io.IOException; import java.util.ArrayList; @@ -37,12 +31,19 @@ import androidx.appcompat.app.AppCompatActivity; -import timber.log.Timber; +import org.maplibre.android.camera.CameraUpdateFactory; +import org.maplibre.android.geometry.LatLng; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.Style; +import org.maplibre.android.style.expressions.Expression; +import org.maplibre.android.style.layers.Property; +import org.maplibre.android.style.sources.GeoJsonOptions; +import org.maplibre.android.utils.BitmapUtils; +import org.maplibre.android.utils.ColorUtils; +import org.maplibre.geojson.FeatureCollection; +import org.maplibre.geojson.Point; -import static com.mapbox.mapboxsdk.style.expressions.Expression.eq; -import static com.mapbox.mapboxsdk.style.expressions.Expression.get; -import static com.mapbox.mapboxsdk.style.expressions.Expression.not; -import static com.mapbox.mapboxsdk.style.expressions.Expression.toNumber; +import timber.log.Timber; /** * Activity showcasing adding symbols using the annotation plugin @@ -70,19 +71,19 @@ protected void onCreate(Bundle savedInstanceState) { mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(mapboxMap -> mapboxMap.setStyle(Style.getPredefinedStyle("Streets"), style -> { + mapView.getMapAsync(maplibreMap -> maplibreMap.setStyle(Style.getPredefinedStyle("Streets"), style -> { findViewById(R.id.fabStyles).setOnClickListener(v -> { - mapboxMap.setStyle(Utils.INSTANCE.getNextStyle()); - mapboxMap.getStyle(this::addAirplaneImageToStyle); + maplibreMap.setStyle(Utils.INSTANCE.getNextStyle()); + maplibreMap.getStyle(this::addAirplaneImageToStyle); }); - mapboxMap.moveCamera(CameraUpdateFactory.zoomTo(2)); + maplibreMap.moveCamera(CameraUpdateFactory.zoomTo(2)); addAirplaneImageToStyle(style); // create symbol manager GeoJsonOptions geoJsonOptions = new GeoJsonOptions().withTolerance(0.4f); - symbolManager = new SymbolManager(mapView, mapboxMap, style, null, null, geoJsonOptions); + symbolManager = new SymbolManager(mapView, maplibreMap, style, null, null, geoJsonOptions); symbolManager.addClickListener(symbol -> { Toast.makeText(SymbolActivity.this, String.format("Symbol clicked %s", symbol.getId()), diff --git a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/ktx/maps/MapboxKtxActivity.kt b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/ktx/maps/MapboxKtxActivity.kt index c0ea6de3..cd493d1c 100644 --- a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/ktx/maps/MapboxKtxActivity.kt +++ b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/ktx/maps/MapboxKtxActivity.kt @@ -3,17 +3,17 @@ package com.mapbox.mapboxsdk.plugins.testapp.activity.ktx.maps import android.os.Bundle import android.widget.Toast import androidx.appcompat.app.AppCompatActivity -import com.mapbox.mapboxsdk.geometry.LatLng -import com.mapbox.mapboxsdk.maps.MapView -import com.mapbox.mapboxsdk.maps.MapboxMap -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback -import com.mapbox.mapboxsdk.maps.Style import com.mapbox.mapboxsdk.plugins.maps.queryRenderedFeatures import com.mapbox.mapboxsdk.plugins.testapp.databinding.ActivityMapsKtxBinding +import org.maplibre.android.geometry.LatLng +import org.maplibre.android.maps.MapLibreMap +import org.maplibre.android.maps.MapView +import org.maplibre.android.maps.OnMapReadyCallback +import org.maplibre.android.maps.Style -class MapboxKtxActivity : AppCompatActivity(), OnMapReadyCallback, MapboxMap.OnMapClickListener { +class MapboxKtxActivity : AppCompatActivity(), OnMapReadyCallback, MapLibreMap.OnMapClickListener { - private var mapboxMap: MapboxMap? = null + private var maplibreMap: MapLibreMap? = null private lateinit var binding: ActivityMapsKtxBinding private lateinit var mapView: MapView @@ -28,16 +28,16 @@ class MapboxKtxActivity : AppCompatActivity(), OnMapReadyCallback, MapboxMap.OnM mapView.getMapAsync(this) } - override fun onMapReady(mapboxMap: MapboxMap) { - this.mapboxMap = mapboxMap - mapboxMap.setStyle(Style.getPredefinedStyle("Streets")) { - mapboxMap.addOnMapClickListener(this) + override fun onMapReady(maplibreMap: MapLibreMap) { + this.maplibreMap = maplibreMap + maplibreMap.setStyle(Style.getPredefinedStyle("Streets")) { + maplibreMap.addOnMapClickListener(this) Toast.makeText(this, "Click on the map", Toast.LENGTH_SHORT).show() } } override fun onMapClick(point: LatLng): Boolean { - val features = mapboxMap?.queryRenderedFeatures(point) + val features = maplibreMap?.queryRenderedFeatures(point) features?.first().let { Toast.makeText(this, it.toString(), Toast.LENGTH_SHORT).show() } @@ -71,7 +71,7 @@ class MapboxKtxActivity : AppCompatActivity(), OnMapReadyCallback, MapboxMap.OnM override fun onDestroy() { super.onDestroy() - mapboxMap?.removeOnMapClickListener(this) + maplibreMap?.removeOnMapClickListener(this) mapView.onDestroy() } diff --git a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/localization/LocalizationActivity.kt b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/localization/LocalizationActivity.kt index 6809ec00..ded59edc 100644 --- a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/localization/LocalizationActivity.kt +++ b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/localization/LocalizationActivity.kt @@ -6,20 +6,20 @@ import android.view.MenuItem import android.view.View import android.widget.Toast import androidx.appcompat.app.AppCompatActivity -import com.mapbox.mapboxsdk.maps.MapView -import com.mapbox.mapboxsdk.maps.MapboxMap -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback -import com.mapbox.mapboxsdk.maps.Style import com.mapbox.mapboxsdk.plugins.localization.LocalizationPlugin import com.mapbox.mapboxsdk.plugins.localization.MapLocale import com.mapbox.mapboxsdk.plugins.testapp.R import com.mapbox.mapboxsdk.plugins.testapp.Utils import com.mapbox.mapboxsdk.plugins.testapp.databinding.ActivityLocalizationBinding +import org.maplibre.android.maps.MapLibreMap +import org.maplibre.android.maps.MapView +import org.maplibre.android.maps.OnMapReadyCallback +import org.maplibre.android.maps.Style class LocalizationActivity : AppCompatActivity(), OnMapReadyCallback { private var localizationPlugin: LocalizationPlugin? = null - private var mapboxMap: MapboxMap? = null + private var maplibreMap: MapLibreMap? = null private var mapIsLocalized: Boolean = false private lateinit var mapView: MapView private lateinit var binding: ActivityLocalizationBinding @@ -34,11 +34,11 @@ class LocalizationActivity : AppCompatActivity(), OnMapReadyCallback { mapView.onCreate(savedInstanceState) } - override fun onMapReady(mapboxMap: MapboxMap) { - mapboxMap.setStyle(Style.getPredefinedStyle("Streets")) { style -> - this.mapboxMap = mapboxMap + override fun onMapReady(maplibreMap: MapLibreMap) { + maplibreMap?.setStyle(Style.getPredefinedStyle("Streets")) { style -> + this.maplibreMap = maplibreMap localizationPlugin = - LocalizationPlugin(mapView, mapboxMap, style).also { localizationPlugin -> + LocalizationPlugin(mapView, maplibreMap, style).also { localizationPlugin -> localizationPlugin.matchMapLanguageWithDeviceDefault() } @@ -63,7 +63,7 @@ class LocalizationActivity : AppCompatActivity(), OnMapReadyCallback { } binding.fabStyles.setOnClickListener { - mapboxMap.setStyle(Style.Builder().fromUri(Utils.nextStyle)) + maplibreMap.setStyle(Style.Builder().fromUri(Utils.nextStyle)) } } } diff --git a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/markerview/MarkerViewActivity.kt b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/markerview/MarkerViewActivity.kt index c8ac8c78..ceb60fab 100644 --- a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/markerview/MarkerViewActivity.kt +++ b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/markerview/MarkerViewActivity.kt @@ -9,21 +9,21 @@ import android.view.animation.AccelerateDecelerateInterpolator import android.widget.FrameLayout import android.widget.ImageView import androidx.appcompat.app.AppCompatActivity -import com.mapbox.mapboxsdk.camera.CameraUpdateFactory -import com.mapbox.mapboxsdk.geometry.LatLng -import com.mapbox.mapboxsdk.maps.MapView -import com.mapbox.mapboxsdk.maps.MapboxMap -import com.mapbox.mapboxsdk.maps.Style import com.mapbox.mapboxsdk.plugins.markerview.MarkerView import com.mapbox.mapboxsdk.plugins.markerview.MarkerViewManager import com.mapbox.mapboxsdk.plugins.testapp.R import com.mapbox.mapboxsdk.plugins.testapp.Utils +import org.maplibre.android.camera.CameraUpdateFactory +import org.maplibre.android.geometry.LatLng +import org.maplibre.android.maps.MapLibreMap +import org.maplibre.android.maps.MapView +import org.maplibre.android.maps.Style import java.util.Random class MarkerViewActivity : AppCompatActivity(), - MapboxMap.OnMapLongClickListener, - MapboxMap.OnMapClickListener { + MapLibreMap.OnMapLongClickListener, + MapLibreMap.OnMapClickListener { private val random = Random() private var markerViewManager: MarkerViewManager? = null @@ -36,18 +36,18 @@ class MarkerViewActivity : mapView = findViewById(R.id.mapView) as MapView mapView.onCreate(savedInstanceState) - mapView.getMapAsync { mapboxMap -> - mapboxMap.setStyle(Style.getPredefinedStyle("Streets")) { _ -> - findViewById(R.id.fabStyles).setOnClickListener { mapboxMap.setStyle(Utils.nextStyle) } + mapView.getMapAsync { maplibreMap -> + maplibreMap.setStyle(Style.getPredefinedStyle("Streets")) { _ -> + findViewById(R.id.fabStyles).setOnClickListener { maplibreMap.setStyle(Utils.nextStyle) } - mapboxMap.moveCamera(CameraUpdateFactory.zoomTo(2.0)) + maplibreMap.moveCamera(CameraUpdateFactory.zoomTo(2.0)) - markerViewManager = MarkerViewManager(mapView, mapboxMap) + markerViewManager = MarkerViewManager(mapView, maplibreMap) createCustomMarker() createRandomMarkers() - mapboxMap.addOnMapLongClickListener(this@MarkerViewActivity) - mapboxMap.addOnMapClickListener(this@MarkerViewActivity) + maplibreMap.addOnMapLongClickListener(this@MarkerViewActivity) + maplibreMap.addOnMapClickListener(this@MarkerViewActivity) } } } diff --git a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/offline/OfflineDownloadActivity.kt b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/offline/OfflineDownloadActivity.kt index b272bd33..240a5feb 100644 --- a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/offline/OfflineDownloadActivity.kt +++ b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/offline/OfflineDownloadActivity.kt @@ -5,17 +5,17 @@ import android.widget.ArrayAdapter import android.widget.SeekBar import android.widget.Toast import androidx.appcompat.app.AppCompatActivity -import com.mapbox.mapboxsdk.constants.MapboxConstants -import com.mapbox.mapboxsdk.geometry.LatLng -import com.mapbox.mapboxsdk.geometry.LatLngBounds -import com.mapbox.mapboxsdk.maps.Style -import com.mapbox.mapboxsdk.offline.OfflineTilePyramidRegionDefinition import com.mapbox.mapboxsdk.plugins.offline.model.NotificationOptions import com.mapbox.mapboxsdk.plugins.offline.model.OfflineDownloadOptions import com.mapbox.mapboxsdk.plugins.offline.offline.OfflinePlugin import com.mapbox.mapboxsdk.plugins.offline.utils.OfflineUtils import com.mapbox.mapboxsdk.plugins.testapp.R import com.mapbox.mapboxsdk.plugins.testapp.databinding.ActivityOfflineDownloadBinding +import org.maplibre.android.constants.MapLibreConstants +import org.maplibre.android.geometry.LatLng +import org.maplibre.android.geometry.LatLngBounds +import org.maplibre.android.maps.Style +import org.maplibre.android.offline.OfflineTilePyramidRegionDefinition import java.util.ArrayList /** @@ -61,7 +61,7 @@ class OfflineDownloadActivity : AppCompatActivity() { } private fun initSeekbars() { - val maxZoom = MapboxConstants.MAXIMUM_ZOOM.toInt() + val maxZoom = MapLibreConstants.MAXIMUM_ZOOM.toInt() binding.seekbarMinZoom.max = maxZoom binding.seekbarMinZoom.progress = 16 binding.seekbarMaxZoom.max = maxZoom diff --git a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/offline/OfflineRegionDetailActivity.kt b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/offline/OfflineRegionDetailActivity.kt index 2f447bcb..74ea4c14 100644 --- a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/offline/OfflineRegionDetailActivity.kt +++ b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/offline/OfflineRegionDetailActivity.kt @@ -4,11 +4,6 @@ import android.os.Bundle import android.view.View import android.widget.Toast import androidx.appcompat.app.AppCompatActivity -import com.mapbox.mapboxsdk.maps.MapView -import com.mapbox.mapboxsdk.offline.OfflineManager -import com.mapbox.mapboxsdk.offline.OfflineRegion -import com.mapbox.mapboxsdk.offline.OfflineRegionDefinition -import com.mapbox.mapboxsdk.offline.OfflineRegionStatus import com.mapbox.mapboxsdk.plugins.offline.model.OfflineDownloadOptions import com.mapbox.mapboxsdk.plugins.offline.offline.OfflineConstants.KEY_BUNDLE import com.mapbox.mapboxsdk.plugins.offline.offline.OfflineDownloadChangeListener @@ -16,6 +11,11 @@ import com.mapbox.mapboxsdk.plugins.offline.offline.OfflinePlugin import com.mapbox.mapboxsdk.plugins.offline.utils.OfflineUtils import com.mapbox.mapboxsdk.plugins.testapp.R import com.mapbox.mapboxsdk.plugins.testapp.databinding.ActivityOfflineRegionDetailBinding +import org.maplibre.android.maps.MapView +import org.maplibre.android.offline.OfflineManager +import org.maplibre.android.offline.OfflineRegion +import org.maplibre.android.offline.OfflineRegionDefinition +import org.maplibre.android.offline.OfflineRegionStatus import timber.log.Timber /** @@ -144,11 +144,11 @@ class OfflineRegionDetailActivity : AppCompatActivity(), OfflineDownloadChangeLi private fun setupUI(definition: OfflineRegionDefinition) { // update map - mapView?.getMapAsync { mapboxMap -> + mapView?.getMapAsync { maplibreMap -> // correct style - mapboxMap.setOfflineRegionDefinition(definition) { _ -> + maplibreMap.setOfflineRegionDefinition(definition) { _ -> // restrict camera movement - mapboxMap.setLatLngBoundsForCameraTarget(definition.bounds) + maplibreMap.setLatLngBoundsForCameraTarget(definition.bounds) // update textview data offlineRegion?.metadata?.let { diff --git a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/offline/OfflineRegionListActivity.kt b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/offline/OfflineRegionListActivity.kt index 3bd3db3c..d3d6e4e6 100644 --- a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/offline/OfflineRegionListActivity.kt +++ b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/offline/OfflineRegionListActivity.kt @@ -7,11 +7,11 @@ import android.view.View import android.view.ViewGroup import android.widget.* import androidx.appcompat.app.AppCompatActivity -import com.mapbox.mapboxsdk.offline.OfflineManager -import com.mapbox.mapboxsdk.offline.OfflineRegion -import com.mapbox.mapboxsdk.offline.OfflineRegionDefinition import com.mapbox.mapboxsdk.plugins.offline.utils.OfflineUtils import com.mapbox.mapboxsdk.plugins.testapp.R +import org.maplibre.android.offline.OfflineManager +import org.maplibre.android.offline.OfflineRegion +import org.maplibre.android.offline.OfflineRegionDefinition import java.util.* /** diff --git a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/offline/OfflineUiComponentsActivity.kt b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/offline/OfflineUiComponentsActivity.kt index 4380050e..ea013664 100644 --- a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/offline/OfflineUiComponentsActivity.kt +++ b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/offline/OfflineUiComponentsActivity.kt @@ -5,14 +5,14 @@ import android.content.Intent import android.os.Bundle import android.widget.Toast import androidx.appcompat.app.AppCompatActivity -import com.mapbox.mapboxsdk.camera.CameraPosition -import com.mapbox.mapboxsdk.geometry.LatLng import com.mapbox.mapboxsdk.plugins.offline.OfflineRegionSelector import com.mapbox.mapboxsdk.plugins.offline.model.NotificationOptions import com.mapbox.mapboxsdk.plugins.offline.model.RegionSelectionOptions import com.mapbox.mapboxsdk.plugins.offline.offline.OfflinePlugin import com.mapbox.mapboxsdk.plugins.testapp.R import com.mapbox.mapboxsdk.plugins.testapp.databinding.ActivityOfflineUiComponentsBinding +import org.maplibre.android.camera.CameraPosition +import org.maplibre.android.geometry.LatLng import java.util.Locale class OfflineUiComponentsActivity : AppCompatActivity() { diff --git a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/scalebar/ScalebarActivity.kt b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/scalebar/ScalebarActivity.kt index 3c80ba73..6d623384 100644 --- a/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/scalebar/ScalebarActivity.kt +++ b/app/src/main/java/com/mapbox/mapboxsdk/plugins/testapp/activity/scalebar/ScalebarActivity.kt @@ -2,19 +2,18 @@ package com.mapbox.mapboxsdk.plugins.testapp.activity.scalebar import android.os.Bundle import androidx.appcompat.app.AppCompatActivity -import com.mapbox.geojson.LineString -import com.mapbox.geojson.Point -import com.mapbox.mapboxsdk.maps.MapView -import com.mapbox.mapboxsdk.maps.MapboxMap -import com.mapbox.mapboxsdk.maps.Style -import com.mapbox.mapboxsdk.plugins.testapp.R import com.mapbox.mapboxsdk.plugins.testapp.databinding.ActivityScalebarBinding -import com.mapbox.mapboxsdk.style.layers.LineLayer -import com.mapbox.mapboxsdk.style.sources.GeoJsonSource import com.mapbox.pluginscalebar.ScaleBarOptions import com.mapbox.pluginscalebar.ScaleBarPlugin -import com.mapbox.turf.TurfConstants -import com.mapbox.turf.TurfMeasurement +import org.maplibre.android.maps.MapLibreMap +import org.maplibre.android.maps.MapView +import org.maplibre.android.maps.Style +import org.maplibre.android.style.layers.LineLayer +import org.maplibre.android.style.sources.GeoJsonSource +import org.maplibre.geojson.LineString +import org.maplibre.geojson.Point +import org.maplibre.turf.TurfConstants +import org.maplibre.turf.TurfMeasurement /** * Activity showing a scalebar used on a MapView. @@ -29,16 +28,16 @@ class ScalebarActivity : AppCompatActivity() { mapView = binding.mapView mapView.onCreate(savedInstanceState) - mapView.getMapAsync { mapboxMap -> - mapboxMap.setStyle(Style.getPredefinedStyle("Streets")) { - addScalebar(mapboxMap) + mapView.getMapAsync { maplibreMap -> + maplibreMap.setStyle("https://api.maptiler.com/maps/basic-v2/style.json?key=FTNrjsa7Nahw874tmMi7") { + addScalebar(maplibreMap) setupTestLine(it) } } } - private fun addScalebar(mapboxMap: MapboxMap) { - val scaleBarPlugin = ScaleBarPlugin(mapView, mapboxMap) + private fun addScalebar(maplibreMap: MapLibreMap) { + val scaleBarPlugin = ScaleBarPlugin(mapView, maplibreMap) val scaleBarOptions = ScaleBarOptions(this) scaleBarOptions .setTextColor(android.R.color.black) diff --git a/app/src/main/res/layout/activity_annotation.xml b/app/src/main/res/layout/activity_annotation.xml index dac55772..9f9af45c 100644 --- a/app/src/main/res/layout/activity_annotation.xml +++ b/app/src/main/res/layout/activity_annotation.xml @@ -6,7 +6,7 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - diff --git a/app/src/main/res/layout/activity_cluster.xml b/app/src/main/res/layout/activity_cluster.xml index f3c22905..1d9bf8a5 100644 --- a/app/src/main/res/layout/activity_cluster.xml +++ b/app/src/main/res/layout/activity_cluster.xml @@ -6,7 +6,7 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - diff --git a/app/src/main/res/layout/activity_localization.xml b/app/src/main/res/layout/activity_localization.xml index 552f1b0e..c9e4b851 100644 --- a/app/src/main/res/layout/activity_localization.xml +++ b/app/src/main/res/layout/activity_localization.xml @@ -6,7 +6,7 @@ android:layout_height="match_parent" android:orientation="vertical"> - - + - - - { @@ -29,7 +29,7 @@ inline fun MapboxMap.queryRenderedFeatures( * @param layerIds optionally - only query these layers * @return the list of feature */ -inline fun MapboxMap.queryRenderedFeatures( +inline fun MapLibreMap.queryRenderedFeatures( latLng: LatLng, filter: Expression?, vararg layerIds: String, @@ -44,7 +44,7 @@ inline fun MapboxMap.queryRenderedFeatures( * @param layerIds optionally - only query these layers * @return the list of feature */ -inline fun MapboxMap.queryRenderedFeatures( +inline fun MapLibreMap.queryRenderedFeatures( latLngBounds: LatLngBounds, vararg layerIds: String, ): List { @@ -58,7 +58,7 @@ inline fun MapboxMap.queryRenderedFeatures( * @param layerIds optionally - only query these layers * @return the list of feature */ -inline fun MapboxMap.queryRenderedFeatures( +inline fun MapLibreMap.queryRenderedFeatures( latLngBounds: LatLngBounds, filter: Expression?, vararg layerIds: String, diff --git a/ktx-mapbox-maps/src/test/java/com/mapbox/mapboxsdk/plugins/maps/GeometryTest.kt b/ktx-mapbox-maps/src/test/java/com/mapbox/mapboxsdk/plugins/maps/GeometryTest.kt index 6d800801..07b957bd 100644 --- a/ktx-mapbox-maps/src/test/java/com/mapbox/mapboxsdk/plugins/maps/GeometryTest.kt +++ b/ktx-mapbox-maps/src/test/java/com/mapbox/mapboxsdk/plugins/maps/GeometryTest.kt @@ -1,11 +1,11 @@ package com.mapbox.mapboxsdk.plugins.maps -import com.mapbox.geojson.Point -import com.mapbox.mapboxsdk.geometry.LatLng import junit.framework.Assert import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 +import org.maplibre.android.geometry.LatLng +import org.maplibre.geojson.Point @RunWith(JUnit4::class) class GeometryTest { diff --git a/plugin-annotation/scripts/annotation.java.ejs b/plugin-annotation/scripts/annotation.java.ejs index 0ec23a1d..4305ae68 100644 --- a/plugin-annotation/scripts/annotation.java.ejs +++ b/plugin-annotation/scripts/annotation.java.ejs @@ -17,19 +17,19 @@ import android.graphics.PointF; import com.google.gson.JsonArray; import com.google.gson.JsonNull; import com.google.gson.JsonObject; -import com.mapbox.geojson.*; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.style.layers.Property; -import com.mapbox.mapboxsdk.style.layers.PropertyFactory; -import com.mapbox.mapboxsdk.utils.ColorUtils; +import org.maplibre.geojson.*; +import org.maplibre.android.geometry.LatLng; +import org.maplibre.android.style.layers.Property; +import org.maplibre.android.style.layers.PropertyFactory; +import org.maplibre.android.utils.ColorUtils; import com.mapbox.android.gestures.MoveDistancesObject; -import com.mapbox.mapboxsdk.maps.Projection; +import org.maplibre.android.maps.Projection; import java.util.ArrayList; import java.util.List; -import static com.mapbox.mapboxsdk.constants.GeometryConstants.MAX_MERCATOR_LATITUDE; -import static com.mapbox.mapboxsdk.constants.GeometryConstants.MIN_MERCATOR_LATITUDE; +import static org.maplibre.android.constants.GeometryConstants.MAX_MERCATOR_LATITUDE; +import static org.maplibre.android.constants.GeometryConstants.MIN_MERCATOR_LATITUDE; @UiThread public class <%- camelize(type) %> extends Annotation<<%- geometryType(type) %>> { diff --git a/plugin-annotation/scripts/annotation_element_provider.java.ejs b/plugin-annotation/scripts/annotation_element_provider.java.ejs index 969357aa..26f7e796 100644 --- a/plugin-annotation/scripts/annotation_element_provider.java.ejs +++ b/plugin-annotation/scripts/annotation_element_provider.java.ejs @@ -9,9 +9,9 @@ package com.mapbox.mapboxsdk.plugins.annotation; import androidx.annotation.Nullable; -import com.mapbox.mapboxsdk.style.layers.<%- camelize(type) %>Layer; -import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; -import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; +import org.maplibre.android.style.layers.<%- camelize(type) %>Layer; +import org.maplibre.android.style.sources.GeoJsonOptions; +import org.maplibre.android.style.sources.GeoJsonSource; import java.util.concurrent.atomic.AtomicLong; diff --git a/plugin-annotation/scripts/annotation_instrumentation_test.junit.ejs b/plugin-annotation/scripts/annotation_instrumentation_test.junit.ejs index 2f5c4f65..9f4cadfb 100644 --- a/plugin-annotation/scripts/annotation_instrumentation_test.junit.ejs +++ b/plugin-annotation/scripts/annotation_instrumentation_test.junit.ejs @@ -1,3 +1,4 @@ + <% const type = locals.type; const properties = locals.properties; @@ -10,10 +11,10 @@ import android.graphics.PointF; import androidx.test.ext.junit.runners.AndroidJUnit4; -import com.mapbox.mapboxsdk.geometry.LatLng; +import org.maplibre.android.geometry.LatLng; import com.mapbox.mapboxsdk.plugins.BaseActivityTest; import com.mapbox.mapboxsdk.plugins.testapp.activity.TestActivity; -import com.mapbox.mapboxsdk.utils.ColorUtils; +import org.maplibre.android.utils.ColorUtils; import timber.log.Timber; @@ -24,7 +25,7 @@ import java.util.Objects; import static com.mapbox.mapboxsdk.plugins.annotation.MapboxMapAction.invoke; import static org.junit.Assert.*; -import static com.mapbox.mapboxsdk.style.layers.Property.*; +import static org.maplibre.android.style.layers.Property.*; import java.util.ArrayList; import java.util.List; @@ -44,8 +45,8 @@ public class <%- camelize(type) %>Test extends BaseActivityTest { private void setupAnnotation() { Timber.i("Retrieving layer"); - invoke(mapboxMap, (uiController, mapboxMap) -> { - <%- camelize(type) %>Manager <%- type %>Manager = new <%- camelize(type) %>Manager(idlingResource.getMapView(), mapboxMap, Objects.requireNonNull(mapboxMap.getStyle())); + invoke(maplibreMap, (uiController, maplibreMap) -> { + <%- camelize(type) %>Manager <%- type %>Manager = new <%- camelize(type) %>Manager(idlingResource.getMapView(), maplibreMap, Objects.requireNonNull(maplibreMap.getStyle())); <% if (type === "circle" || type === "symbol") { -%> <%- type %> = <%- type %>Manager.create(new <%- camelize(type) %>Options().withLatLng(new LatLng())); <% } else if (type === "line") { -%> @@ -73,7 +74,7 @@ public class <%- camelize(type) %>Test extends BaseActivityTest { validateTestSetup(); setupAnnotation(); Timber.i("<%- property.name %>"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(<%- type %>); <%- type %>.set<%- camelize(property.name) %>(new PointF(1.0f, 1.0f)); @@ -87,7 +88,7 @@ public class <%- camelize(type) %>Test extends BaseActivityTest { validateTestSetup(); setupAnnotation(); Timber.i("<%- property.name %>"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(<%- type %>); <%- type %>.set<%- camelize(property.name) %>(<%- defaultValueJava(property) %>); @@ -100,7 +101,7 @@ public class <%- camelize(type) %>Test extends BaseActivityTest { validateTestSetup(); setupAnnotation(); Timber.i("<%- property.name %>"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(<%- type %>); <%- type %>.set<%- camelize(property.name) %>(ColorUtils.rgbaToColor(<%- defaultValueJava(property) %>)); assertEquals(<%- type %>.get<%- camelize(property.name) %>AsInt(), ColorUtils.rgbaToColor(<%- defaultValueJava(property) %>)); @@ -114,7 +115,7 @@ public class <%- camelize(type) %>Test extends BaseActivityTest { validateTestSetup(); setupAnnotation(); Timber.i("<%- property.name %>"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(<%- type %>); <%- type %>.set<%- camelize(property.name) %>(<%- defaultValueJava(property) %>); diff --git a/plugin-annotation/scripts/annotation_manager.java.ejs b/plugin-annotation/scripts/annotation_manager.java.ejs index b80377ad..d0e1d475 100644 --- a/plugin-annotation/scripts/annotation_manager.java.ejs +++ b/plugin-annotation/scripts/annotation_manager.java.ejs @@ -12,23 +12,23 @@ import androidx.annotation.Nullable; import androidx.annotation.UiThread; import androidx.annotation.VisibleForTesting; -import com.mapbox.geojson.Feature; -import com.mapbox.geojson.FeatureCollection; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.style.expressions.Expression; -import com.mapbox.mapboxsdk.style.layers.<%- camelize(type) %>Layer; -import com.mapbox.mapboxsdk.style.layers.PropertyValue; -import com.mapbox.mapboxsdk.style.layers.PropertyFactory; -import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; -import com.mapbox.mapboxsdk.style.layers.Property; +import org.maplibre.geojson.Feature; +import org.maplibre.geojson.FeatureCollection; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.MapLibreMap; +import org.maplibre.android.maps.Style; +import org.maplibre.android.style.expressions.Expression; +import org.maplibre.android.style.layers.<%- camelize(type) %>Layer; +import org.maplibre.android.style.layers.PropertyValue; +import org.maplibre.android.style.layers.PropertyFactory; +import org.maplibre.android.style.sources.GeoJsonOptions; +import org.maplibre.android.style.layers.Property; import java.util.ArrayList; import java.util.List; -import static com.mapbox.mapboxsdk.style.expressions.Expression.get; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*; +import static org.maplibre.android.style.expressions.Expression.get; +import static org.maplibre.android.style.layers.PropertyFactory.*; /** * The <%- type %> manager allows to add <%- type %>s to a map. @@ -44,61 +44,61 @@ public class <%- camelize(type) %>Manager extends AnnotationManager<<%- camelize /** * Create a <%- type %> manager, used to manage <%- type %>s. * - * @param mapboxMap the map object to add <%- type %>s to + * @param maplibreMap the map object to add <%- type %>s to * @param style a valid a fully loaded style object */ @UiThread - public <%- camelize(type) %>Manager(@NonNull MapView mapView, @NonNull MapboxMap mapboxMap, @NonNull Style style) { - this(mapView, mapboxMap, style, null, null, (GeoJsonOptions) null); + public <%- camelize(type) %>Manager(@NonNull MapView mapView, @NonNull MapLibreMap maplibreMap, @NonNull Style style) { + this(mapView, maplibreMap, style, null, null, (GeoJsonOptions) null); } /** * Create a <%- type %> manager, used to manage <%- type %>s. * - * @param mapboxMap the map object to add <%- type %>s to + * @param maplibreMap the map object to add <%- type %>s to * @param style a valid a fully loaded style object * @param belowLayerId the id of the layer above the <%- type %> layer * @param aboveLayerId the id of the layer below the <%- type %> layer */ @UiThread - public <%- camelize(type) %>Manager(@NonNull MapView mapView, @NonNull MapboxMap mapboxMap, @NonNull Style style, @Nullable String belowLayerId, @Nullable String aboveLayerId) { - this(mapView, mapboxMap, style, belowLayerId, aboveLayerId, (GeoJsonOptions) null); + public <%- camelize(type) %>Manager(@NonNull MapView mapView, @NonNull MapLibreMap maplibreMap, @NonNull Style style, @Nullable String belowLayerId, @Nullable String aboveLayerId) { + this(mapView, maplibreMap, style, belowLayerId, aboveLayerId, (GeoJsonOptions) null); } /** * Create a <%- type %> manager, used to manage <%- type %>s. * - * @param mapboxMap the map object to add <%- type %>s to + * @param maplibreMap the map object to add <%- type %>s to * @param style a valid a fully loaded style object * @param belowLayerId the id of the layer above the <%- type %> layer * @param aboveLayerId the id of the layer below the <%- type %> layer * @param geoJsonOptions options for the internal source */ @UiThread - public <%- camelize(type) %>Manager(@NonNull MapView mapView, @NonNull MapboxMap mapboxMap, @NonNull Style style, @Nullable String belowLayerId, @Nullable String aboveLayerId, @Nullable GeoJsonOptions geoJsonOptions) { - this(mapView, mapboxMap, style, new <%- camelize(type) %>ElementProvider(), belowLayerId, aboveLayerId, geoJsonOptions, DraggableAnnotationController.getInstance(mapView, mapboxMap)); + public <%- camelize(type) %>Manager(@NonNull MapView mapView, @NonNull MapLibreMap maplibreMap, @NonNull Style style, @Nullable String belowLayerId, @Nullable String aboveLayerId, @Nullable GeoJsonOptions geoJsonOptions) { + this(mapView, maplibreMap, style, new <%- camelize(type) %>ElementProvider(), belowLayerId, aboveLayerId, geoJsonOptions, DraggableAnnotationController.getInstance(mapView, maplibreMap)); } <% if (type === "symbol") { -%> /** * Create a <%- type %> manager, used to manage <%- type %>s. * - * @param mapboxMap the map object to add <%- type %>s to + * @param maplibreMap the map object to add <%- type %>s to * @param style a valid a fully loaded style object * @param belowLayerId the id of the layer above the <%- type %> layer * @param aboveLayerId the id of the layer below the <%- type %> layer * @param clusterOptions options for the clustering configuration */ @UiThread - public <%- camelize(type) %>Manager(@NonNull MapView mapView, @NonNull MapboxMap mapboxMap, @NonNull Style style, @Nullable String belowLayerId, @Nullable String aboveLayerId, @NonNull ClusterOptions clusterOptions) { - this(mapView, mapboxMap, style, new SymbolElementProvider(), belowLayerId, aboveLayerId, new GeoJsonOptions().withCluster(true).withClusterRadius(clusterOptions.getClusterRadius()).withClusterMaxZoom(clusterOptions.getClusterMaxZoom()), DraggableAnnotationController.getInstance(mapView, mapboxMap)); + public <%- camelize(type) %>Manager(@NonNull MapView mapView, @NonNull MapLibreMap maplibreMap, @NonNull Style style, @Nullable String belowLayerId, @Nullable String aboveLayerId, @NonNull ClusterOptions clusterOptions) { + this(mapView, maplibreMap, style, new SymbolElementProvider(), belowLayerId, aboveLayerId, new GeoJsonOptions().withCluster(true).withClusterRadius(clusterOptions.getClusterRadius()).withClusterMaxZoom(clusterOptions.getClusterMaxZoom()), DraggableAnnotationController.getInstance(mapView, maplibreMap)); clusterOptions.apply(style, coreElementProvider.getSourceId()); } <% } -%> @UiThread - <%- camelize(type) %>Manager(@NonNull MapView mapView, @NonNull MapboxMap mapboxMap, @NonNull Style style, @NonNull CoreElementProvider<<%- camelize(type) %>Layer> coreElementProvider, @Nullable String belowLayerId, @Nullable String aboveLayerId, @Nullable GeoJsonOptions geoJsonOptions, DraggableAnnotationController draggableAnnotationController) { - super(mapView, mapboxMap, style, coreElementProvider, draggableAnnotationController, belowLayerId, aboveLayerId, geoJsonOptions); + <%- camelize(type) %>Manager(@NonNull MapView mapView, @NonNull MapLibreMap maplibreMap, @NonNull Style style, @NonNull CoreElementProvider<<%- camelize(type) %>Layer> coreElementProvider, @Nullable String belowLayerId, @Nullable String aboveLayerId, @Nullable GeoJsonOptions geoJsonOptions, DraggableAnnotationController draggableAnnotationController) { + super(mapView, maplibreMap, style, coreElementProvider, draggableAnnotationController, belowLayerId, aboveLayerId, geoJsonOptions); } @Override diff --git a/plugin-annotation/scripts/annotation_manager_instrumentation_test.junit.ejs b/plugin-annotation/scripts/annotation_manager_instrumentation_test.junit.ejs index 94898eea..d2e75104 100644 --- a/plugin-annotation/scripts/annotation_manager_instrumentation_test.junit.ejs +++ b/plugin-annotation/scripts/annotation_manager_instrumentation_test.junit.ejs @@ -8,7 +8,7 @@ package com.mapbox.mapboxsdk.plugins.annotation; import androidx.test.ext.junit.runners.AndroidJUnit4; -import com.mapbox.mapboxsdk.geometry.LatLng; +import org.maplibre.android.geometry.LatLng; import com.mapbox.mapboxsdk.plugins.testapp.activity.TestActivity; import com.mapbox.mapboxsdk.plugins.BaseActivityTest; @@ -21,7 +21,7 @@ import java.util.Objects; import static com.mapbox.mapboxsdk.plugins.annotation.MapboxMapAction.invoke; import static org.junit.Assert.*; -import static com.mapbox.mapboxsdk.style.layers.Property.*; +import static org.maplibre.android.style.layers.Property.*; /** * Basic smoke tests for <%- camelize(type) %>Manager @@ -38,8 +38,8 @@ public class <%- camelize(type) %>ManagerTest extends BaseActivityTest { private void setup<%- camelize(type) %>Manager() { Timber.i("Retrieving layer"); - invoke(mapboxMap, (uiController, mapboxMap) -> { - <%- type %>Manager = new <%- camelize(type) %>Manager(idlingResource.getMapView(), mapboxMap, Objects.requireNonNull(mapboxMap.getStyle())); + invoke(maplibreMap, (uiController, maplibreMap) -> { + <%- type %>Manager = new <%- camelize(type) %>Manager(idlingResource.getMapView(), maplibreMap, Objects.requireNonNull(maplibreMap.getStyle())); }); } <% for (const property of properties) { -%> @@ -50,7 +50,7 @@ public class <%- camelize(type) %>ManagerTest extends BaseActivityTest { validateTestSetup(); setup<%- camelize(type) %>Manager(); Timber.i("<%- property.name %>"); - invoke(mapboxMap, (uiController, mapboxMap) -> { + invoke(maplibreMap, (uiController, maplibreMap) -> { assertNotNull(<%- type %>Manager); <%- type %>Manager.set<%- camelize(property.name) %>(<%- defaultValueJava(property) %>); diff --git a/plugin-annotation/scripts/annotation_manager_unit_test.junit.ejs b/plugin-annotation/scripts/annotation_manager_unit_test.junit.ejs index 4af6f3d3..29f46ccd 100644 --- a/plugin-annotation/scripts/annotation_manager_unit_test.junit.ejs +++ b/plugin-annotation/scripts/annotation_manager_unit_test.junit.ejs @@ -10,16 +10,16 @@ package com.mapbox.mapboxsdk.plugins.annotation; import android.graphics.PointF; import com.google.gson.JsonPrimitive; -import com.mapbox.geojson.*; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.style.expressions.Expression; -import com.mapbox.mapboxsdk.style.layers.*; -import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; -import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; -import com.mapbox.mapboxsdk.utils.ColorUtils; +import org.maplibre.geojson.*; +import org.maplibre.android.geometry.LatLng; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.MapLibreMap; +import org.maplibre.android.maps.Style; +import org.maplibre.android.style.expressions.Expression; +import org.maplibre.android.style.layers.*; +import org.maplibre.android.style.sources.GeoJsonOptions; +import org.maplibre.android.style.sources.GeoJsonSource; +import org.maplibre.android.utils.ColorUtils; import org.junit.Before; import org.junit.Test; @@ -30,9 +30,9 @@ import java.util.List; import java.util.Arrays; import static com.mapbox.mapboxsdk.plugins.annotation.ConvertUtils.convertArray; -import static com.mapbox.mapboxsdk.style.expressions.Expression.get; -import static com.mapbox.mapboxsdk.style.layers.Property.*; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*; +import static org.maplibre.android.style.expressions.Expression.get; +import static org.maplibre.android.style.layers.Property.*; +import static org.maplibre.android.style.layers.PropertyFactory.*; import static junit.framework.Assert.*; import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.Mockito.*; @@ -41,7 +41,7 @@ public class <%- camelize(type) %>ManagerTest { private DraggableAnnotationController draggableAnnotationController = mock(DraggableAnnotationController.class); private MapView mapView = mock(MapView.class); - private MapboxMap mapboxMap = mock(MapboxMap.class); + private MapLibreMap maplibreMap = mock(MapLibreMap.class); private Style style = mock(Style.class); private GeoJsonSource geoJsonSource = mock(GeoJsonSource.class); private GeoJsonSource optionedGeoJsonSource = mock(GeoJsonSource.class); @@ -62,7 +62,7 @@ public class <%- camelize(type) %>ManagerTest { @Test public void testInitialization() { - <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(style).addSource(geoJsonSource); verify(style).addLayer(<%- type %>Layer); assertTrue(<%- type %>Manager.dataDrivenPropertyUsageMap.size() > 0); @@ -75,7 +75,7 @@ public class <%- camelize(type) %>ManagerTest { @Test public void testInitializationOnStyleReload() { - <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(style).addSource(geoJsonSource); verify(style).addLayer(<%- type %>Layer); assertTrue(<%- type %>Manager.dataDrivenPropertyUsageMap.size() > 0); @@ -92,7 +92,7 @@ public class <%- camelize(type) %>ManagerTest { loadingArgumentCaptor.getValue().onDidFinishLoadingStyle(); ArgumentCaptor styleLoadedArgumentCaptor = ArgumentCaptor.forClass(Style.OnStyleLoaded.class); - verify(mapboxMap).getStyle(styleLoadedArgumentCaptor.capture()); + verify(maplibreMap).getStyle(styleLoadedArgumentCaptor.capture()); Style newStyle = mock(Style.class); when(newStyle.isFullyLoaded()).thenReturn(true); @@ -114,7 +114,7 @@ public class <%- camelize(type) %>ManagerTest { @Test public void testLayerBelowInitialization() { - <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, "test_layer", null, null, draggableAnnotationController); + <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, maplibreMap, style, coreElementProvider, "test_layer", null, null, draggableAnnotationController); verify(style).addSource(geoJsonSource); verify(style).addLayerBelow(<%- type %>Layer, "test_layer"); assertTrue(<%- type %>Manager.dataDrivenPropertyUsageMap.size() > 0); @@ -126,7 +126,7 @@ public class <%- camelize(type) %>ManagerTest { @Test public void testGeoJsonOptionsInitialization() { - <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, null, null, geoJsonOptions, draggableAnnotationController); + <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, maplibreMap, style, coreElementProvider, null, null, geoJsonOptions, draggableAnnotationController); verify(style).addSource(optionedGeoJsonSource); verify(style).addLayer(<%- type %>Layer); assertTrue(<%- type %>Manager.dataDrivenPropertyUsageMap.size() > 0); @@ -139,13 +139,13 @@ public class <%- camelize(type) %>ManagerTest { @Test public void testLayerId() { - <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); assertEquals(layerId, <%- type %>Manager.getLayerId()); } @Test public void testAdd<%- camelize(type) %>() { - <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); <% if (type === "circle" || type === "symbol") { -%> <%- camelize(type) %> <%- type %> = <%- type %>Manager.create(new <%- camelize(type) %>Options().withLatLng(new LatLng())); <% } else if (type === "line") { -%> @@ -168,7 +168,7 @@ public class <%- camelize(type) %>ManagerTest { @Test public void add<%- camelize(type) %>FromFeatureCollection() { - <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); <% if (type === "circle" || type === "symbol") { -%> Geometry geometry = Point.fromLngLat(10, 10); <% } else if (type === "line") { -%> @@ -227,7 +227,7 @@ public class <%- camelize(type) %>ManagerTest { @Test public void add<%- camelize(type) %>s() { - <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); <% if (type === "circle" || type === "symbol") { -%> List latLngList = new ArrayList<>(); latLngList.add(new LatLng()); @@ -287,7 +287,7 @@ public class <%- camelize(type) %>ManagerTest { @Test public void testDelete<%- camelize(type) %>() { - <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); <% if (type === "circle" || type === "symbol") { -%> <%- camelize(type) %> <%- type %> = <%- type %>Manager.create(new <%- camelize(type) %>Options().withLatLng(new LatLng())); <% } else if (type === "line") { -%> @@ -310,7 +310,7 @@ public class <%- camelize(type) %>ManagerTest { @Test public void testGeometry<%- camelize(type) %>() { - <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); <% if (type === "circle" || type === "symbol") { -%> LatLng latLng = new LatLng(12, 34); <%- camelize(type) %>Options options = new <%- camelize(type) %>Options().withLatLng(latLng); @@ -365,7 +365,7 @@ public class <%- camelize(type) %>ManagerTest { @Test public void testFeatureId<%- camelize(type) %>() { - <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); <% if (type === "circle" || type === "symbol") { -%> <%- camelize(type) %> <%- type %>Zero = <%- type %>Manager.create(new <%- camelize(type) %>Options().withLatLng(new LatLng())); <%- camelize(type) %> <%- type %>One = <%- type %>Manager.create(new <%- camelize(type) %>Options().withLatLng(new LatLng())); @@ -391,7 +391,7 @@ public class <%- camelize(type) %>ManagerTest { @Test public void test<%- camelize(type) %>DraggableFlag() { - <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); <% if (type === "circle" || type === "symbol") { -%> <%- camelize(type) %> <%- type %>Zero = <%- type %>Manager.create(new <%- camelize(type) %>Options().withLatLng(new LatLng())); <% } else if (type === "line") { -%> @@ -421,7 +421,7 @@ public class <%- camelize(type) %>ManagerTest { @Test public void test<%- camelize(property.name) %>LayerProperty() { - <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(<%- type %>Layer, times(0)).setProperties(argThat(new PropertyValueMatcher(<%- camelizeWithLeadingLowercase(property.name) %>(get("<%- property.name %>"))))); <% if (type === "circle" || type === "symbol") { -%> @@ -452,7 +452,7 @@ public class <%- camelize(type) %>ManagerTest { @Test public void test<%- camelize(type) %>LayerFilter() { - <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); Expression expression = Expression.eq(Expression.get("test"), "selected"); verify(<%- type %>Layer, times(0)).setFilter(expression); @@ -467,7 +467,7 @@ public class <%- camelize(type) %>ManagerTest { @Test public void testClickListener() { On<%- camelize(type) %>ClickListener listener = mock(On<%- camelize(type) %>ClickListener.class); - <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); assertTrue(<%- type %>Manager.getClickListeners().isEmpty()); <%- type %>Manager.addClickListener(listener); assertTrue(<%- type %>Manager.getClickListeners().contains(listener)); @@ -478,7 +478,7 @@ public class <%- camelize(type) %>ManagerTest { @Test public void testLongClickListener() { On<%- camelize(type) %>LongClickListener listener = mock(On<%- camelize(type) %>LongClickListener.class); - <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); assertTrue(<%- type %>Manager.getLongClickListeners().isEmpty()); <%- type %>Manager.addLongClickListener(listener); assertTrue(<%- type %>Manager.getLongClickListeners().contains(listener)); @@ -489,7 +489,7 @@ public class <%- camelize(type) %>ManagerTest { @Test public void testDragListener() { On<%- camelize(type) %>DragListener listener = mock(On<%- camelize(type) %>DragListener.class); - <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); assertTrue(<%- type %>Manager.getDragListeners().isEmpty()); <%- type %>Manager.addDragListener(listener); assertTrue(<%- type %>Manager.getDragListeners().contains(listener)); @@ -499,7 +499,7 @@ public class <%- camelize(type) %>ManagerTest { @Test public void testCustomData() { - <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); <% if (type === "circle" || type === "symbol") { -%> <%- camelize(type) %>Options options = new <%- camelize(type) %>Options().withLatLng(new LatLng()); <% } else if (type === "line") { -%> @@ -523,7 +523,7 @@ public class <%- camelize(type) %>ManagerTest { @Test public void testClearAll() { - <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); <% if (type === "circle" || type === "symbol") { -%> <%- camelize(type) %>Options options = new <%- camelize(type) %>Options().withLatLng(new LatLng()); <% } else if (type === "line") { -%> @@ -548,7 +548,7 @@ public class <%- camelize(type) %>ManagerTest { @Test public void testIgnoreClearedAnnotations() { - <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + <%- type %>Manager = new <%- camelize(type) %>Manager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); <% if (type === "circle" || type === "symbol") { -%> <%- camelize(type) %>Options options = new <%- camelize(type) %>Options().withLatLng(new LatLng()); <% } else if (type === "line") { -%> diff --git a/plugin-annotation/scripts/annotation_options.java.ejs b/plugin-annotation/scripts/annotation_options.java.ejs index a6051a47..8e746f83 100644 --- a/plugin-annotation/scripts/annotation_options.java.ejs +++ b/plugin-annotation/scripts/annotation_options.java.ejs @@ -11,12 +11,12 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.google.gson.*; -import com.mapbox.geojson.Geometry; -import com.mapbox.mapboxsdk.style.layers.Property; -import com.mapbox.mapboxsdk.style.layers.PropertyFactory; +import org.maplibre.geojson.Geometry; +import org.maplibre.android.style.layers.Property; +import org.maplibre.android.style.layers.PropertyFactory; -import com.mapbox.geojson.*; -import com.mapbox.mapboxsdk.geometry.LatLng; +import org.maplibre.geojson.*; +import org.maplibre.android.geometry.LatLng; import java.util.ArrayList; import java.util.List; diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/Annotation.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/Annotation.java index afd0e79e..a3ed9f23 100644 --- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/Annotation.java +++ b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/Annotation.java @@ -3,11 +3,11 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.mapbox.android.gestures.MoveDistancesObject; -import com.mapbox.geojson.Geometry; -import com.mapbox.mapboxsdk.maps.Projection; +import org.maplibre.geojson.Geometry; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import org.maplibre.android.maps.Projection; public abstract class Annotation { diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/AnnotationManager.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/AnnotationManager.java index 5eda10f9..39ff2d14 100644 --- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/AnnotationManager.java +++ b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/AnnotationManager.java @@ -2,18 +2,13 @@ import android.graphics.PointF; -import com.mapbox.geojson.Feature; -import com.mapbox.geojson.FeatureCollection; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.log.Logger; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.style.expressions.Expression; -import com.mapbox.mapboxsdk.style.layers.Layer; -import com.mapbox.mapboxsdk.style.layers.PropertyValue; -import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; -import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; +import org.maplibre.geojson.Feature; +import org.maplibre.geojson.FeatureCollection; +import org.maplibre.android.geometry.LatLng; +import org.maplibre.android.log.Logger; +import org.maplibre.android.maps.MapLibreMap; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.Style; import java.util.ArrayList; import java.util.HashMap; @@ -26,6 +21,11 @@ import androidx.annotation.UiThread; import androidx.annotation.VisibleForTesting; import androidx.collection.LongSparseArray; +import org.maplibre.android.style.expressions.Expression; +import org.maplibre.android.style.layers.Layer; +import org.maplibre.android.style.layers.PropertyValue; +import org.maplibre.android.style.sources.GeoJsonOptions; +import org.maplibre.android.style.sources.GeoJsonSource; /** * Generic AnnotationManager, can be used to create annotation specific managers. @@ -47,7 +47,7 @@ public abstract class AnnotationManager< private static final String TAG = "AnnotationManager"; private final MapView mapView; - protected final MapboxMap mapboxMap; + protected final MapLibreMap maplibreMap; protected final LongSparseArray annotations = new LongSparseArray<>(); final Map dataDrivenPropertyUsageMap = new HashMap<>(); final Map constantPropertyUsageMap = new HashMap<>(); @@ -70,12 +70,12 @@ public abstract class AnnotationManager< private AtomicBoolean isSourceUpToDate = new AtomicBoolean(true); @UiThread - protected AnnotationManager(MapView mapView, final MapboxMap mapboxMap, Style style, + protected AnnotationManager(MapView mapView, final MapLibreMap maplibreMap, Style style, CoreElementProvider coreElementProvider, DraggableAnnotationController draggableAnnotationController, String belowLayerId, String aboveLayerId, final GeoJsonOptions geoJsonOptions) { this.mapView = mapView; - this.mapboxMap = mapboxMap; + this.maplibreMap = maplibreMap; this.style = style; this.belowLayerId = belowLayerId; this.aboveLayerId = aboveLayerId; @@ -86,8 +86,8 @@ protected AnnotationManager(MapView mapView, final MapboxMap mapboxMap, Style st throw new RuntimeException("The style has to be non-null and fully loaded."); } - mapboxMap.addOnMapClickListener(mapClickResolver = new MapClickResolver()); - mapboxMap.addOnMapLongClickListener(mapClickResolver); + maplibreMap.addOnMapClickListener(mapClickResolver = new MapClickResolver()); + maplibreMap.addOnMapLongClickListener(mapClickResolver); initializeSourcesAndLayers(geoJsonOptions); draggableAnnotationController.addAnnotationManager(this); @@ -95,7 +95,7 @@ protected AnnotationManager(MapView mapView, final MapboxMap mapboxMap, Style st mapView.addOnDidFinishLoadingStyleListener(new MapView.OnDidFinishLoadingStyleListener() { @Override public void onDidFinishLoadingStyle() { - mapboxMap.getStyle(new Style.OnStyleLoaded() { + maplibreMap.getStyle(new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style loadedStyle) { AnnotationManager.this.style = loadedStyle; @@ -360,8 +360,8 @@ List getDragListeners() { */ @UiThread public void onDestroy() { - mapboxMap.removeOnMapClickListener(mapClickResolver); - mapboxMap.removeOnMapLongClickListener(mapClickResolver); + maplibreMap.removeOnMapClickListener(mapClickResolver); + maplibreMap.removeOnMapLongClickListener(mapClickResolver); draggableAnnotationController.removeAnnotationManager(this); dragListeners.clear(); clickListeners.clear(); @@ -403,7 +403,7 @@ private void initializeSourcesAndLayers(GeoJsonOptions geoJsonOptions) { /** * Inner class for transforming map click events into annotation clicks */ - private class MapClickResolver implements MapboxMap.OnMapClickListener, MapboxMap.OnMapLongClickListener { + private class MapClickResolver implements MapLibreMap.OnMapClickListener, MapLibreMap.OnMapLongClickListener { @Override public boolean onMapClick(@NonNull LatLng point) { @@ -442,12 +442,12 @@ public boolean onMapLongClick(@NonNull LatLng point) { @Nullable private T queryMapForFeatures(@NonNull LatLng point) { - return queryMapForFeatures(mapboxMap.getProjection().toScreenLocation(point)); + return queryMapForFeatures(maplibreMap.getProjection().toScreenLocation(point)); } @Nullable T queryMapForFeatures(@NonNull PointF point) { - List features = mapboxMap.queryRenderedFeatures(point, coreElementProvider.getLayerId()); + List features = maplibreMap.queryRenderedFeatures(point, coreElementProvider.getLayerId()); if (!features.isEmpty()) { long id = features.get(0).getProperty(getAnnotationIdKey()).getAsLong(); return annotations.get(id); diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/Circle.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/Circle.java index 73b5d700..dbc3eb60 100644 --- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/Circle.java +++ b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/Circle.java @@ -12,19 +12,19 @@ import com.google.gson.JsonArray; import com.google.gson.JsonNull; import com.google.gson.JsonObject; -import com.mapbox.geojson.*; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.style.layers.Property; -import com.mapbox.mapboxsdk.style.layers.PropertyFactory; -import com.mapbox.mapboxsdk.utils.ColorUtils; +import org.maplibre.geojson.*; +import org.maplibre.android.geometry.LatLng; +import org.maplibre.android.style.layers.Property; +import org.maplibre.android.style.layers.PropertyFactory; +import org.maplibre.android.utils.ColorUtils; import com.mapbox.android.gestures.MoveDistancesObject; -import com.mapbox.mapboxsdk.maps.Projection; +import org.maplibre.android.maps.Projection; import java.util.ArrayList; import java.util.List; -import static com.mapbox.mapboxsdk.constants.GeometryConstants.MAX_MERCATOR_LATITUDE; -import static com.mapbox.mapboxsdk.constants.GeometryConstants.MIN_MERCATOR_LATITUDE; +import static org.maplibre.android.constants.GeometryConstants.MAX_MERCATOR_LATITUDE; +import static org.maplibre.android.constants.GeometryConstants.MIN_MERCATOR_LATITUDE; @UiThread public class Circle extends Annotation { diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/CircleElementProvider.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/CircleElementProvider.java index 2e02e204..40cb5068 100644 --- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/CircleElementProvider.java +++ b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/CircleElementProvider.java @@ -4,9 +4,9 @@ import androidx.annotation.Nullable; -import com.mapbox.mapboxsdk.style.layers.CircleLayer; -import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; -import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; +import org.maplibre.android.style.layers.CircleLayer; +import org.maplibre.android.style.sources.GeoJsonOptions; +import org.maplibre.android.style.sources.GeoJsonSource; import java.util.concurrent.atomic.AtomicLong; diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/CircleManager.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/CircleManager.java index 4c9886ce..4afd27bb 100644 --- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/CircleManager.java +++ b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/CircleManager.java @@ -7,23 +7,23 @@ import androidx.annotation.UiThread; import androidx.annotation.VisibleForTesting; -import com.mapbox.geojson.Feature; -import com.mapbox.geojson.FeatureCollection; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.style.expressions.Expression; -import com.mapbox.mapboxsdk.style.layers.CircleLayer; -import com.mapbox.mapboxsdk.style.layers.PropertyValue; -import com.mapbox.mapboxsdk.style.layers.PropertyFactory; -import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; -import com.mapbox.mapboxsdk.style.layers.Property; +import org.maplibre.geojson.Feature; +import org.maplibre.geojson.FeatureCollection; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.MapLibreMap; +import org.maplibre.android.maps.Style; +import org.maplibre.android.style.expressions.Expression; +import org.maplibre.android.style.layers.CircleLayer; +import org.maplibre.android.style.layers.PropertyValue; +import org.maplibre.android.style.layers.PropertyFactory; +import org.maplibre.android.style.sources.GeoJsonOptions; +import org.maplibre.android.style.layers.Property; import java.util.ArrayList; import java.util.List; -import static com.mapbox.mapboxsdk.style.expressions.Expression.get; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*; +import static org.maplibre.android.style.expressions.Expression.get; +import static org.maplibre.android.style.layers.PropertyFactory.*; /** * The circle manager allows to add circles to a map. @@ -38,44 +38,44 @@ public class CircleManager extends AnnotationManager coreElementProvider, @Nullable String belowLayerId, @Nullable String aboveLayerId, @Nullable GeoJsonOptions geoJsonOptions, DraggableAnnotationController draggableAnnotationController) { - super(mapView, mapboxMap, style, coreElementProvider, draggableAnnotationController, belowLayerId, aboveLayerId, geoJsonOptions); + CircleManager(@NonNull MapView mapView, @NonNull MapLibreMap maplibreMap, @NonNull Style style, @NonNull CoreElementProvider coreElementProvider, @Nullable String belowLayerId, @Nullable String aboveLayerId, @Nullable GeoJsonOptions geoJsonOptions, DraggableAnnotationController draggableAnnotationController) { + super(mapView, maplibreMap, style, coreElementProvider, draggableAnnotationController, belowLayerId, aboveLayerId, geoJsonOptions); } @Override diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/CircleOptions.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/CircleOptions.java index 7023dc3d..038a8005 100644 --- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/CircleOptions.java +++ b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/CircleOptions.java @@ -6,12 +6,12 @@ import androidx.annotation.Nullable; import com.google.gson.*; -import com.mapbox.geojson.Geometry; -import com.mapbox.mapboxsdk.style.layers.Property; -import com.mapbox.mapboxsdk.style.layers.PropertyFactory; +import org.maplibre.geojson.Geometry; +import org.maplibre.android.style.layers.Property; +import org.maplibre.android.style.layers.PropertyFactory; -import com.mapbox.geojson.*; -import com.mapbox.mapboxsdk.geometry.LatLng; +import org.maplibre.geojson.*; +import org.maplibre.android.geometry.LatLng; import java.util.ArrayList; import java.util.List; diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/ClusterOptions.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/ClusterOptions.java index d635b986..320236e7 100644 --- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/ClusterOptions.java +++ b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/ClusterOptions.java @@ -5,26 +5,13 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.util.Pair; +import org.maplibre.android.maps.Style; +import org.maplibre.android.style.expressions.Expression; +import org.maplibre.android.style.layers.CircleLayer; +import org.maplibre.android.style.layers.SymbolLayer; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.style.expressions.Expression; -import com.mapbox.mapboxsdk.style.layers.CircleLayer; -import com.mapbox.mapboxsdk.style.layers.SymbolLayer; - -import static com.mapbox.mapboxsdk.style.expressions.Expression.all; -import static com.mapbox.mapboxsdk.style.expressions.Expression.get; -import static com.mapbox.mapboxsdk.style.expressions.Expression.gt; -import static com.mapbox.mapboxsdk.style.expressions.Expression.gte; -import static com.mapbox.mapboxsdk.style.expressions.Expression.has; -import static com.mapbox.mapboxsdk.style.expressions.Expression.literal; -import static com.mapbox.mapboxsdk.style.expressions.Expression.lt; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleColor; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.circleRadius; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textAllowOverlap; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textColor; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textField; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textIgnorePlacement; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textSize; +import static org.maplibre.android.style.expressions.Expression.*; +import static org.maplibre.android.style.layers.PropertyFactory.*; /** * Options to show and configure symbol clustering with using SymbolManager. diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/CoreElementProvider.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/CoreElementProvider.java index eb100e25..a0c0f9de 100644 --- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/CoreElementProvider.java +++ b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/CoreElementProvider.java @@ -1,9 +1,8 @@ package com.mapbox.mapboxsdk.plugins.annotation; -import com.mapbox.mapboxsdk.style.layers.Layer; -import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; -import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; - +import org.maplibre.android.style.layers.Layer; +import org.maplibre.android.style.sources.GeoJsonSource; +import org.maplibre.android.style.sources.GeoJsonOptions; import androidx.annotation.Nullable; interface CoreElementProvider { diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/DraggableAnnotationController.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/DraggableAnnotationController.java index 0a2bad95..c632924c 100644 --- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/DraggableAnnotationController.java +++ b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/DraggableAnnotationController.java @@ -13,9 +13,9 @@ import com.mapbox.android.gestures.AndroidGesturesManager; import com.mapbox.android.gestures.MoveDistancesObject; import com.mapbox.android.gestures.MoveGestureDetector; -import com.mapbox.geojson.Geometry; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; +import org.maplibre.geojson.Geometry; +import org.maplibre.android.maps.MapLibreMap; +import org.maplibre.android.maps.MapView; import java.util.HashMap; import java.util.LinkedList; @@ -26,9 +26,9 @@ final class DraggableAnnotationController { private static DraggableAnnotationController INSTANCE = null; - public static DraggableAnnotationController getInstance(MapView mapView, MapboxMap mapboxMap) { - if (INSTANCE == null || INSTANCE.mapView != mapView || INSTANCE.mapboxMap != mapboxMap) { - INSTANCE = new DraggableAnnotationController(mapView, mapboxMap); + public static DraggableAnnotationController getInstance(MapView mapView, MapLibreMap maplibreMap) { + if (INSTANCE == null || INSTANCE.mapView != mapView || INSTANCE.maplibreMap != maplibreMap) { + INSTANCE = new DraggableAnnotationController(mapView, maplibreMap); } return INSTANCE; } @@ -36,13 +36,13 @@ public static DraggableAnnotationController getInstance(MapView mapView, MapboxM private static void clearInstance() { if (INSTANCE != null) { INSTANCE.mapView = null; - INSTANCE.mapboxMap = null; + INSTANCE.maplibreMap = null; INSTANCE = null; } } private MapView mapView; - private MapboxMap mapboxMap; + private MapLibreMap maplibreMap; private List annotationManagers = new LinkedList<>(); private HashMap annotationManagersById = new HashMap<>(); @@ -57,18 +57,18 @@ private static void clearInstance() { private AnnotationManager draggedAnnotationManager; @SuppressLint("ClickableViewAccessibility") - DraggableAnnotationController(MapView mapView, MapboxMap mapboxMap) { - this(mapView, mapboxMap, new AndroidGesturesManager(mapView.getContext(), false), + DraggableAnnotationController(MapView mapView, MapLibreMap maplibreMap) { + this(mapView, maplibreMap, new AndroidGesturesManager(mapView.getContext(), false), mapView.getScrollX(), mapView.getScrollY(), mapView.getMeasuredWidth(), mapView.getMeasuredHeight()); } @VisibleForTesting - public DraggableAnnotationController(MapView mapView, MapboxMap mapboxMap, + public DraggableAnnotationController(MapView mapView, MapLibreMap maplibreMap, final AndroidGesturesManager androidGesturesManager, int touchAreaShiftX, int touchAreaShiftY, int touchAreaMaxX, int touchAreaMaxY) { this.mapView = mapView; - this.mapboxMap = mapboxMap; + this.maplibreMap = maplibreMap; this.touchAreaShiftX = touchAreaShiftX; this.touchAreaShiftY = touchAreaShiftY; this.touchAreaMaxX = touchAreaMaxX; @@ -155,7 +155,7 @@ boolean onMove(MoveGestureDetector detector) { } Geometry shiftedGeometry = draggedAnnotation.getOffsetGeometry( - mapboxMap.getProjection(), moveObject, touchAreaShiftX, touchAreaShiftY + maplibreMap.getProjection(), moveObject, touchAreaShiftX, touchAreaShiftY ); if (shiftedGeometry != null) { diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/Fill.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/Fill.java index 9765ebc1..c31ca6f9 100644 --- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/Fill.java +++ b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/Fill.java @@ -12,19 +12,19 @@ import com.google.gson.JsonArray; import com.google.gson.JsonNull; import com.google.gson.JsonObject; -import com.mapbox.geojson.*; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.style.layers.Property; -import com.mapbox.mapboxsdk.style.layers.PropertyFactory; -import com.mapbox.mapboxsdk.utils.ColorUtils; +import org.maplibre.geojson.*; +import org.maplibre.android.geometry.LatLng; +import org.maplibre.android.style.layers.Property; +import org.maplibre.android.style.layers.PropertyFactory; +import org.maplibre.android.utils.ColorUtils; import com.mapbox.android.gestures.MoveDistancesObject; -import com.mapbox.mapboxsdk.maps.Projection; +import org.maplibre.android.maps.Projection; import java.util.ArrayList; import java.util.List; -import static com.mapbox.mapboxsdk.constants.GeometryConstants.MAX_MERCATOR_LATITUDE; -import static com.mapbox.mapboxsdk.constants.GeometryConstants.MIN_MERCATOR_LATITUDE; +import static org.maplibre.android.constants.GeometryConstants.MAX_MERCATOR_LATITUDE; +import static org.maplibre.android.constants.GeometryConstants.MIN_MERCATOR_LATITUDE; @UiThread public class Fill extends Annotation { diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/FillElementProvider.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/FillElementProvider.java index 1834bd33..0c8f0cce 100644 --- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/FillElementProvider.java +++ b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/FillElementProvider.java @@ -4,9 +4,9 @@ import androidx.annotation.Nullable; -import com.mapbox.mapboxsdk.style.layers.FillLayer; -import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; -import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; +import org.maplibre.android.style.layers.FillLayer; +import org.maplibre.android.style.sources.GeoJsonOptions; +import org.maplibre.android.style.sources.GeoJsonSource; import java.util.concurrent.atomic.AtomicLong; diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/FillManager.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/FillManager.java index 50f64816..719ffcac 100644 --- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/FillManager.java +++ b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/FillManager.java @@ -7,23 +7,23 @@ import androidx.annotation.UiThread; import androidx.annotation.VisibleForTesting; -import com.mapbox.geojson.Feature; -import com.mapbox.geojson.FeatureCollection; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.style.expressions.Expression; -import com.mapbox.mapboxsdk.style.layers.FillLayer; -import com.mapbox.mapboxsdk.style.layers.PropertyValue; -import com.mapbox.mapboxsdk.style.layers.PropertyFactory; -import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; -import com.mapbox.mapboxsdk.style.layers.Property; +import org.maplibre.geojson.Feature; +import org.maplibre.geojson.FeatureCollection; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.MapLibreMap; +import org.maplibre.android.maps.Style; +import org.maplibre.android.style.expressions.Expression; +import org.maplibre.android.style.layers.FillLayer; +import org.maplibre.android.style.layers.PropertyValue; +import org.maplibre.android.style.layers.PropertyFactory; +import org.maplibre.android.style.sources.GeoJsonOptions; +import org.maplibre.android.style.layers.Property; import java.util.ArrayList; import java.util.List; -import static com.mapbox.mapboxsdk.style.expressions.Expression.get; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*; +import static org.maplibre.android.style.expressions.Expression.get; +import static org.maplibre.android.style.layers.PropertyFactory.*; /** * The fill manager allows to add fills to a map. @@ -37,44 +37,44 @@ public class FillManager extends AnnotationManager coreElementProvider, @Nullable String belowLayerId, @Nullable String aboveLayerId, @Nullable GeoJsonOptions geoJsonOptions, DraggableAnnotationController draggableAnnotationController) { - super(mapView, mapboxMap, style, coreElementProvider, draggableAnnotationController, belowLayerId, aboveLayerId, geoJsonOptions); + FillManager(@NonNull MapView mapView, @NonNull MapLibreMap maplibreMap, @NonNull Style style, @NonNull CoreElementProvider coreElementProvider, @Nullable String belowLayerId, @Nullable String aboveLayerId, @Nullable GeoJsonOptions geoJsonOptions, DraggableAnnotationController draggableAnnotationController) { + super(mapView, maplibreMap, style, coreElementProvider, draggableAnnotationController, belowLayerId, aboveLayerId, geoJsonOptions); } @Override diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/FillOptions.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/FillOptions.java index d80045aa..c335ff90 100644 --- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/FillOptions.java +++ b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/FillOptions.java @@ -6,12 +6,12 @@ import androidx.annotation.Nullable; import com.google.gson.*; -import com.mapbox.geojson.Geometry; -import com.mapbox.mapboxsdk.style.layers.Property; -import com.mapbox.mapboxsdk.style.layers.PropertyFactory; +import org.maplibre.geojson.Geometry; +import org.maplibre.android.style.layers.Property; +import org.maplibre.android.style.layers.PropertyFactory; -import com.mapbox.geojson.*; -import com.mapbox.mapboxsdk.geometry.LatLng; +import org.maplibre.geojson.*; +import org.maplibre.android.geometry.LatLng; import java.util.ArrayList; import java.util.List; diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/Line.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/Line.java index 8c516033..7ebde82d 100644 --- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/Line.java +++ b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/Line.java @@ -12,19 +12,19 @@ import com.google.gson.JsonArray; import com.google.gson.JsonNull; import com.google.gson.JsonObject; -import com.mapbox.geojson.*; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.style.layers.Property; -import com.mapbox.mapboxsdk.style.layers.PropertyFactory; -import com.mapbox.mapboxsdk.utils.ColorUtils; +import org.maplibre.geojson.*; +import org.maplibre.android.geometry.LatLng; +import org.maplibre.android.style.layers.Property; +import org.maplibre.android.style.layers.PropertyFactory; +import org.maplibre.android.utils.ColorUtils; import com.mapbox.android.gestures.MoveDistancesObject; -import com.mapbox.mapboxsdk.maps.Projection; +import org.maplibre.android.maps.Projection; import java.util.ArrayList; import java.util.List; -import static com.mapbox.mapboxsdk.constants.GeometryConstants.MAX_MERCATOR_LATITUDE; -import static com.mapbox.mapboxsdk.constants.GeometryConstants.MIN_MERCATOR_LATITUDE; +import static org.maplibre.android.constants.GeometryConstants.MAX_MERCATOR_LATITUDE; +import static org.maplibre.android.constants.GeometryConstants.MIN_MERCATOR_LATITUDE; @UiThread public class Line extends Annotation { diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/LineElementProvider.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/LineElementProvider.java index a9eed838..00ee488b 100644 --- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/LineElementProvider.java +++ b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/LineElementProvider.java @@ -4,9 +4,9 @@ import androidx.annotation.Nullable; -import com.mapbox.mapboxsdk.style.layers.LineLayer; -import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; -import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; +import org.maplibre.android.style.layers.LineLayer; +import org.maplibre.android.style.sources.GeoJsonOptions; +import org.maplibre.android.style.sources.GeoJsonSource; import java.util.concurrent.atomic.AtomicLong; diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/LineManager.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/LineManager.java index d47df80b..efa3b56e 100644 --- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/LineManager.java +++ b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/LineManager.java @@ -7,23 +7,23 @@ import androidx.annotation.UiThread; import androidx.annotation.VisibleForTesting; -import com.mapbox.geojson.Feature; -import com.mapbox.geojson.FeatureCollection; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.style.expressions.Expression; -import com.mapbox.mapboxsdk.style.layers.LineLayer; -import com.mapbox.mapboxsdk.style.layers.PropertyValue; -import com.mapbox.mapboxsdk.style.layers.PropertyFactory; -import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; -import com.mapbox.mapboxsdk.style.layers.Property; +import org.maplibre.geojson.Feature; +import org.maplibre.geojson.FeatureCollection; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.MapLibreMap; +import org.maplibre.android.maps.Style; +import org.maplibre.android.style.expressions.Expression; +import org.maplibre.android.style.layers.LineLayer; +import org.maplibre.android.style.layers.PropertyValue; +import org.maplibre.android.style.layers.PropertyFactory; +import org.maplibre.android.style.sources.GeoJsonOptions; +import org.maplibre.android.style.layers.Property; import java.util.ArrayList; import java.util.List; -import static com.mapbox.mapboxsdk.style.expressions.Expression.get; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*; +import static org.maplibre.android.style.expressions.Expression.get; +import static org.maplibre.android.style.layers.PropertyFactory.*; /** * The line manager allows to add lines to a map. @@ -40,44 +40,44 @@ public class LineManager extends AnnotationManager coreElementProvider, @Nullable String belowLayerId, @Nullable String aboveLayerId, @Nullable GeoJsonOptions geoJsonOptions, DraggableAnnotationController draggableAnnotationController) { - super(mapView, mapboxMap, style, coreElementProvider, draggableAnnotationController, belowLayerId, aboveLayerId, geoJsonOptions); + LineManager(@NonNull MapView mapView, @NonNull MapLibreMap maplibreMap, @NonNull Style style, @NonNull CoreElementProvider coreElementProvider, @Nullable String belowLayerId, @Nullable String aboveLayerId, @Nullable GeoJsonOptions geoJsonOptions, DraggableAnnotationController draggableAnnotationController) { + super(mapView, maplibreMap, style, coreElementProvider, draggableAnnotationController, belowLayerId, aboveLayerId, geoJsonOptions); } @Override diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/LineOptions.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/LineOptions.java index 8ebdd358..214eb501 100644 --- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/LineOptions.java +++ b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/LineOptions.java @@ -6,12 +6,12 @@ import androidx.annotation.Nullable; import com.google.gson.*; -import com.mapbox.geojson.Geometry; -import com.mapbox.mapboxsdk.style.layers.Property; -import com.mapbox.mapboxsdk.style.layers.PropertyFactory; +import org.maplibre.geojson.Geometry; +import org.maplibre.android.style.layers.Property; +import org.maplibre.android.style.layers.PropertyFactory; -import com.mapbox.geojson.*; -import com.mapbox.mapboxsdk.geometry.LatLng; +import org.maplibre.geojson.*; +import org.maplibre.android.geometry.LatLng; import java.util.ArrayList; import java.util.List; diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/Symbol.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/Symbol.java index a9f88adb..5bce6ed4 100644 --- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/Symbol.java +++ b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/Symbol.java @@ -12,19 +12,19 @@ import com.google.gson.JsonArray; import com.google.gson.JsonNull; import com.google.gson.JsonObject; -import com.mapbox.geojson.*; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.style.layers.Property; -import com.mapbox.mapboxsdk.style.layers.PropertyFactory; -import com.mapbox.mapboxsdk.utils.ColorUtils; +import org.maplibre.geojson.*; +import org.maplibre.android.geometry.LatLng; +import org.maplibre.android.style.layers.Property; +import org.maplibre.android.style.layers.PropertyFactory; +import org.maplibre.android.utils.ColorUtils; import com.mapbox.android.gestures.MoveDistancesObject; -import com.mapbox.mapboxsdk.maps.Projection; +import org.maplibre.android.maps.Projection; import java.util.ArrayList; import java.util.List; -import static com.mapbox.mapboxsdk.constants.GeometryConstants.MAX_MERCATOR_LATITUDE; -import static com.mapbox.mapboxsdk.constants.GeometryConstants.MIN_MERCATOR_LATITUDE; +import static org.maplibre.android.constants.GeometryConstants.MAX_MERCATOR_LATITUDE; +import static org.maplibre.android.constants.GeometryConstants.MIN_MERCATOR_LATITUDE; @UiThread public class Symbol extends Annotation { diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolElementProvider.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolElementProvider.java index 5d296860..f0d8d059 100644 --- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolElementProvider.java +++ b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolElementProvider.java @@ -4,9 +4,9 @@ import androidx.annotation.Nullable; -import com.mapbox.mapboxsdk.style.layers.SymbolLayer; -import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; -import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; +import org.maplibre.android.style.layers.SymbolLayer; +import org.maplibre.android.style.sources.GeoJsonOptions; +import org.maplibre.android.style.sources.GeoJsonSource; import java.util.concurrent.atomic.AtomicLong; diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolManager.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolManager.java index aec25027..2cedf332 100644 --- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolManager.java +++ b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolManager.java @@ -7,23 +7,23 @@ import androidx.annotation.UiThread; import androidx.annotation.VisibleForTesting; -import com.mapbox.geojson.Feature; -import com.mapbox.geojson.FeatureCollection; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.style.expressions.Expression; -import com.mapbox.mapboxsdk.style.layers.SymbolLayer; -import com.mapbox.mapboxsdk.style.layers.PropertyValue; -import com.mapbox.mapboxsdk.style.layers.PropertyFactory; -import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; -import com.mapbox.mapboxsdk.style.layers.Property; +import org.maplibre.geojson.Feature; +import org.maplibre.geojson.FeatureCollection; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.MapLibreMap; +import org.maplibre.android.maps.Style; +import org.maplibre.android.style.expressions.Expression; +import org.maplibre.android.style.layers.SymbolLayer; +import org.maplibre.android.style.layers.PropertyValue; +import org.maplibre.android.style.layers.PropertyFactory; +import org.maplibre.android.style.sources.GeoJsonOptions; +import org.maplibre.android.style.layers.Property; import java.util.ArrayList; import java.util.List; -import static com.mapbox.mapboxsdk.style.expressions.Expression.get; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*; +import static org.maplibre.android.style.expressions.Expression.get; +import static org.maplibre.android.style.layers.PropertyFactory.*; /** * The symbol manager allows to add symbols to a map. @@ -60,59 +60,59 @@ public class SymbolManager extends AnnotationManager coreElementProvider, @Nullable String belowLayerId, @Nullable String aboveLayerId, @Nullable GeoJsonOptions geoJsonOptions, DraggableAnnotationController draggableAnnotationController) { - super(mapView, mapboxMap, style, coreElementProvider, draggableAnnotationController, belowLayerId, aboveLayerId, geoJsonOptions); + SymbolManager(@NonNull MapView mapView, @NonNull MapLibreMap maplibreMap, @NonNull Style style, @NonNull CoreElementProvider coreElementProvider, @Nullable String belowLayerId, @Nullable String aboveLayerId, @Nullable GeoJsonOptions geoJsonOptions, DraggableAnnotationController draggableAnnotationController) { + super(mapView, maplibreMap, style, coreElementProvider, draggableAnnotationController, belowLayerId, aboveLayerId, geoJsonOptions); } @Override diff --git a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolOptions.java b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolOptions.java index 1571bce6..6b35f063 100644 --- a/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolOptions.java +++ b/plugin-annotation/src/main/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolOptions.java @@ -6,12 +6,12 @@ import androidx.annotation.Nullable; import com.google.gson.*; -import com.mapbox.geojson.Geometry; -import com.mapbox.mapboxsdk.style.layers.Property; -import com.mapbox.mapboxsdk.style.layers.PropertyFactory; +import org.maplibre.geojson.Geometry; +import org.maplibre.android.style.layers.Property; +import org.maplibre.android.style.layers.PropertyFactory; -import com.mapbox.geojson.*; -import com.mapbox.mapboxsdk.geometry.LatLng; +import org.maplibre.geojson.*; +import org.maplibre.android.geometry.LatLng; import java.util.ArrayList; import java.util.List; diff --git a/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/CircleManagerTest.java b/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/CircleManagerTest.java index 9a3180ea..40ba331b 100644 --- a/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/CircleManagerTest.java +++ b/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/CircleManagerTest.java @@ -5,16 +5,16 @@ import android.graphics.PointF; import com.google.gson.JsonPrimitive; -import com.mapbox.geojson.*; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.style.expressions.Expression; -import com.mapbox.mapboxsdk.style.layers.*; -import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; -import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; -import com.mapbox.mapboxsdk.utils.ColorUtils; +import org.maplibre.geojson.*; +import org.maplibre.android.geometry.LatLng; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.MapLibreMap; +import org.maplibre.android.maps.Style; +import org.maplibre.android.style.expressions.Expression; +import org.maplibre.android.style.layers.*; +import org.maplibre.android.style.sources.GeoJsonOptions; +import org.maplibre.android.style.sources.GeoJsonSource; +import org.maplibre.android.utils.ColorUtils; import org.junit.Before; import org.junit.Test; @@ -25,9 +25,9 @@ import java.util.Arrays; import static com.mapbox.mapboxsdk.plugins.annotation.ConvertUtils.convertArray; -import static com.mapbox.mapboxsdk.style.expressions.Expression.get; -import static com.mapbox.mapboxsdk.style.layers.Property.*; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*; +import static org.maplibre.android.style.expressions.Expression.get; +import static org.maplibre.android.style.layers.Property.*; +import static org.maplibre.android.style.layers.PropertyFactory.*; import static junit.framework.Assert.*; import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.Mockito.*; @@ -36,7 +36,7 @@ public class CircleManagerTest { private DraggableAnnotationController draggableAnnotationController = mock(DraggableAnnotationController.class); private MapView mapView = mock(MapView.class); - private MapboxMap mapboxMap = mock(MapboxMap.class); + private MapLibreMap maplibreMap = mock(MapLibreMap.class); private Style style = mock(Style.class); private GeoJsonSource geoJsonSource = mock(GeoJsonSource.class); private GeoJsonSource optionedGeoJsonSource = mock(GeoJsonSource.class); @@ -57,7 +57,7 @@ public void beforeTest() { @Test public void testInitialization() { - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(style).addSource(geoJsonSource); verify(style).addLayer(circleLayer); assertTrue(circleManager.dataDrivenPropertyUsageMap.size() > 0); @@ -70,7 +70,7 @@ public void testInitialization() { @Test public void testInitializationOnStyleReload() { - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(style).addSource(geoJsonSource); verify(style).addLayer(circleLayer); assertTrue(circleManager.dataDrivenPropertyUsageMap.size() > 0); @@ -87,7 +87,7 @@ public void testInitializationOnStyleReload() { loadingArgumentCaptor.getValue().onDidFinishLoadingStyle(); ArgumentCaptor styleLoadedArgumentCaptor = ArgumentCaptor.forClass(Style.OnStyleLoaded.class); - verify(mapboxMap).getStyle(styleLoadedArgumentCaptor.capture()); + verify(maplibreMap).getStyle(styleLoadedArgumentCaptor.capture()); Style newStyle = mock(Style.class); when(newStyle.isFullyLoaded()).thenReturn(true); @@ -109,7 +109,7 @@ public void testInitializationOnStyleReload() { @Test public void testLayerBelowInitialization() { - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, "test_layer", null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, "test_layer", null, null, draggableAnnotationController); verify(style).addSource(geoJsonSource); verify(style).addLayerBelow(circleLayer, "test_layer"); assertTrue(circleManager.dataDrivenPropertyUsageMap.size() > 0); @@ -121,7 +121,7 @@ public void testLayerBelowInitialization() { @Test public void testGeoJsonOptionsInitialization() { - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, geoJsonOptions, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, geoJsonOptions, draggableAnnotationController); verify(style).addSource(optionedGeoJsonSource); verify(style).addLayer(circleLayer); assertTrue(circleManager.dataDrivenPropertyUsageMap.size() > 0); @@ -134,20 +134,20 @@ public void testGeoJsonOptionsInitialization() { @Test public void testLayerId() { - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); assertEquals(layerId, circleManager.getLayerId()); } @Test public void testAddCircle() { - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); Circle circle = circleManager.create(new CircleOptions().withLatLng(new LatLng())); assertEquals(circleManager.getAnnotations().get(0), circle); } @Test public void addCircleFromFeatureCollection() { - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); Geometry geometry = Point.fromLngLat(10, 10); Feature feature = Feature.fromGeometry(geometry); @@ -176,7 +176,7 @@ public void addCircleFromFeatureCollection() { @Test public void addCircles() { - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); List latLngList = new ArrayList<>(); latLngList.add(new LatLng()); latLngList.add(new LatLng(1, 1)); @@ -191,7 +191,7 @@ public void addCircles() { @Test public void testDeleteCircle() { - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); Circle circle = circleManager.create(new CircleOptions().withLatLng(new LatLng())); circleManager.delete(circle); assertTrue(circleManager.getAnnotations().size() == 0); @@ -199,7 +199,7 @@ public void testDeleteCircle() { @Test public void testGeometryCircle() { - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); LatLng latLng = new LatLng(12, 34); CircleOptions options = new CircleOptions().withLatLng(latLng); Circle circle = circleManager.create(options); @@ -211,7 +211,7 @@ public void testGeometryCircle() { @Test public void testFeatureIdCircle() { - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); Circle circleZero = circleManager.create(new CircleOptions().withLatLng(new LatLng())); Circle circleOne = circleManager.create(new CircleOptions().withLatLng(new LatLng())); assertEquals(circleZero.getFeature().get(Circle.ID_KEY).getAsLong(), 0); @@ -220,7 +220,7 @@ public void testFeatureIdCircle() { @Test public void testCircleDraggableFlag() { - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); Circle circleZero = circleManager.create(new CircleOptions().withLatLng(new LatLng())); assertFalse(circleZero.isDraggable()); @@ -233,7 +233,7 @@ public void testCircleDraggableFlag() { @Test public void testCircleRadiusLayerProperty() { - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(circleLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(circleRadius(get("circle-radius"))))); CircleOptions options = new CircleOptions().withLatLng(new LatLng()).withCircleRadius(2.0f); @@ -247,7 +247,7 @@ public void testCircleRadiusLayerProperty() { @Test public void testCircleColorLayerProperty() { - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(circleLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(circleColor(get("circle-color"))))); CircleOptions options = new CircleOptions().withLatLng(new LatLng()).withCircleColor("rgba(0, 0, 0, 1)"); @@ -261,7 +261,7 @@ public void testCircleColorLayerProperty() { @Test public void testCircleBlurLayerProperty() { - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(circleLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(circleBlur(get("circle-blur"))))); CircleOptions options = new CircleOptions().withLatLng(new LatLng()).withCircleBlur(2.0f); @@ -275,7 +275,7 @@ public void testCircleBlurLayerProperty() { @Test public void testCircleOpacityLayerProperty() { - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(circleLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(circleOpacity(get("circle-opacity"))))); CircleOptions options = new CircleOptions().withLatLng(new LatLng()).withCircleOpacity(2.0f); @@ -289,7 +289,7 @@ public void testCircleOpacityLayerProperty() { @Test public void testCircleStrokeWidthLayerProperty() { - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(circleLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(circleStrokeWidth(get("circle-stroke-width"))))); CircleOptions options = new CircleOptions().withLatLng(new LatLng()).withCircleStrokeWidth(2.0f); @@ -303,7 +303,7 @@ public void testCircleStrokeWidthLayerProperty() { @Test public void testCircleStrokeColorLayerProperty() { - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(circleLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(circleStrokeColor(get("circle-stroke-color"))))); CircleOptions options = new CircleOptions().withLatLng(new LatLng()).withCircleStrokeColor("rgba(0, 0, 0, 1)"); @@ -317,7 +317,7 @@ public void testCircleStrokeColorLayerProperty() { @Test public void testCircleStrokeOpacityLayerProperty() { - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(circleLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(circleStrokeOpacity(get("circle-stroke-opacity"))))); CircleOptions options = new CircleOptions().withLatLng(new LatLng()).withCircleStrokeOpacity(2.0f); @@ -331,7 +331,7 @@ public void testCircleStrokeOpacityLayerProperty() { @Test public void testCircleLayerFilter() { - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); Expression expression = Expression.eq(Expression.get("test"), "selected"); verify(circleLayer, times(0)).setFilter(expression); @@ -346,7 +346,7 @@ public void testCircleLayerFilter() { @Test public void testClickListener() { OnCircleClickListener listener = mock(OnCircleClickListener.class); - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); assertTrue(circleManager.getClickListeners().isEmpty()); circleManager.addClickListener(listener); assertTrue(circleManager.getClickListeners().contains(listener)); @@ -357,7 +357,7 @@ public void testClickListener() { @Test public void testLongClickListener() { OnCircleLongClickListener listener = mock(OnCircleLongClickListener.class); - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); assertTrue(circleManager.getLongClickListeners().isEmpty()); circleManager.addLongClickListener(listener); assertTrue(circleManager.getLongClickListeners().contains(listener)); @@ -368,7 +368,7 @@ public void testLongClickListener() { @Test public void testDragListener() { OnCircleDragListener listener = mock(OnCircleDragListener.class); - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); assertTrue(circleManager.getDragListeners().isEmpty()); circleManager.addDragListener(listener); assertTrue(circleManager.getDragListeners().contains(listener)); @@ -378,7 +378,7 @@ public void testDragListener() { @Test public void testCustomData() { - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); CircleOptions options = new CircleOptions().withLatLng(new LatLng()); options.withData(new JsonPrimitive("hello")); Circle circle = circleManager.create(options); @@ -387,7 +387,7 @@ public void testCustomData() { @Test public void testClearAll() { - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); CircleOptions options = new CircleOptions().withLatLng(new LatLng()); circleManager.create(options); assertEquals(1, circleManager.getAnnotations().size()); @@ -397,7 +397,7 @@ public void testClearAll() { @Test public void testIgnoreClearedAnnotations() { - circleManager = new CircleManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + circleManager = new CircleManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); CircleOptions options = new CircleOptions().withLatLng(new LatLng()); Circle circle = circleManager.create(options); assertEquals(1, circleManager.annotations.size()); diff --git a/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/DraggableAnnotationControllerTest.java b/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/DraggableAnnotationControllerTest.java index 10817ffe..2aae6d9e 100644 --- a/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/DraggableAnnotationControllerTest.java +++ b/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/DraggableAnnotationControllerTest.java @@ -5,14 +5,14 @@ import com.mapbox.android.gestures.AndroidGesturesManager; import com.mapbox.android.gestures.MoveDistancesObject; import com.mapbox.android.gestures.MoveGestureDetector; -import com.mapbox.geojson.Geometry; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Projection; +import org.maplibre.geojson.Geometry; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.maplibre.android.maps.MapLibreMap; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.Projection; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.robolectric.RobolectricTestRunner; @@ -37,7 +37,7 @@ public class DraggableAnnotationControllerTest { private MapView mapView; @Mock - private MapboxMap mapboxMap; + private MapLibreMap maplibreMap; @Mock private Projection projection; @@ -70,7 +70,7 @@ public class DraggableAnnotationControllerTest { @Before public void before() { MockitoAnnotations.initMocks(this); - draggableAnnotationController = new DraggableAnnotationController(mapView, mapboxMap, androidGesturesManager, + draggableAnnotationController = new DraggableAnnotationController(mapView, maplibreMap, androidGesturesManager, 0, 0, touchAreaMaxX, touchAreaMaxY); draggableAnnotationController.addAnnotationManager(annotationManager); dragListenerList = new ArrayList<>(); @@ -237,7 +237,7 @@ public void gestureOnMoveMoveNoGeometryTest() { when(moveObject.getCurrentX()).thenReturn(10f); when(moveObject.getCurrentY()).thenReturn(10f); - when(mapboxMap.getProjection()).thenReturn(projection); + when(maplibreMap.getProjection()).thenReturn(projection); when(annotation.getOffsetGeometry(projection, moveObject, 0, 0)).thenReturn(null); boolean moved = draggableAnnotationController.onMove(moveGestureDetector); @@ -258,7 +258,7 @@ public void gestureOnMoveTest() { when(moveObject.getCurrentX()).thenReturn(10f); when(moveObject.getCurrentY()).thenReturn(10f); - when(mapboxMap.getProjection()).thenReturn(projection); + when(maplibreMap.getProjection()).thenReturn(projection); when(annotation.getOffsetGeometry(projection, moveObject, 0, 0)).thenReturn(geometry); boolean moved = draggableAnnotationController.onMove(moveGestureDetector); @@ -291,7 +291,7 @@ public void startedNotDraggableTest() { when(moveObject.getCurrentX()).thenReturn(10f); when(moveObject.getCurrentY()).thenReturn(10f); - when(mapboxMap.getProjection()).thenReturn(projection); + when(maplibreMap.getProjection()).thenReturn(projection); when(annotation.getOffsetGeometry(projection, moveObject, 0, 0)).thenReturn(geometry); boolean moved = draggableAnnotationController.onMove(moveGestureDetector); @@ -312,7 +312,7 @@ public void moveNotDraggableTest() { when(moveObject.getCurrentX()).thenReturn(10f); when(moveObject.getCurrentY()).thenReturn(10f); - when(mapboxMap.getProjection()).thenReturn(projection); + when(maplibreMap.getProjection()).thenReturn(projection); when(annotation.getOffsetGeometry(projection, moveObject, 0, 0)).thenReturn(geometry); when(annotation.isDraggable()).thenReturn(false); diff --git a/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/FillManagerTest.java b/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/FillManagerTest.java index fc6b9cc4..dff6a9cb 100644 --- a/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/FillManagerTest.java +++ b/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/FillManagerTest.java @@ -5,16 +5,16 @@ import android.graphics.PointF; import com.google.gson.JsonPrimitive; -import com.mapbox.geojson.*; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.style.expressions.Expression; -import com.mapbox.mapboxsdk.style.layers.*; -import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; -import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; -import com.mapbox.mapboxsdk.utils.ColorUtils; +import org.maplibre.geojson.*; +import org.maplibre.android.geometry.LatLng; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.MapLibreMap; +import org.maplibre.android.maps.Style; +import org.maplibre.android.style.expressions.Expression; +import org.maplibre.android.style.layers.*; +import org.maplibre.android.style.sources.GeoJsonOptions; +import org.maplibre.android.style.sources.GeoJsonSource; +import org.maplibre.android.utils.ColorUtils; import org.junit.Before; import org.junit.Test; @@ -25,9 +25,9 @@ import java.util.Arrays; import static com.mapbox.mapboxsdk.plugins.annotation.ConvertUtils.convertArray; -import static com.mapbox.mapboxsdk.style.expressions.Expression.get; -import static com.mapbox.mapboxsdk.style.layers.Property.*; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*; +import static org.maplibre.android.style.expressions.Expression.get; +import static org.maplibre.android.style.layers.Property.*; +import static org.maplibre.android.style.layers.PropertyFactory.*; import static junit.framework.Assert.*; import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.Mockito.*; @@ -36,7 +36,7 @@ public class FillManagerTest { private DraggableAnnotationController draggableAnnotationController = mock(DraggableAnnotationController.class); private MapView mapView = mock(MapView.class); - private MapboxMap mapboxMap = mock(MapboxMap.class); + private MapLibreMap maplibreMap = mock(MapLibreMap.class); private Style style = mock(Style.class); private GeoJsonSource geoJsonSource = mock(GeoJsonSource.class); private GeoJsonSource optionedGeoJsonSource = mock(GeoJsonSource.class); @@ -57,7 +57,7 @@ public void beforeTest() { @Test public void testInitialization() { - fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + fillManager = new FillManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(style).addSource(geoJsonSource); verify(style).addLayer(fillLayer); assertTrue(fillManager.dataDrivenPropertyUsageMap.size() > 0); @@ -70,7 +70,7 @@ public void testInitialization() { @Test public void testInitializationOnStyleReload() { - fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + fillManager = new FillManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(style).addSource(geoJsonSource); verify(style).addLayer(fillLayer); assertTrue(fillManager.dataDrivenPropertyUsageMap.size() > 0); @@ -87,7 +87,7 @@ public void testInitializationOnStyleReload() { loadingArgumentCaptor.getValue().onDidFinishLoadingStyle(); ArgumentCaptor styleLoadedArgumentCaptor = ArgumentCaptor.forClass(Style.OnStyleLoaded.class); - verify(mapboxMap).getStyle(styleLoadedArgumentCaptor.capture()); + verify(maplibreMap).getStyle(styleLoadedArgumentCaptor.capture()); Style newStyle = mock(Style.class); when(newStyle.isFullyLoaded()).thenReturn(true); @@ -109,7 +109,7 @@ public void testInitializationOnStyleReload() { @Test public void testLayerBelowInitialization() { - fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, "test_layer", null, null, draggableAnnotationController); + fillManager = new FillManager(mapView, maplibreMap, style, coreElementProvider, "test_layer", null, null, draggableAnnotationController); verify(style).addSource(geoJsonSource); verify(style).addLayerBelow(fillLayer, "test_layer"); assertTrue(fillManager.dataDrivenPropertyUsageMap.size() > 0); @@ -121,7 +121,7 @@ public void testLayerBelowInitialization() { @Test public void testGeoJsonOptionsInitialization() { - fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, geoJsonOptions, draggableAnnotationController); + fillManager = new FillManager(mapView, maplibreMap, style, coreElementProvider, null, null, geoJsonOptions, draggableAnnotationController); verify(style).addSource(optionedGeoJsonSource); verify(style).addLayer(fillLayer); assertTrue(fillManager.dataDrivenPropertyUsageMap.size() > 0); @@ -134,13 +134,13 @@ public void testGeoJsonOptionsInitialization() { @Test public void testLayerId() { - fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + fillManager = new FillManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); assertEquals(layerId, fillManager.getLayerId()); } @Test public void testAddFill() { - fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + fillManager = new FillManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); List innerLatLngs = new ArrayList<>(); innerLatLngs.add(new LatLng()); innerLatLngs.add(new LatLng(1, 1)); @@ -154,7 +154,7 @@ public void testAddFill() { @Test public void addFillFromFeatureCollection() { - fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + fillManager = new FillManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); List innerPoints = new ArrayList<>(); innerPoints.add(Point.fromLngLat(0, 0)); innerPoints.add(Point.fromLngLat(1, 1)); @@ -184,7 +184,7 @@ public void addFillFromFeatureCollection() { @Test public void addFills() { - fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + fillManager = new FillManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); final List> latLngListOne = new ArrayList<>(); latLngListOne.add(new ArrayList() {{ add(new LatLng(2, 2)); @@ -220,7 +220,7 @@ public void addFills() { @Test public void testDeleteFill() { - fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + fillManager = new FillManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); List innerLatLngs = new ArrayList<>(); innerLatLngs.add(new LatLng()); innerLatLngs.add(new LatLng(1, 1)); @@ -234,7 +234,7 @@ public void testDeleteFill() { @Test public void testGeometryFill() { - fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + fillManager = new FillManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); List innerLatLngs = new ArrayList<>(); innerLatLngs.add(new LatLng()); innerLatLngs.add(new LatLng(1, 1)); @@ -263,7 +263,7 @@ public void testGeometryFill() { @Test public void testFeatureIdFill() { - fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + fillManager = new FillManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); List innerLatLngs = new ArrayList<>(); innerLatLngs.add(new LatLng()); innerLatLngs.add(new LatLng(1, 1)); @@ -278,7 +278,7 @@ public void testFeatureIdFill() { @Test public void testFillDraggableFlag() { - fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + fillManager = new FillManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); List innerLatLngs = new ArrayList<>(); innerLatLngs.add(new LatLng()); innerLatLngs.add(new LatLng(1, 1)); @@ -297,7 +297,7 @@ public void testFillDraggableFlag() { @Test public void testFillOpacityLayerProperty() { - fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + fillManager = new FillManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(fillLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(fillOpacity(get("fill-opacity"))))); List innerLatLngs = new ArrayList<>(); @@ -317,7 +317,7 @@ public void testFillOpacityLayerProperty() { @Test public void testFillColorLayerProperty() { - fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + fillManager = new FillManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(fillLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(fillColor(get("fill-color"))))); List innerLatLngs = new ArrayList<>(); @@ -337,7 +337,7 @@ public void testFillColorLayerProperty() { @Test public void testFillOutlineColorLayerProperty() { - fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + fillManager = new FillManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(fillLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(fillOutlineColor(get("fill-outline-color"))))); List innerLatLngs = new ArrayList<>(); @@ -357,7 +357,7 @@ public void testFillOutlineColorLayerProperty() { @Test public void testFillPatternLayerProperty() { - fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + fillManager = new FillManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(fillLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(fillPattern(get("fill-pattern"))))); List innerLatLngs = new ArrayList<>(); @@ -377,7 +377,7 @@ public void testFillPatternLayerProperty() { @Test public void testFillLayerFilter() { - fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + fillManager = new FillManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); Expression expression = Expression.eq(Expression.get("test"), "selected"); verify(fillLayer, times(0)).setFilter(expression); @@ -392,7 +392,7 @@ public void testFillLayerFilter() { @Test public void testClickListener() { OnFillClickListener listener = mock(OnFillClickListener.class); - fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + fillManager = new FillManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); assertTrue(fillManager.getClickListeners().isEmpty()); fillManager.addClickListener(listener); assertTrue(fillManager.getClickListeners().contains(listener)); @@ -403,7 +403,7 @@ public void testClickListener() { @Test public void testLongClickListener() { OnFillLongClickListener listener = mock(OnFillLongClickListener.class); - fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + fillManager = new FillManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); assertTrue(fillManager.getLongClickListeners().isEmpty()); fillManager.addLongClickListener(listener); assertTrue(fillManager.getLongClickListeners().contains(listener)); @@ -414,7 +414,7 @@ public void testLongClickListener() { @Test public void testDragListener() { OnFillDragListener listener = mock(OnFillDragListener.class); - fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + fillManager = new FillManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); assertTrue(fillManager.getDragListeners().isEmpty()); fillManager.addDragListener(listener); assertTrue(fillManager.getDragListeners().contains(listener)); @@ -424,7 +424,7 @@ public void testDragListener() { @Test public void testCustomData() { - fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + fillManager = new FillManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); List innerLatLngs = new ArrayList<>(); innerLatLngs.add(new LatLng()); innerLatLngs.add(new LatLng(1, 1)); @@ -439,7 +439,7 @@ public void testCustomData() { @Test public void testClearAll() { - fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + fillManager = new FillManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); List innerLatLngs = new ArrayList<>(); innerLatLngs.add(new LatLng()); innerLatLngs.add(new LatLng(1, 1)); @@ -455,7 +455,7 @@ public void testClearAll() { @Test public void testIgnoreClearedAnnotations() { - fillManager = new FillManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + fillManager = new FillManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); List innerLatLngs = new ArrayList<>(); innerLatLngs.add(new LatLng()); innerLatLngs.add(new LatLng(1, 1)); diff --git a/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/LineManagerTest.java b/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/LineManagerTest.java index a49547b0..2a92f229 100644 --- a/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/LineManagerTest.java +++ b/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/LineManagerTest.java @@ -5,16 +5,16 @@ import android.graphics.PointF; import com.google.gson.JsonPrimitive; -import com.mapbox.geojson.*; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.style.expressions.Expression; -import com.mapbox.mapboxsdk.style.layers.*; -import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; -import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; -import com.mapbox.mapboxsdk.utils.ColorUtils; +import org.maplibre.geojson.*; +import org.maplibre.android.geometry.LatLng; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.MapLibreMap; +import org.maplibre.android.maps.Style; +import org.maplibre.android.style.expressions.Expression; +import org.maplibre.android.style.layers.*; +import org.maplibre.android.style.sources.GeoJsonOptions; +import org.maplibre.android.style.sources.GeoJsonSource; +import org.maplibre.android.utils.ColorUtils; import org.junit.Before; import org.junit.Test; @@ -25,9 +25,9 @@ import java.util.Arrays; import static com.mapbox.mapboxsdk.plugins.annotation.ConvertUtils.convertArray; -import static com.mapbox.mapboxsdk.style.expressions.Expression.get; -import static com.mapbox.mapboxsdk.style.layers.Property.*; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*; +import static org.maplibre.android.style.expressions.Expression.get; +import static org.maplibre.android.style.layers.Property.*; +import static org.maplibre.android.style.layers.PropertyFactory.*; import static junit.framework.Assert.*; import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.Mockito.*; @@ -36,7 +36,7 @@ public class LineManagerTest { private DraggableAnnotationController draggableAnnotationController = mock(DraggableAnnotationController.class); private MapView mapView = mock(MapView.class); - private MapboxMap mapboxMap = mock(MapboxMap.class); + private MapLibreMap maplibreMap = mock(MapLibreMap.class); private Style style = mock(Style.class); private GeoJsonSource geoJsonSource = mock(GeoJsonSource.class); private GeoJsonSource optionedGeoJsonSource = mock(GeoJsonSource.class); @@ -57,7 +57,7 @@ public void beforeTest() { @Test public void testInitialization() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(style).addSource(geoJsonSource); verify(style).addLayer(lineLayer); assertTrue(lineManager.dataDrivenPropertyUsageMap.size() > 0); @@ -70,7 +70,7 @@ public void testInitialization() { @Test public void testInitializationOnStyleReload() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(style).addSource(geoJsonSource); verify(style).addLayer(lineLayer); assertTrue(lineManager.dataDrivenPropertyUsageMap.size() > 0); @@ -87,7 +87,7 @@ public void testInitializationOnStyleReload() { loadingArgumentCaptor.getValue().onDidFinishLoadingStyle(); ArgumentCaptor styleLoadedArgumentCaptor = ArgumentCaptor.forClass(Style.OnStyleLoaded.class); - verify(mapboxMap).getStyle(styleLoadedArgumentCaptor.capture()); + verify(maplibreMap).getStyle(styleLoadedArgumentCaptor.capture()); Style newStyle = mock(Style.class); when(newStyle.isFullyLoaded()).thenReturn(true); @@ -109,7 +109,7 @@ public void testInitializationOnStyleReload() { @Test public void testLayerBelowInitialization() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, "test_layer", null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, "test_layer", null, null, draggableAnnotationController); verify(style).addSource(geoJsonSource); verify(style).addLayerBelow(lineLayer, "test_layer"); assertTrue(lineManager.dataDrivenPropertyUsageMap.size() > 0); @@ -121,7 +121,7 @@ public void testLayerBelowInitialization() { @Test public void testGeoJsonOptionsInitialization() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, geoJsonOptions, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, geoJsonOptions, draggableAnnotationController); verify(style).addSource(optionedGeoJsonSource); verify(style).addLayer(lineLayer); assertTrue(lineManager.dataDrivenPropertyUsageMap.size() > 0); @@ -134,13 +134,13 @@ public void testGeoJsonOptionsInitialization() { @Test public void testLayerId() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); assertEquals(layerId, lineManager.getLayerId()); } @Test public void testAddLine() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); List latLngs = new ArrayList<>(); latLngs.add(new LatLng()); latLngs.add(new LatLng(1, 1)); @@ -150,7 +150,7 @@ public void testAddLine() { @Test public void addLineFromFeatureCollection() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); List points = new ArrayList<>(); points.add(Point.fromLngLat(0, 0)); points.add(Point.fromLngLat(1, 1)); @@ -184,7 +184,7 @@ public void addLineFromFeatureCollection() { @Test public void addLines() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); List> latLngList = new ArrayList<>(); latLngList.add(new ArrayList() {{ add(new LatLng(2, 2)); @@ -205,7 +205,7 @@ public void addLines() { @Test public void testDeleteLine() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); List latLngs = new ArrayList<>(); latLngs.add(new LatLng()); latLngs.add(new LatLng(1, 1)); @@ -216,7 +216,7 @@ public void testDeleteLine() { @Test public void testGeometryLine() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); List latLngs = new ArrayList<>(); latLngs.add(new LatLng()); latLngs.add(new LatLng(1, 1)); @@ -236,7 +236,7 @@ public void testGeometryLine() { @Test public void testFeatureIdLine() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); List latLngs = new ArrayList<>(); latLngs.add(new LatLng()); latLngs.add(new LatLng(1, 1)); @@ -248,7 +248,7 @@ public void testFeatureIdLine() { @Test public void testLineDraggableFlag() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); List latLngs = new ArrayList<>(); latLngs.add(new LatLng()); latLngs.add(new LatLng(1, 1)); @@ -264,7 +264,7 @@ public void testLineDraggableFlag() { @Test public void testLineJoinLayerProperty() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(lineLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(lineJoin(get("line-join"))))); List latLngs = new ArrayList<>(); @@ -281,7 +281,7 @@ public void testLineJoinLayerProperty() { @Test public void testLineOpacityLayerProperty() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(lineLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(lineOpacity(get("line-opacity"))))); List latLngs = new ArrayList<>(); @@ -298,7 +298,7 @@ public void testLineOpacityLayerProperty() { @Test public void testLineColorLayerProperty() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(lineLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(lineColor(get("line-color"))))); List latLngs = new ArrayList<>(); @@ -315,7 +315,7 @@ public void testLineColorLayerProperty() { @Test public void testLineWidthLayerProperty() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(lineLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(lineWidth(get("line-width"))))); List latLngs = new ArrayList<>(); @@ -332,7 +332,7 @@ public void testLineWidthLayerProperty() { @Test public void testLineGapWidthLayerProperty() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(lineLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(lineGapWidth(get("line-gap-width"))))); List latLngs = new ArrayList<>(); @@ -349,7 +349,7 @@ public void testLineGapWidthLayerProperty() { @Test public void testLineOffsetLayerProperty() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(lineLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(lineOffset(get("line-offset"))))); List latLngs = new ArrayList<>(); @@ -366,7 +366,7 @@ public void testLineOffsetLayerProperty() { @Test public void testLineBlurLayerProperty() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(lineLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(lineBlur(get("line-blur"))))); List latLngs = new ArrayList<>(); @@ -383,7 +383,7 @@ public void testLineBlurLayerProperty() { @Test public void testLinePatternLayerProperty() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(lineLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(linePattern(get("line-pattern"))))); List latLngs = new ArrayList<>(); @@ -400,7 +400,7 @@ public void testLinePatternLayerProperty() { @Test public void testLineLayerFilter() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); Expression expression = Expression.eq(Expression.get("test"), "selected"); verify(lineLayer, times(0)).setFilter(expression); @@ -415,7 +415,7 @@ public void testLineLayerFilter() { @Test public void testClickListener() { OnLineClickListener listener = mock(OnLineClickListener.class); - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); assertTrue(lineManager.getClickListeners().isEmpty()); lineManager.addClickListener(listener); assertTrue(lineManager.getClickListeners().contains(listener)); @@ -426,7 +426,7 @@ public void testClickListener() { @Test public void testLongClickListener() { OnLineLongClickListener listener = mock(OnLineLongClickListener.class); - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); assertTrue(lineManager.getLongClickListeners().isEmpty()); lineManager.addLongClickListener(listener); assertTrue(lineManager.getLongClickListeners().contains(listener)); @@ -437,7 +437,7 @@ public void testLongClickListener() { @Test public void testDragListener() { OnLineDragListener listener = mock(OnLineDragListener.class); - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); assertTrue(lineManager.getDragListeners().isEmpty()); lineManager.addDragListener(listener); assertTrue(lineManager.getDragListeners().contains(listener)); @@ -447,7 +447,7 @@ public void testDragListener() { @Test public void testCustomData() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); List latLngs = new ArrayList<>(); latLngs.add(new LatLng()); latLngs.add(new LatLng(1, 1)); @@ -459,7 +459,7 @@ public void testCustomData() { @Test public void testClearAll() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); List latLngs = new ArrayList<>(); latLngs.add(new LatLng()); latLngs.add(new LatLng(1, 1)); @@ -472,7 +472,7 @@ public void testClearAll() { @Test public void testIgnoreClearedAnnotations() { - lineManager = new LineManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + lineManager = new LineManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); List latLngs = new ArrayList<>(); latLngs.add(new LatLng()); latLngs.add(new LatLng(1, 1)); diff --git a/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/PropertyValueMatcher.java b/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/PropertyValueMatcher.java index ba8af76a..fd3818a0 100644 --- a/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/PropertyValueMatcher.java +++ b/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/PropertyValueMatcher.java @@ -1,7 +1,6 @@ package com.mapbox.mapboxsdk.plugins.annotation; -import com.mapbox.mapboxsdk.style.layers.PropertyValue; - +import org.maplibre.android.style.layers.PropertyValue; import org.mockito.ArgumentMatcher; import java.util.Arrays; diff --git a/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolManagerTest.java b/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolManagerTest.java index 64ddbafc..39a8bd46 100644 --- a/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolManagerTest.java +++ b/plugin-annotation/src/test/java/com/mapbox/mapboxsdk/plugins/annotation/SymbolManagerTest.java @@ -5,16 +5,16 @@ import android.graphics.PointF; import com.google.gson.JsonPrimitive; -import com.mapbox.geojson.*; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.style.expressions.Expression; -import com.mapbox.mapboxsdk.style.layers.*; -import com.mapbox.mapboxsdk.style.sources.GeoJsonOptions; -import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; -import com.mapbox.mapboxsdk.utils.ColorUtils; +import org.maplibre.geojson.*; +import org.maplibre.android.geometry.LatLng; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.MapLibreMap; +import org.maplibre.android.maps.Style; +import org.maplibre.android.style.expressions.Expression; +import org.maplibre.android.style.layers.*; +import org.maplibre.android.style.sources.GeoJsonOptions; +import org.maplibre.android.style.sources.GeoJsonSource; +import org.maplibre.android.utils.ColorUtils; import org.junit.Before; import org.junit.Test; @@ -25,9 +25,9 @@ import java.util.Arrays; import static com.mapbox.mapboxsdk.plugins.annotation.ConvertUtils.convertArray; -import static com.mapbox.mapboxsdk.style.expressions.Expression.get; -import static com.mapbox.mapboxsdk.style.layers.Property.*; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*; +import static org.maplibre.android.style.expressions.Expression.get; +import static org.maplibre.android.style.layers.Property.*; +import static org.maplibre.android.style.layers.PropertyFactory.*; import static junit.framework.Assert.*; import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.Mockito.*; @@ -36,7 +36,7 @@ public class SymbolManagerTest { private DraggableAnnotationController draggableAnnotationController = mock(DraggableAnnotationController.class); private MapView mapView = mock(MapView.class); - private MapboxMap mapboxMap = mock(MapboxMap.class); + private MapLibreMap maplibreMap = mock(MapLibreMap.class); private Style style = mock(Style.class); private GeoJsonSource geoJsonSource = mock(GeoJsonSource.class); private GeoJsonSource optionedGeoJsonSource = mock(GeoJsonSource.class); @@ -57,7 +57,7 @@ public void beforeTest() { @Test public void testInitialization() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(style).addSource(geoJsonSource); verify(style).addLayer(symbolLayer); assertTrue(symbolManager.dataDrivenPropertyUsageMap.size() > 0); @@ -70,7 +70,7 @@ public void testInitialization() { @Test public void testInitializationOnStyleReload() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(style).addSource(geoJsonSource); verify(style).addLayer(symbolLayer); assertTrue(symbolManager.dataDrivenPropertyUsageMap.size() > 0); @@ -87,7 +87,7 @@ public void testInitializationOnStyleReload() { loadingArgumentCaptor.getValue().onDidFinishLoadingStyle(); ArgumentCaptor styleLoadedArgumentCaptor = ArgumentCaptor.forClass(Style.OnStyleLoaded.class); - verify(mapboxMap).getStyle(styleLoadedArgumentCaptor.capture()); + verify(maplibreMap).getStyle(styleLoadedArgumentCaptor.capture()); Style newStyle = mock(Style.class); when(newStyle.isFullyLoaded()).thenReturn(true); @@ -109,7 +109,7 @@ public void testInitializationOnStyleReload() { @Test public void testLayerBelowInitialization() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, "test_layer", null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, "test_layer", null, null, draggableAnnotationController); verify(style).addSource(geoJsonSource); verify(style).addLayerBelow(symbolLayer, "test_layer"); assertTrue(symbolManager.dataDrivenPropertyUsageMap.size() > 0); @@ -121,7 +121,7 @@ public void testLayerBelowInitialization() { @Test public void testGeoJsonOptionsInitialization() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, geoJsonOptions, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, geoJsonOptions, draggableAnnotationController); verify(style).addSource(optionedGeoJsonSource); verify(style).addLayer(symbolLayer); assertTrue(symbolManager.dataDrivenPropertyUsageMap.size() > 0); @@ -134,20 +134,20 @@ public void testGeoJsonOptionsInitialization() { @Test public void testLayerId() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); assertEquals(layerId, symbolManager.getLayerId()); } @Test public void testAddSymbol() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); Symbol symbol = symbolManager.create(new SymbolOptions().withLatLng(new LatLng())); assertEquals(symbolManager.getAnnotations().get(0), symbol); } @Test public void addSymbolFromFeatureCollection() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); Geometry geometry = Point.fromLngLat(10, 10); Feature feature = Feature.fromGeometry(geometry); @@ -220,7 +220,7 @@ public void addSymbolFromFeatureCollection() { @Test public void addSymbols() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); List latLngList = new ArrayList<>(); latLngList.add(new LatLng()); latLngList.add(new LatLng(1, 1)); @@ -235,7 +235,7 @@ public void addSymbols() { @Test public void testDeleteSymbol() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); Symbol symbol = symbolManager.create(new SymbolOptions().withLatLng(new LatLng())); symbolManager.delete(symbol); assertTrue(symbolManager.getAnnotations().size() == 0); @@ -243,7 +243,7 @@ public void testDeleteSymbol() { @Test public void testGeometrySymbol() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); LatLng latLng = new LatLng(12, 34); SymbolOptions options = new SymbolOptions().withLatLng(latLng); Symbol symbol = symbolManager.create(options); @@ -255,7 +255,7 @@ public void testGeometrySymbol() { @Test public void testFeatureIdSymbol() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); Symbol symbolZero = symbolManager.create(new SymbolOptions().withLatLng(new LatLng())); Symbol symbolOne = symbolManager.create(new SymbolOptions().withLatLng(new LatLng())); assertEquals(symbolZero.getFeature().get(Symbol.ID_KEY).getAsLong(), 0); @@ -264,7 +264,7 @@ public void testFeatureIdSymbol() { @Test public void testSymbolDraggableFlag() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); Symbol symbolZero = symbolManager.create(new SymbolOptions().withLatLng(new LatLng())); assertFalse(symbolZero.isDraggable()); @@ -277,7 +277,7 @@ public void testSymbolDraggableFlag() { @Test public void testSymbolSortKeyLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(symbolSortKey(get("symbol-sort-key"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withSymbolSortKey(2.0f); @@ -291,7 +291,7 @@ public void testSymbolSortKeyLayerProperty() { @Test public void testIconSizeLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(iconSize(get("icon-size"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withIconSize(2.0f); @@ -305,7 +305,7 @@ public void testIconSizeLayerProperty() { @Test public void testIconImageLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(iconImage(get("icon-image"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withIconImage("undefined"); @@ -319,7 +319,7 @@ public void testIconImageLayerProperty() { @Test public void testIconRotateLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(iconRotate(get("icon-rotate"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withIconRotate(2.0f); @@ -333,7 +333,7 @@ public void testIconRotateLayerProperty() { @Test public void testIconOffsetLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(iconOffset(get("icon-offset"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withIconOffset(new Float[]{0f, 0f}); @@ -347,7 +347,7 @@ public void testIconOffsetLayerProperty() { @Test public void testIconAnchorLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(iconAnchor(get("icon-anchor"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withIconAnchor(ICON_ANCHOR_CENTER); @@ -361,7 +361,7 @@ public void testIconAnchorLayerProperty() { @Test public void testTextFieldLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(textField(get("text-field"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withTextField(""); @@ -375,7 +375,7 @@ public void testTextFieldLayerProperty() { @Test public void testTextFontLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(textFont(get("text-font"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withTextFont(new String[]{"Open Sans Regular", "Arial Unicode MS Regular"}); @@ -389,7 +389,7 @@ public void testTextFontLayerProperty() { @Test public void testTextSizeLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(textSize(get("text-size"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withTextSize(2.0f); @@ -403,7 +403,7 @@ public void testTextSizeLayerProperty() { @Test public void testTextMaxWidthLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(textMaxWidth(get("text-max-width"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withTextMaxWidth(2.0f); @@ -417,7 +417,7 @@ public void testTextMaxWidthLayerProperty() { @Test public void testTextLetterSpacingLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(textLetterSpacing(get("text-letter-spacing"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withTextLetterSpacing(2.0f); @@ -431,7 +431,7 @@ public void testTextLetterSpacingLayerProperty() { @Test public void testTextJustifyLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(textJustify(get("text-justify"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withTextJustify(TEXT_JUSTIFY_AUTO); @@ -445,7 +445,7 @@ public void testTextJustifyLayerProperty() { @Test public void testTextRadialOffsetLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(textRadialOffset(get("text-radial-offset"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withTextRadialOffset(2.0f); @@ -459,7 +459,7 @@ public void testTextRadialOffsetLayerProperty() { @Test public void testTextAnchorLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(textAnchor(get("text-anchor"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withTextAnchor(TEXT_ANCHOR_CENTER); @@ -473,7 +473,7 @@ public void testTextAnchorLayerProperty() { @Test public void testTextRotateLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(textRotate(get("text-rotate"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withTextRotate(2.0f); @@ -487,7 +487,7 @@ public void testTextRotateLayerProperty() { @Test public void testTextTransformLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(textTransform(get("text-transform"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withTextTransform(TEXT_TRANSFORM_NONE); @@ -501,7 +501,7 @@ public void testTextTransformLayerProperty() { @Test public void testTextOffsetLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(textOffset(get("text-offset"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withTextOffset(new Float[]{0f, 0f}); @@ -515,7 +515,7 @@ public void testTextOffsetLayerProperty() { @Test public void testIconOpacityLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(iconOpacity(get("icon-opacity"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withIconOpacity(2.0f); @@ -529,7 +529,7 @@ public void testIconOpacityLayerProperty() { @Test public void testIconColorLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(iconColor(get("icon-color"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withIconColor("rgba(0, 0, 0, 1)"); @@ -543,7 +543,7 @@ public void testIconColorLayerProperty() { @Test public void testIconHaloColorLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(iconHaloColor(get("icon-halo-color"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withIconHaloColor("rgba(0, 0, 0, 1)"); @@ -557,7 +557,7 @@ public void testIconHaloColorLayerProperty() { @Test public void testIconHaloWidthLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(iconHaloWidth(get("icon-halo-width"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withIconHaloWidth(2.0f); @@ -571,7 +571,7 @@ public void testIconHaloWidthLayerProperty() { @Test public void testIconHaloBlurLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(iconHaloBlur(get("icon-halo-blur"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withIconHaloBlur(2.0f); @@ -585,7 +585,7 @@ public void testIconHaloBlurLayerProperty() { @Test public void testTextOpacityLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(textOpacity(get("text-opacity"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withTextOpacity(2.0f); @@ -599,7 +599,7 @@ public void testTextOpacityLayerProperty() { @Test public void testTextColorLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(textColor(get("text-color"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withTextColor("rgba(0, 0, 0, 1)"); @@ -613,7 +613,7 @@ public void testTextColorLayerProperty() { @Test public void testTextHaloColorLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(textHaloColor(get("text-halo-color"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withTextHaloColor("rgba(0, 0, 0, 1)"); @@ -627,7 +627,7 @@ public void testTextHaloColorLayerProperty() { @Test public void testTextHaloWidthLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(textHaloWidth(get("text-halo-width"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withTextHaloWidth(2.0f); @@ -641,7 +641,7 @@ public void testTextHaloWidthLayerProperty() { @Test public void testTextHaloBlurLayerProperty() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); verify(symbolLayer, times(0)).setProperties(argThat(new PropertyValueMatcher(textHaloBlur(get("text-halo-blur"))))); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()).withTextHaloBlur(2.0f); @@ -655,7 +655,7 @@ public void testTextHaloBlurLayerProperty() { @Test public void testSymbolLayerFilter() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); Expression expression = Expression.eq(Expression.get("test"), "selected"); verify(symbolLayer, times(0)).setFilter(expression); @@ -670,7 +670,7 @@ public void testSymbolLayerFilter() { @Test public void testClickListener() { OnSymbolClickListener listener = mock(OnSymbolClickListener.class); - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); assertTrue(symbolManager.getClickListeners().isEmpty()); symbolManager.addClickListener(listener); assertTrue(symbolManager.getClickListeners().contains(listener)); @@ -681,7 +681,7 @@ public void testClickListener() { @Test public void testLongClickListener() { OnSymbolLongClickListener listener = mock(OnSymbolLongClickListener.class); - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); assertTrue(symbolManager.getLongClickListeners().isEmpty()); symbolManager.addLongClickListener(listener); assertTrue(symbolManager.getLongClickListeners().contains(listener)); @@ -692,7 +692,7 @@ public void testLongClickListener() { @Test public void testDragListener() { OnSymbolDragListener listener = mock(OnSymbolDragListener.class); - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); assertTrue(symbolManager.getDragListeners().isEmpty()); symbolManager.addDragListener(listener); assertTrue(symbolManager.getDragListeners().contains(listener)); @@ -702,7 +702,7 @@ public void testDragListener() { @Test public void testCustomData() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()); options.withData(new JsonPrimitive("hello")); Symbol symbol = symbolManager.create(options); @@ -711,7 +711,7 @@ public void testCustomData() { @Test public void testClearAll() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()); symbolManager.create(options); assertEquals(1, symbolManager.getAnnotations().size()); @@ -721,7 +721,7 @@ public void testClearAll() { @Test public void testIgnoreClearedAnnotations() { - symbolManager = new SymbolManager(mapView, mapboxMap, style, coreElementProvider, null, null, null, draggableAnnotationController); + symbolManager = new SymbolManager(mapView, maplibreMap, style, coreElementProvider, null, null, null, draggableAnnotationController); SymbolOptions options = new SymbolOptions().withLatLng(new LatLng()); Symbol symbol = symbolManager.create(options); assertEquals(1, symbolManager.annotations.size()); diff --git a/plugin-building/src/main/java/com/mapbox/mapboxsdk/plugins/building/BuildingPlugin.java b/plugin-building/src/main/java/com/mapbox/mapboxsdk/plugins/building/BuildingPlugin.java index d7985aa4..ef45fcb0 100644 --- a/plugin-building/src/main/java/com/mapbox/mapboxsdk/plugins/building/BuildingPlugin.java +++ b/plugin-building/src/main/java/com/mapbox/mapboxsdk/plugins/building/BuildingPlugin.java @@ -2,38 +2,38 @@ import android.graphics.Color; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.style.layers.FillExtrusionLayer; -import com.mapbox.mapboxsdk.style.light.Light; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.MapLibreMap; +import org.maplibre.android.maps.Style; +import org.maplibre.android.style.layers.FillExtrusionLayer; +import org.maplibre.android.style.light.Light; import androidx.annotation.ColorInt; import androidx.annotation.FloatRange; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import static com.mapbox.mapboxsdk.constants.MapboxConstants.MAXIMUM_ZOOM; -import static com.mapbox.mapboxsdk.constants.MapboxConstants.MINIMUM_ZOOM; -import static com.mapbox.mapboxsdk.style.expressions.Expression.exponential; -import static com.mapbox.mapboxsdk.style.expressions.Expression.get; -import static com.mapbox.mapboxsdk.style.expressions.Expression.interpolate; -import static com.mapbox.mapboxsdk.style.expressions.Expression.literal; -import static com.mapbox.mapboxsdk.style.expressions.Expression.stop; -import static com.mapbox.mapboxsdk.style.expressions.Expression.zoom; -import static com.mapbox.mapboxsdk.style.layers.Property.NONE; -import static com.mapbox.mapboxsdk.style.layers.Property.VISIBLE; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionColor; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionHeight; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionOpacity; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.visibility; +import static org.maplibre.android.constants.MapLibreConstants.MAXIMUM_ZOOM; +import static org.maplibre.android.constants.MapLibreConstants.MINIMUM_ZOOM; +import static org.maplibre.android.style.expressions.Expression.exponential; +import static org.maplibre.android.style.expressions.Expression.get; +import static org.maplibre.android.style.expressions.Expression.interpolate; +import static org.maplibre.android.style.expressions.Expression.literal; +import static org.maplibre.android.style.expressions.Expression.stop; +import static org.maplibre.android.style.expressions.Expression.zoom; +import static org.maplibre.android.style.layers.Property.NONE; +import static org.maplibre.android.style.layers.Property.VISIBLE; +import static org.maplibre.android.style.layers.PropertyFactory.fillExtrusionColor; +import static org.maplibre.android.style.layers.PropertyFactory.fillExtrusionHeight; +import static org.maplibre.android.style.layers.PropertyFactory.fillExtrusionOpacity; +import static org.maplibre.android.style.layers.PropertyFactory.visibility; /** * The building plugin allows you to add 3d buildings FillExtrusionLayer to the Mapbox Maps SDK for * Android v5.1.0. *

- * Initialise this plugin in the {@link com.mapbox.mapboxsdk.maps.OnMapReadyCallback#onMapReady(MapboxMap)} - * and provide a valid instance of {@link MapView} and {@link MapboxMap}. + * Initialise this plugin in the {@link org.maplibre.android.maps.OnMapReadyCallback#onMapReady(MapLibreMap)} + * and provide a valid instance of {@link MapView} and {@link MapLibreMap}. *

*
    *
  • Use {@link #setVisibility(boolean)}} to show buildings from this plugin.
  • @@ -60,21 +60,21 @@ public final class BuildingPlugin { * Create a building plugin. * * @param mapView the MapView to apply the building plugin to - * @param mapboxMap the MapboxMap to apply building plugin with + * @param MapLibreMap the MapLibreMap to apply building plugin with * @since 0.1.0 */ - public BuildingPlugin(@NonNull MapView mapView, @NonNull final MapboxMap mapboxMap, @NonNull Style style) { - this(mapView, mapboxMap, style, null); + public BuildingPlugin(@NonNull MapView mapView, @NonNull final MapLibreMap MapLibreMap, @NonNull Style style) { + this(mapView, MapLibreMap, style, null); } /** * Create a building plugin. * * @param mapView the MapView to apply the building plugin to - * @param mapboxMap the MapboxMap to apply building plugin with + * @param MapLibreMap the MapLibreMap to apply building plugin with * @since 0.1.0 */ - public BuildingPlugin(@NonNull MapView mapView, @NonNull final MapboxMap mapboxMap, @NonNull Style style, + public BuildingPlugin(@NonNull MapView mapView, @NonNull final MapLibreMap MapLibreMap, @NonNull Style style, @Nullable final String belowLayer) { this.style = style; if (!style.isFullyLoaded()) { @@ -86,7 +86,7 @@ public BuildingPlugin(@NonNull MapView mapView, @NonNull final MapboxMap mapboxM mapView.addOnDidFinishLoadingStyleListener(new MapView.OnDidFinishLoadingStyleListener() { @Override public void onDidFinishLoadingStyle() { - mapboxMap.getStyle(new Style.OnStyleLoaded() { + MapLibreMap.getStyle(new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { BuildingPlugin.this.style = style; diff --git a/plugin-localization/src/main/java/com/mapbox/mapboxsdk/plugins/localization/LocalizationPlugin.java b/plugin-localization/src/main/java/com/mapbox/mapboxsdk/plugins/localization/LocalizationPlugin.java index 4792922b..02e1e039 100644 --- a/plugin-localization/src/main/java/com/mapbox/mapboxsdk/plugins/localization/LocalizationPlugin.java +++ b/plugin-localization/src/main/java/com/mapbox/mapboxsdk/plugins/localization/LocalizationPlugin.java @@ -1,18 +1,10 @@ package com.mapbox.mapboxsdk.plugins.localization; -import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; -import com.mapbox.mapboxsdk.geometry.LatLngBounds; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Style; +import static org.maplibre.android.style.expressions.Expression.raw; +import static org.maplibre.android.style.layers.PropertyFactory.textField; + import com.mapbox.mapboxsdk.plugins.localization.MapLocale.Languages; -import com.mapbox.mapboxsdk.style.expressions.Expression; -import com.mapbox.mapboxsdk.style.layers.Layer; -import com.mapbox.mapboxsdk.style.layers.PropertyValue; -import com.mapbox.mapboxsdk.style.layers.SymbolLayer; -import com.mapbox.mapboxsdk.style.sources.Source; -import com.mapbox.mapboxsdk.style.sources.VectorSource; import java.util.ArrayList; import java.util.List; @@ -21,10 +13,19 @@ import androidx.annotation.NonNull; import androidx.annotation.UiThread; -import timber.log.Timber; +import org.maplibre.android.camera.CameraUpdateFactory; +import org.maplibre.android.geometry.LatLngBounds; +import org.maplibre.android.maps.MapLibreMap; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.Style; +import org.maplibre.android.style.expressions.Expression; +import org.maplibre.android.style.layers.Layer; +import org.maplibre.android.style.layers.PropertyValue; +import org.maplibre.android.style.layers.SymbolLayer; +import org.maplibre.android.style.sources.Source; +import org.maplibre.android.style.sources.VectorSource; -import static com.mapbox.mapboxsdk.style.expressions.Expression.raw; -import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textField; +import timber.log.Timber; /** * Useful class for quickly adjusting the maps language and the maps camera starting position. @@ -94,7 +95,7 @@ public final class LocalizationPlugin { private static final String STEP_TEMPLATE = "[\"zoom\"], \"\", "; // configuration - private final MapboxMap mapboxMap; + private final MapLibreMap maplibreMap; private MapLocale mapLocale; @NonNull private Style style; @@ -103,11 +104,11 @@ public final class LocalizationPlugin { * Public constructor for passing in the required objects. * * @param mapView the MapView object in which the map is displayed - * @param mapboxMap the Mapbox map object which your current map view is using for control + * @param maplibreMap the Mapbox map object which your current map view is using for control * @param style the Style object that represents a fully loaded style */ - public LocalizationPlugin(@NonNull MapView mapView, @NonNull final MapboxMap mapboxMap, @NonNull Style style) { - this.mapboxMap = mapboxMap; + public LocalizationPlugin(@NonNull MapView mapView, @NonNull final MapLibreMap maplibreMap, @NonNull Style style) { + this.maplibreMap = maplibreMap; this.style = style; if (!style.isFullyLoaded()) { throw new RuntimeException("The style has to be non-null and fully loaded."); @@ -116,7 +117,7 @@ public LocalizationPlugin(@NonNull MapView mapView, @NonNull final MapboxMap map mapView.addOnDidFinishLoadingStyleListener(new MapView.OnDidFinishLoadingStyleListener() { @Override public void onDidFinishLoadingStyle() { - mapboxMap.getStyle(new Style.OnStyleLoaded() { + maplibreMap.getStyle(new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { LocalizationPlugin.this.style = style; @@ -350,7 +351,7 @@ public void setCameraToLocaleCountry(MapLocale mapLocale, int padding) { throw new NullPointerException("Expected a LatLngBounds object but received null instead. Mak" + "e sure your MapLocale instance also has a country bounding box defined."); } - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, padding)); + maplibreMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, padding)); } /* diff --git a/plugin-localization/src/main/java/com/mapbox/mapboxsdk/plugins/localization/MapLocale.java b/plugin-localization/src/main/java/com/mapbox/mapboxsdk/plugins/localization/MapLocale.java index 33ed0d5a..5f8ef1d5 100644 --- a/plugin-localization/src/main/java/com/mapbox/mapboxsdk/plugins/localization/MapLocale.java +++ b/plugin-localization/src/main/java/com/mapbox/mapboxsdk/plugins/localization/MapLocale.java @@ -1,9 +1,6 @@ package com.mapbox.mapboxsdk.plugins.localization; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.geometry.LatLngBounds; - import java.lang.annotation.Retention; import java.util.HashMap; import java.util.Locale; @@ -15,6 +12,9 @@ import static java.lang.annotation.RetentionPolicy.SOURCE; +import org.maplibre.android.geometry.LatLng; +import org.maplibre.android.geometry.LatLngBounds; + /** * A {@link MapLocale} object builds off of the {@link Locale} object and provides additional * geographical information particular to the Mapbox Maps SDK. Like Locale, MapLocale can be used to diff --git a/plugin-localization/src/test/java/com/mapbox/mapboxsdk/plugins/localization/LocalizationPluginTest.java b/plugin-localization/src/test/java/com/mapbox/mapboxsdk/plugins/localization/LocalizationPluginTest.java index 402e5c49..b2e2833f 100644 --- a/plugin-localization/src/test/java/com/mapbox/mapboxsdk/plugins/localization/LocalizationPluginTest.java +++ b/plugin-localization/src/test/java/com/mapbox/mapboxsdk/plugins/localization/LocalizationPluginTest.java @@ -1,8 +1,8 @@ package com.mapbox.mapboxsdk.plugins.localization; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Style; +import org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.MapLibreMap; +import org.maplibre.android.maps.Style; import org.junit.Ignore; import org.junit.Rule; @@ -34,7 +34,7 @@ public class LocalizationPluginTest { public void sanity() throws Exception { when(style.isFullyLoaded()).thenReturn(true); LocalizationPlugin localizationPlugin - = new LocalizationPlugin(mock(MapView.class), mock(MapboxMap.class), style); + = new LocalizationPlugin(mock(MapView.class), mock(MapLibreMap.class), style); assertNotNull(localizationPlugin); } @@ -45,7 +45,7 @@ public void setMapLanguage_localePassedInNotValid() throws Exception { thrown.expect(NullPointerException.class); thrown.expectMessage(containsString("has no matching MapLocale object. You need to create")); LocalizationPlugin localizationPlugin - = new LocalizationPlugin(mock(MapView.class), mock(MapboxMap.class), style); + = new LocalizationPlugin(mock(MapView.class), mock(MapLibreMap.class), style); localizationPlugin.setMapLanguage(new Locale("foo", "bar"), false); } } \ No newline at end of file diff --git a/plugin-markerview/src/main/java/com/mapbox/mapboxsdk/plugins/markerview/MarkerView.java b/plugin-markerview/src/main/java/com/mapbox/mapboxsdk/plugins/markerview/MarkerView.java index 71be0417..1da796a4 100644 --- a/plugin-markerview/src/main/java/com/mapbox/mapboxsdk/plugins/markerview/MarkerView.java +++ b/plugin-markerview/src/main/java/com/mapbox/mapboxsdk/plugins/markerview/MarkerView.java @@ -3,11 +3,11 @@ import android.graphics.PointF; import android.view.View; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.Projection; - import androidx.annotation.NonNull; +import org.maplibre.android.geometry.LatLng; +import org.maplibre.android.maps.Projection; + /** * MarkerView class wraps a latitude-longitude pair with a Android SDK View. *

    diff --git a/plugin-markerview/src/main/java/com/mapbox/mapboxsdk/plugins/markerview/MarkerViewManager.java b/plugin-markerview/src/main/java/com/mapbox/mapboxsdk/plugins/markerview/MarkerViewManager.java index bc7e38e4..b9e2472b 100644 --- a/plugin-markerview/src/main/java/com/mapbox/mapboxsdk/plugins/markerview/MarkerViewManager.java +++ b/plugin-markerview/src/main/java/com/mapbox/mapboxsdk/plugins/markerview/MarkerViewManager.java @@ -1,8 +1,7 @@ package com.mapbox.mapboxsdk.plugins.markerview; - -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; +import org.maplibre.android.maps.MapLibreMap; +import org.maplibre.android.maps.MapView; import java.util.ArrayList; import java.util.List; @@ -16,7 +15,7 @@ public class MarkerViewManager implements MapView.OnCameraDidChangeListener, MapView.OnCameraIsChangingListener { private final MapView mapView; - private final MapboxMap mapboxMap; + private final MapLibreMap maplibreMap; private final List markers = new ArrayList<>(); private boolean initialised; @@ -24,11 +23,11 @@ public class MarkerViewManager implements MapView.OnCameraDidChangeListener, Map * Create a MarkerViewManager. * * @param mapView the MapView used to synchronise views on - * @param mapboxMap the MapboxMap to synchronise views with + * @param maplibreMap the MapboxMap to synchronise views with */ - public MarkerViewManager(MapView mapView, MapboxMap mapboxMap) { + public MarkerViewManager(MapView mapView, MapLibreMap maplibreMap) { this.mapView = mapView; - this.mapboxMap = mapboxMap; + this.maplibreMap = maplibreMap; } /** @@ -61,7 +60,7 @@ public void addMarker(@NonNull MarkerView markerView) { mapView.addOnCameraDidChangeListener(this); mapView.addOnCameraIsChangingListener(this); } - markerView.setProjection(mapboxMap.getProjection()); + markerView.setProjection(maplibreMap.getProjection()); mapView.addView(markerView.getView()); markers.add(markerView); markerView.update(); diff --git a/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/OfflineRegionSelector.java b/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/OfflineRegionSelector.java index cd9f3076..b558ef6a 100644 --- a/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/OfflineRegionSelector.java +++ b/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/OfflineRegionSelector.java @@ -4,7 +4,6 @@ import android.content.Context; import android.content.Intent; -import com.mapbox.mapboxsdk.offline.OfflineRegionDefinition; import com.mapbox.mapboxsdk.plugins.offline.model.NotificationOptions; import com.mapbox.mapboxsdk.plugins.offline.model.OfflineDownloadOptions; import com.mapbox.mapboxsdk.plugins.offline.model.RegionSelectionOptions; @@ -15,6 +14,8 @@ import static com.mapbox.mapboxsdk.plugins.offline.offline.OfflineConstants.RETURNING_DEFINITION; import static com.mapbox.mapboxsdk.plugins.offline.offline.OfflineConstants.RETURNING_REGION_NAME; +import org.maplibre.android.offline.OfflineRegionDefinition; + /** * While the offline plugin includes a service for optimally launching an offline download session, * the plugin also includes UI components which also assist in providing a way for your app users to diff --git a/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/model/OfflineDownloadOptions.java b/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/model/OfflineDownloadOptions.java index 8e20b9ab..422aaa4e 100644 --- a/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/model/OfflineDownloadOptions.java +++ b/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/model/OfflineDownloadOptions.java @@ -3,8 +3,6 @@ import android.os.Parcelable; import com.google.auto.value.AutoValue; -import com.mapbox.mapboxsdk.offline.OfflineRegion; -import com.mapbox.mapboxsdk.offline.OfflineRegionDefinition; import com.mapbox.mapboxsdk.plugins.offline.offline.OfflineDownloadService; import com.mapbox.mapboxsdk.plugins.offline.offline.OfflinePlugin; @@ -13,6 +11,8 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import org.maplibre.android.offline.OfflineRegionDefinition; + /** * This model class wraps the offline region definition with notifications options and the offline * region metadata. It is a companion object to {@link OfflineRegion} with regionId and diff --git a/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/model/RegionSelectionOptions.java b/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/model/RegionSelectionOptions.java index cf136bcc..7b487ffc 100644 --- a/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/model/RegionSelectionOptions.java +++ b/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/model/RegionSelectionOptions.java @@ -3,13 +3,14 @@ import android.os.Parcelable; import com.google.auto.value.AutoValue; -import com.mapbox.mapboxsdk.camera.CameraPosition; -import com.mapbox.mapboxsdk.geometry.LatLngBounds; import com.mapbox.mapboxsdk.plugins.offline.ui.OfflineActivity; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import org.maplibre.android.camera.CameraPosition; +import org.maplibre.android.geometry.LatLngBounds; + /** * Options specific to the Region Selection UI component. * diff --git a/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflineDownloadService.java b/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflineDownloadService.java index ea7e8276..1bb3adce 100644 --- a/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflineDownloadService.java +++ b/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflineDownloadService.java @@ -12,21 +12,22 @@ import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationManagerCompat; -import com.mapbox.mapboxsdk.offline.OfflineManager; -import com.mapbox.mapboxsdk.offline.OfflineRegion; -import com.mapbox.mapboxsdk.offline.OfflineRegionDefinition; -import com.mapbox.mapboxsdk.offline.OfflineRegionError; -import com.mapbox.mapboxsdk.offline.OfflineRegionStatus; import com.mapbox.mapboxsdk.plugins.offline.model.OfflineDownloadOptions; import com.mapbox.mapboxsdk.plugins.offline.utils.NotificationUtils; -import com.mapbox.mapboxsdk.snapshotter.MapSnapshot; -import com.mapbox.mapboxsdk.snapshotter.MapSnapshotter; import timber.log.Timber; import static com.mapbox.mapboxsdk.plugins.offline.offline.OfflineConstants.KEY_BUNDLE; import static com.mapbox.mapboxsdk.plugins.offline.utils.NotificationUtils.setupNotificationChannel; +import org.maplibre.android.offline.OfflineManager; +import org.maplibre.android.offline.OfflineRegion; +import org.maplibre.android.offline.OfflineRegionDefinition; +import org.maplibre.android.offline.OfflineRegionError; +import org.maplibre.android.offline.OfflineRegionStatus; +import org.maplibre.android.snapshotter.MapSnapshot; +import org.maplibre.android.snapshotter.MapSnapshotter; + /** * Internal usage only, use this service indirectly by using methods found in * {@link OfflinePlugin}. When an offline download is initiated diff --git a/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java b/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java index cd7314c6..8248d900 100644 --- a/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java +++ b/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java @@ -5,7 +5,6 @@ import android.content.Context; import android.content.Intent; -import com.mapbox.mapboxsdk.offline.OfflineRegion; import com.mapbox.mapboxsdk.plugins.offline.model.OfflineDownloadOptions; import java.util.ArrayList; @@ -16,6 +15,8 @@ import static com.mapbox.mapboxsdk.plugins.offline.offline.OfflineConstants.KEY_BUNDLE; +import org.maplibre.android.offline.OfflineRegion; + /** * OfflinePlugin is the main entry point for integrating the offline plugin into your app. *

    diff --git a/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/ui/OfflineActivity.java b/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/ui/OfflineActivity.java index b4d7b199..fcc3dacd 100644 --- a/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/ui/OfflineActivity.java +++ b/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/ui/OfflineActivity.java @@ -4,7 +4,6 @@ import android.os.Bundle; import android.view.Window; -import com.mapbox.mapboxsdk.offline.OfflineRegionDefinition; import com.mapbox.mapboxsdk.plugins.offline.OfflinePluginConstants; import com.mapbox.mapboxsdk.plugins.offline.R; import com.mapbox.mapboxsdk.plugins.offline.model.RegionSelectionOptions; @@ -17,6 +16,8 @@ import static com.mapbox.mapboxsdk.plugins.offline.offline.OfflineConstants.RETURNING_DEFINITION; import static com.mapbox.mapboxsdk.plugins.offline.offline.OfflineConstants.RETURNING_REGION_NAME; +import org.maplibre.android.offline.OfflineRegionDefinition; + public class OfflineActivity extends AppCompatActivity implements RegionSelectedCallback { @Override diff --git a/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/ui/RegionSelectedCallback.java b/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/ui/RegionSelectedCallback.java index 8f235980..c66ab979 100644 --- a/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/ui/RegionSelectedCallback.java +++ b/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/ui/RegionSelectedCallback.java @@ -1,6 +1,6 @@ package com.mapbox.mapboxsdk.plugins.offline.ui; -import com.mapbox.mapboxsdk.offline.OfflineRegionDefinition; +import org.maplibre.android.offline.OfflineRegionDefinition; public interface RegionSelectedCallback { diff --git a/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/ui/RegionSelectionFragment.java b/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/ui/RegionSelectionFragment.java index fe7ecc63..48d5c993 100644 --- a/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/ui/RegionSelectionFragment.java +++ b/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/ui/RegionSelectionFragment.java @@ -9,20 +9,9 @@ import android.widget.TextView; import com.google.android.material.floatingactionbutton.FloatingActionButton; -import com.mapbox.geojson.Feature; -import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.geometry.LatLngBounds; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.offline.OfflineRegionDefinition; -import com.mapbox.mapboxsdk.offline.OfflineTilePyramidRegionDefinition; import com.mapbox.mapboxsdk.plugins.offline.OfflinePluginConstants; import com.mapbox.mapboxsdk.plugins.offline.R; import com.mapbox.mapboxsdk.plugins.offline.model.RegionSelectionOptions; -import com.mapbox.mapboxsdk.style.sources.VectorSource; import java.util.List; @@ -30,10 +19,22 @@ import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; +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 org.maplibre.android.maps.MapView; +import org.maplibre.android.maps.OnMapReadyCallback; +import org.maplibre.android.maps.Style; +import org.maplibre.android.offline.OfflineRegionDefinition; +import org.maplibre.android.offline.OfflineTilePyramidRegionDefinition; +import org.maplibre.android.style.sources.VectorSource; +import org.maplibre.geojson.Feature; + import timber.log.Timber; public class RegionSelectionFragment extends Fragment implements OnMapReadyCallback, - MapboxMap.OnCameraIdleListener { + MapLibreMap.OnCameraIdleListener { public static final String TAG = "OfflineRegionSelectionFragment"; private static final String[] LAYER_IDS = new String[]{ @@ -46,7 +47,7 @@ public class RegionSelectionFragment extends Fragment implements OnMapReadyCallb private RegionSelectionOptions options; private RegionSelectedCallback selectedCallback; private TextView regionNameTextView; - private MapboxMap mapboxMap; + private MapLibreMap mapLibreMap; private String regionName; private RectF boundingBox; private MapView mapView; @@ -97,18 +98,18 @@ public void setSelectedCallback(@NonNull RegionSelectedCallback selectedCallback } @Override - public void onMapReady(final MapboxMap mapboxMap) { - this.mapboxMap = mapboxMap; - mapboxMap.setStyle(Style.getPredefinedStyle("Streets"), new Style.OnStyleLoaded() { + public void onMapReady(final MapLibreMap maplibreMap) { + this.mapLibreMap = maplibreMap; + maplibreMap.setStyle(Style.getPredefinedStyle("Streets"), new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { RegionSelectionFragment.this.style = style; - mapboxMap.addOnCameraIdleListener(RegionSelectionFragment.this); + maplibreMap.addOnCameraIdleListener(RegionSelectionFragment.this); if (options != null) { if (options.startingBounds() != null) { - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(options.startingBounds(), 0)); + maplibreMap.moveCamera(CameraUpdateFactory.newLatLngBounds(options.startingBounds(), 0)); } else if (options.statingCameraPosition() != null) { - mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(options.statingCameraPosition())); + maplibreMap.moveCamera(CameraUpdateFactory.newCameraPosition(options.statingCameraPosition())); } } } @@ -129,8 +130,8 @@ public void onCameraIdle() { public void onStart() { super.onStart(); mapView.onStart(); - if (mapboxMap != null) { - mapboxMap.addOnCameraIdleListener(this); + if (mapLibreMap != null) { + mapLibreMap.addOnCameraIdleListener(this); } } @@ -156,8 +157,8 @@ public void onSaveInstanceState(@NonNull Bundle outState) { public void onStop() { super.onStop(); mapView.onStop(); - if (mapboxMap != null) { - mapboxMap.removeOnCameraIdleListener(this); + if (mapLibreMap != null) { + mapLibreMap.removeOnCameraIdleListener(this); } } @@ -184,7 +185,7 @@ private RectF getSelectionRegion() { } public String getOfflineRegionName() { - List featureList = mapboxMap.queryRenderedFeatures(boundingBox, LAYER_IDS); + List featureList = mapLibreMap.queryRenderedFeatures(boundingBox, LAYER_IDS); if (featureList.isEmpty() && style != null) { Timber.v("Rendered features empty, attempting to query vector source."); VectorSource source = style.getSourceAs("composite"); @@ -199,20 +200,20 @@ public String getOfflineRegionName() { } OfflineRegionDefinition createRegion() { - if (mapboxMap == null) { + if (mapLibreMap == null) { throw new NullPointerException("MapboxMap is null and can't be used to create Offline region" + "definition."); } RectF rectF = getSelectionRegion(); - LatLng northEast = mapboxMap.getProjection().fromScreenLocation(new PointF(rectF.right, rectF.top)); - LatLng southWest = mapboxMap.getProjection().fromScreenLocation(new PointF(rectF.left, rectF.bottom)); + LatLng northEast = mapLibreMap.getProjection().fromScreenLocation(new PointF(rectF.right, rectF.top)); + LatLng southWest = mapLibreMap.getProjection().fromScreenLocation(new PointF(rectF.left, rectF.bottom)); LatLngBounds bounds = new LatLngBounds.Builder().include(northEast).include(southWest).build(); - double cameraZoom = mapboxMap.getCameraPosition().zoom; + double cameraZoom = mapLibreMap.getCameraPosition().zoom; float pixelRatio = getActivity().getResources().getDisplayMetrics().density; return new OfflineTilePyramidRegionDefinition( - mapboxMap.getStyle().getUrl(), bounds, cameraZoom - 2, cameraZoom + 2, pixelRatio + mapLibreMap.getStyle().getUrl(), bounds, cameraZoom - 2, cameraZoom + 2, pixelRatio ); } diff --git a/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/utils/NotificationUtils.java b/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/utils/NotificationUtils.java index dbe32eaa..21d39c08 100644 --- a/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/utils/NotificationUtils.java +++ b/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/utils/NotificationUtils.java @@ -1,5 +1,7 @@ package com.mapbox.mapboxsdk.plugins.offline.utils; +import static org.maplibre.android.MapLibre.getApplicationContext; + import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; @@ -17,8 +19,6 @@ import com.mapbox.mapboxsdk.plugins.offline.model.OfflineDownloadOptions; import com.mapbox.mapboxsdk.plugins.offline.offline.OfflineConstants; -import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext; - public class NotificationUtils { private NotificationUtils() { diff --git a/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/utils/OfflineUtils.java b/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/utils/OfflineUtils.java index c0afa23b..ec2c2a33 100644 --- a/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/utils/OfflineUtils.java +++ b/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/utils/OfflineUtils.java @@ -2,10 +2,9 @@ import android.util.Log; -import com.mapbox.mapboxsdk.camera.CameraPosition; -import com.mapbox.mapboxsdk.offline.OfflineRegionDefinition; - import org.json.JSONObject; +import org.maplibre.android.camera.CameraPosition; +import org.maplibre.android.offline.OfflineRegionDefinition; import androidx.annotation.NonNull; diff --git a/plugin-offline/src/main/res/layout/mapbox_offline_region_selection_fragment.xml b/plugin-offline/src/main/res/layout/mapbox_offline_region_selection_fragment.xml index e3f5dec2..0b636ed1 100644 --- a/plugin-offline/src/main/res/layout/mapbox_offline_region_selection_fragment.xml +++ b/plugin-offline/src/main/res/layout/mapbox_offline_region_selection_fragment.xml @@ -5,7 +5,7 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - - * If the scale plugin wasn enabled, a {@link com.mapbox.mapboxsdk.maps.MapboxMap.OnCameraMoveListener} + * If the scale plugin wasn enabled, a {@link org.maplibre.android.maps.MapLibreMap.OnCameraMoveListener} * will be added to the {@link MapView} to listen to scale change events to update the state of this plugin. If the - * plugin was disabled the {@link com.mapbox.mapboxsdk.maps.MapboxMap.OnCameraMoveListener} + * plugin was disabled the {@link org.maplibre.android.maps.MapLibreMap.OnCameraMoveListener} * will be removed from the map. *

    */ @@ -107,18 +107,18 @@ public void setEnabled(boolean enabled) { } private void invalidateScaleBar() { - CameraPosition cameraPosition = mapboxMap.getCameraPosition(); + CameraPosition cameraPosition = mapLibreMap.getCameraPosition(); scaleBarWidget.setDistancePerPixel((projection.getMetersPerPixelAtLatitude(cameraPosition.target.getLatitude())) / mapView.getPixelRatio()); } private void addCameraListeners() { - mapboxMap.addOnCameraMoveListener(cameraMoveListener); - mapboxMap.addOnCameraIdleListener(cameraIdleListener); + mapLibreMap.addOnCameraMoveListener(cameraMoveListener); + mapLibreMap.addOnCameraIdleListener(cameraIdleListener); } private void removeCameraListeners() { - mapboxMap.removeOnCameraMoveListener(cameraMoveListener); - mapboxMap.removeOnCameraIdleListener(cameraIdleListener); + mapLibreMap.removeOnCameraMoveListener(cameraMoveListener); + mapLibreMap.removeOnCameraIdleListener(cameraIdleListener); } } diff --git a/plugin-scalebar/src/test/java/com/mapbox/pluginscalebar/ScaleBarPluginTest.kt b/plugin-scalebar/src/test/java/com/mapbox/pluginscalebar/ScaleBarPluginTest.kt index a672e0dd..f37bf4ad 100644 --- a/plugin-scalebar/src/test/java/com/mapbox/pluginscalebar/ScaleBarPluginTest.kt +++ b/plugin-scalebar/src/test/java/com/mapbox/pluginscalebar/ScaleBarPluginTest.kt @@ -4,10 +4,6 @@ import android.content.Context import android.content.res.Resources import android.util.DisplayMetrics import android.view.View -import com.mapbox.mapboxsdk.camera.CameraPosition -import com.mapbox.mapboxsdk.maps.MapView -import com.mapbox.mapboxsdk.maps.MapboxMap -import com.mapbox.mapboxsdk.maps.Projection import io.mockk.MockKAnnotations import io.mockk.every import io.mockk.impl.annotations.MockK @@ -15,6 +11,10 @@ import io.mockk.verify import org.junit.Assert.* import org.junit.Before import org.junit.Test +import org.maplibre.android.camera.CameraPosition +import org.maplibre.android.maps.MapLibreMap +import org.maplibre.android.maps.MapView +import org.maplibre.android.maps.Projection class ScaleBarPluginTest { @MockK @@ -24,7 +24,7 @@ class ScaleBarPluginTest { lateinit var projection: Projection @MockK - lateinit var mapboxMap: MapboxMap + lateinit var maplibreMap: MapLibreMap @MockK lateinit var scaleBarOptions: ScaleBarOptions @@ -47,8 +47,8 @@ class ScaleBarPluginTest { displayMetrics.density = 2f every { mapView.width } returns 1000 every { CameraPosition.DEFAULT.target?.let { projection.getMetersPerPixelAtLatitude(it.latitude) } } returns 100_000.0 - every { mapboxMap.projection } returns projection - every { mapboxMap.cameraPosition } returns CameraPosition.DEFAULT + every { maplibreMap.projection } returns projection + every { maplibreMap.cameraPosition } returns CameraPosition.DEFAULT every { scaleBarOptions.build() } returns scaleBarWidget every { mapView.context } returns context every { mapView.pixelRatio } returns 2f @@ -59,82 +59,82 @@ class ScaleBarPluginTest { @Test fun sanity() { assertNotNull(mapView) - assertNotNull(mapboxMap) + assertNotNull(maplibreMap) assertNotNull(scaleBarOptions) assertNotNull(scaleBarWidget) } @Test fun create_isEnabled() { - val scaleBarPlugin = ScaleBarPlugin(mapView, mapboxMap) + val scaleBarPlugin = ScaleBarPlugin(mapView, maplibreMap) scaleBarPlugin.create(scaleBarOptions) assertTrue(scaleBarPlugin.isEnabled) verify { scaleBarWidget.visibility = View.VISIBLE } - verify(exactly = 1) { mapboxMap.addOnCameraMoveListener(scaleBarPlugin.cameraMoveListener) } - verify(exactly = 1) { mapboxMap.addOnCameraIdleListener(scaleBarPlugin.cameraIdleListener) } + verify(exactly = 1) { maplibreMap.addOnCameraMoveListener(scaleBarPlugin.cameraMoveListener) } + verify(exactly = 1) { maplibreMap.addOnCameraIdleListener(scaleBarPlugin.cameraIdleListener) } } @Test fun disable() { - val scaleBarPlugin = ScaleBarPlugin(mapView, mapboxMap) + val scaleBarPlugin = ScaleBarPlugin(mapView, maplibreMap) scaleBarPlugin.create(scaleBarOptions) scaleBarPlugin.isEnabled = false assertFalse(scaleBarPlugin.isEnabled) verify { scaleBarWidget.visibility = View.GONE } - verify { mapboxMap.removeOnCameraMoveListener(scaleBarPlugin.cameraMoveListener) } - verify { mapboxMap.removeOnCameraIdleListener(scaleBarPlugin.cameraIdleListener) } + verify { maplibreMap.removeOnCameraMoveListener(scaleBarPlugin.cameraMoveListener) } + verify { maplibreMap.removeOnCameraIdleListener(scaleBarPlugin.cameraIdleListener) } } @Test fun enable() { - val scaleBarPlugin = ScaleBarPlugin(mapView, mapboxMap) + val scaleBarPlugin = ScaleBarPlugin(mapView, maplibreMap) scaleBarPlugin.create(scaleBarOptions) - verify(exactly = 1) { mapboxMap.addOnCameraMoveListener(scaleBarPlugin.cameraMoveListener) } - verify(exactly = 1) { mapboxMap.addOnCameraIdleListener(scaleBarPlugin.cameraIdleListener) } + verify(exactly = 1) { maplibreMap.addOnCameraMoveListener(scaleBarPlugin.cameraMoveListener) } + verify(exactly = 1) { maplibreMap.addOnCameraIdleListener(scaleBarPlugin.cameraIdleListener) } verify(exactly = 1) { scaleBarWidget.visibility = View.VISIBLE } scaleBarPlugin.isEnabled = false scaleBarPlugin.isEnabled = true assertTrue(scaleBarPlugin.isEnabled) verify(exactly = 2) { scaleBarWidget.visibility = View.VISIBLE } - verify(exactly = 2) { mapboxMap.addOnCameraMoveListener(scaleBarPlugin.cameraMoveListener) } - verify(exactly = 2) { mapboxMap.addOnCameraIdleListener(scaleBarPlugin.cameraIdleListener) } + verify(exactly = 2) { maplibreMap.addOnCameraMoveListener(scaleBarPlugin.cameraMoveListener) } + verify(exactly = 2) { maplibreMap.addOnCameraIdleListener(scaleBarPlugin.cameraIdleListener) } } @Test fun disable_enable_widgetIsNull() { - val scaleBarPlugin = ScaleBarPlugin(mapView, mapboxMap) + val scaleBarPlugin = ScaleBarPlugin(mapView, maplibreMap) scaleBarPlugin.isEnabled = false scaleBarPlugin.isEnabled = true - verify(exactly = 0) { mapboxMap.addOnCameraMoveListener(scaleBarPlugin.cameraMoveListener) } - verify(exactly = 0) { mapboxMap.addOnCameraIdleListener(scaleBarPlugin.cameraIdleListener) } + verify(exactly = 0) { maplibreMap.addOnCameraMoveListener(scaleBarPlugin.cameraMoveListener) } + verify(exactly = 0) { maplibreMap.addOnCameraIdleListener(scaleBarPlugin.cameraIdleListener) } } @Test fun disableBeforeCreate_ignoreResults() { - val scaleBarPlugin = ScaleBarPlugin(mapView, mapboxMap) + val scaleBarPlugin = ScaleBarPlugin(mapView, maplibreMap) scaleBarPlugin.isEnabled = false scaleBarPlugin.create(scaleBarOptions) assertTrue(scaleBarPlugin.isEnabled) verify { scaleBarWidget.visibility = View.VISIBLE } - verify(exactly = 1) { mapboxMap.addOnCameraMoveListener(scaleBarPlugin.cameraMoveListener) } - verify(exactly = 1) { mapboxMap.addOnCameraIdleListener(scaleBarPlugin.cameraIdleListener) } + verify(exactly = 1) { maplibreMap.addOnCameraMoveListener(scaleBarPlugin.cameraMoveListener) } + verify(exactly = 1) { maplibreMap.addOnCameraIdleListener(scaleBarPlugin.cameraIdleListener) } } @Test fun toggled_invalidateWidget() { - val scaleBarPlugin = ScaleBarPlugin(mapView, mapboxMap) + val scaleBarPlugin = ScaleBarPlugin(mapView, maplibreMap) scaleBarPlugin.create(scaleBarOptions) - verify(exactly = 1) { mapboxMap.cameraPosition } + verify(exactly = 1) { maplibreMap.cameraPosition } verify(exactly = 1) { scaleBarWidget.setDistancePerPixel(50_000.0) } scaleBarPlugin.isEnabled = false scaleBarPlugin.isEnabled = true - verify(exactly = 2) { mapboxMap.cameraPosition } + verify(exactly = 2) { maplibreMap.cameraPosition } verify(exactly = 2) { scaleBarWidget.setDistancePerPixel(50_000.0) } } }