From c3184dad1e0adffd439e1c1a7f43b8bfcd7b0d8b Mon Sep 17 00:00:00 2001 From: Alexis Lecanu Date: Sat, 26 Oct 2024 13:21:18 -0700 Subject: [PATCH] Fix : Missing init key for maptiler and update style (#74) --- .../org/maplibre/android/plugins/testapp/TestStyles.kt | 7 +++++++ .../java/org/maplibre/android/plugins/testapp/Utils.kt | 10 ++-------- .../activity/annotation/BulkSymbolActivity.java | 7 ++----- .../testapp/activity/annotation/CircleActivity.java | 4 ++-- .../activity/annotation/ClusterSymbolActivity.java | 3 ++- .../annotation/DynamicSymbolChangeActivity.java | 3 ++- .../testapp/activity/annotation/FillActivity.java | 4 ++-- .../activity/annotation/FillChangeActivity.java | 3 ++- .../testapp/activity/annotation/LineActivity.java | 4 ++-- .../activity/annotation/LineChangeActivity.java | 3 ++- .../activity/annotation/PressForSymbolActivity.java | 3 ++- .../testapp/activity/annotation/SymbolActivity.java | 3 ++- .../testapp/activity/ktx/maps/MapLibreKtxActivity.kt | 8 ++++++-- .../activity/localization/LocalizationActivity.kt | 3 ++- .../testapp/activity/markerview/MarkerViewActivity.kt | 6 +++--- .../activity/offline/OfflineDownloadActivity.kt | 9 ++++----- .../testapp/activity/scalebar/ScalebarActivity.kt | 4 ++-- 17 files changed, 46 insertions(+), 38 deletions(-) create mode 100644 app/src/main/java/org/maplibre/android/plugins/testapp/TestStyles.kt diff --git a/app/src/main/java/org/maplibre/android/plugins/testapp/TestStyles.kt b/app/src/main/java/org/maplibre/android/plugins/testapp/TestStyles.kt new file mode 100644 index 00000000..b2d235f7 --- /dev/null +++ b/app/src/main/java/org/maplibre/android/plugins/testapp/TestStyles.kt @@ -0,0 +1,7 @@ +package org.maplibre.android.plugins.testapp + +enum class TestStyles(val url: String) { + POSITRON(url = "https://tiles.openfreemap.org/styles/positron"), + BRIGHT(url = "https://tiles.openfreemap.org/styles/bright"), + LIBERTY(url = "https://tiles.openfreemap.org/styles/liberty") +} \ No newline at end of file diff --git a/app/src/main/java/org/maplibre/android/plugins/testapp/Utils.kt b/app/src/main/java/org/maplibre/android/plugins/testapp/Utils.kt index a02ca31d..5d19455d 100644 --- a/app/src/main/java/org/maplibre/android/plugins/testapp/Utils.kt +++ b/app/src/main/java/org/maplibre/android/plugins/testapp/Utils.kt @@ -3,7 +3,6 @@ package org.maplibre.android.plugins.testapp import android.content.Context import android.location.Location import android.text.TextUtils -import org.maplibre.android.maps.Style import timber.log.Timber import java.io.BufferedReader import java.io.IOException @@ -17,12 +16,7 @@ import java.util.* */ object Utils { - private val STYLES = arrayOf( - Style.getPredefinedStyle("Streets"), - Style.getPredefinedStyle("Outdoors"), - Style.getPredefinedStyle("Light"), - Style.getPredefinedStyle("Dark") - ) + private val STYLES = TestStyles.entries.toTypedArray() private var index: Int = 0 @@ -38,7 +32,7 @@ object Utils { if (index == STYLES.size) { index = 0 } - return STYLES[index] + return STYLES[index].url } /** diff --git a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/BulkSymbolActivity.java b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/BulkSymbolActivity.java index 3d752200..e41cae7d 100644 --- a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/BulkSymbolActivity.java +++ b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/BulkSymbolActivity.java @@ -12,8 +12,6 @@ import android.widget.Spinner; import androidx.appcompat.app.AppCompatActivity; import androidx.core.view.MenuItemCompat; -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; @@ -22,7 +20,7 @@ import org.maplibre.android.plugins.annotation.Symbol; import org.maplibre.android.plugins.annotation.SymbolManager; import org.maplibre.android.plugins.annotation.SymbolOptions; -import org.maplibre.android.plugins.testapp.BuildConfig; +import org.maplibre.android.plugins.testapp.TestStyles; import org.maplibre.android.plugins.testapp.R; import org.maplibre.android.plugins.testapp.Utils; import org.maplibre.geojson.Feature; @@ -56,7 +54,6 @@ public class BulkSymbolActivity extends AppCompatActivity implements AdapterView protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_annotation); - MapLibre.getInstance(this, BuildConfig.MAPTILER_API_KEY, WellKnownTileServer.MapTiler); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(this::initMap); @@ -71,7 +68,7 @@ private void initMap(MapLibreMap mapLibreMap) { ); mapLibreMap.setStyle(new Style.Builder() - .fromUri(Style.getPredefinedStyle("Streets")) + .fromUri(TestStyles.LIBERTY.getUrl()) .withImage(IMAGE_ID_FIRE_HYDRANT, getDrawable(R.drawable.ic_fire_hydrant)), style -> { findViewById(R.id.fabStyles).setOnClickListener(v -> mapLibreMap.setStyle(Utils.INSTANCE.getNextStyle())); diff --git a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/CircleActivity.java b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/CircleActivity.java index 2eebf047..18870ff7 100644 --- a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/CircleActivity.java +++ b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/CircleActivity.java @@ -11,11 +11,11 @@ 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.plugins.annotation.Circle; import org.maplibre.android.plugins.annotation.CircleManager; import org.maplibre.android.plugins.annotation.CircleOptions; import org.maplibre.android.plugins.annotation.OnCircleDragListener; +import org.maplibre.android.plugins.testapp.TestStyles; import org.maplibre.android.plugins.testapp.R; import org.maplibre.android.plugins.testapp.Utils; import org.maplibre.android.utils.ColorUtils; @@ -45,7 +45,7 @@ protected void onCreate(Bundle savedInstanceState) { mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(maplibreMap -> maplibreMap.setStyle(Style.getPredefinedStyle("Streets"), style -> { + mapView.getMapAsync(maplibreMap -> maplibreMap.setStyle(TestStyles.BRIGHT.getUrl(), style -> { findViewById(R.id.fabStyles).setOnClickListener(v -> maplibreMap.setStyle(Utils.INSTANCE.getNextStyle())); maplibreMap.moveCamera(CameraUpdateFactory.zoomTo(2)); diff --git a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/ClusterSymbolActivity.java b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/ClusterSymbolActivity.java index 1e678f83..45a14424 100644 --- a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/ClusterSymbolActivity.java +++ b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/ClusterSymbolActivity.java @@ -15,6 +15,7 @@ import org.maplibre.android.plugins.annotation.Symbol; import org.maplibre.android.plugins.annotation.SymbolManager; import org.maplibre.android.plugins.annotation.SymbolOptions; +import org.maplibre.android.plugins.testapp.TestStyles; import org.maplibre.android.plugins.testapp.R; import org.maplibre.geojson.Feature; import org.maplibre.geojson.FeatureCollection; @@ -65,7 +66,7 @@ private void initMap(MapLibreMap maplibreMap) { new Pair(0, Color.GREEN) }); - maplibreMap.setStyle(new Style.Builder().fromUri(Style.getPredefinedStyle("Streets")), style -> { + maplibreMap.setStyle(new Style.Builder().fromUri(TestStyles.BRIGHT.getUrl()), style -> { symbolManager = new SymbolManager(mapView, maplibreMap, style, null, null, clusterOptions); symbolManager.setIconAllowOverlap(true); loadData(); diff --git a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/DynamicSymbolChangeActivity.java b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/DynamicSymbolChangeActivity.java index 335e5abb..641c8625 100644 --- a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/DynamicSymbolChangeActivity.java +++ b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/DynamicSymbolChangeActivity.java @@ -17,6 +17,7 @@ import org.maplibre.android.plugins.annotation.Symbol; import org.maplibre.android.plugins.annotation.SymbolManager; import org.maplibre.android.plugins.annotation.SymbolOptions; +import org.maplibre.android.plugins.testapp.TestStyles; import org.maplibre.android.plugins.testapp.R; /** @@ -58,7 +59,7 @@ protected void onCreate(Bundle savedInstanceState) { )); maplibreMap.setStyle(new Style.Builder() - .fromUri(Style.getPredefinedStyle("Streets")) + .fromUri(TestStyles.BRIGHT.getUrl()) //.withImage(ID_ICON_1, generateBitmap(R.drawable.mapbox_ic_place), true) //.withImage(ID_ICON_2, generateBitmap(R.drawable.mapbox_ic_offline), true) , style -> { diff --git a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/FillActivity.java b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/FillActivity.java index 50665c75..d4b21dbe 100644 --- a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/FillActivity.java +++ b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/FillActivity.java @@ -11,10 +11,10 @@ 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.plugins.annotation.Fill; import org.maplibre.android.plugins.annotation.FillManager; import org.maplibre.android.plugins.annotation.FillOptions; +import org.maplibre.android.plugins.testapp.TestStyles; import org.maplibre.android.plugins.testapp.R; import org.maplibre.android.plugins.testapp.Utils; import org.maplibre.android.utils.ColorUtils; @@ -41,7 +41,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_annotation); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(maplibreMap -> maplibreMap.setStyle(Style.getPredefinedStyle("Streets"), style -> { + mapView.getMapAsync(maplibreMap -> maplibreMap.setStyle(TestStyles.BRIGHT.getUrl(), style -> { findViewById(R.id.fabStyles).setOnClickListener(v -> maplibreMap.setStyle(Utils.INSTANCE.getNextStyle())); maplibreMap.moveCamera(CameraUpdateFactory.zoomTo(2)); diff --git a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/FillChangeActivity.java b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/FillChangeActivity.java index fa437f95..e7d55836 100644 --- a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/FillChangeActivity.java +++ b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/FillChangeActivity.java @@ -13,6 +13,7 @@ import org.maplibre.android.plugins.annotation.Fill; import org.maplibre.android.plugins.annotation.FillManager; import org.maplibre.android.plugins.annotation.FillOptions; +import org.maplibre.android.plugins.testapp.TestStyles; import org.maplibre.android.plugins.testapp.R; import org.maplibre.android.utils.ColorUtils; @@ -65,7 +66,7 @@ protected void onCreate(Bundle savedInstanceState) { @Override public void onMapReady(@NonNull MapLibreMap map) { - map.setStyle(new Style.Builder().fromUri(Style.getPredefinedStyle("Streets")), style -> { + map.setStyle(new Style.Builder().fromUri(TestStyles.BRIGHT.getUrl()), style -> { fillManager = new FillManager(mapView, map, style, "aerialway", null); fillManager.addClickListener(fill -> { Toast.makeText( diff --git a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/LineActivity.java b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/LineActivity.java index a3562cb4..ac456c75 100644 --- a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/LineActivity.java +++ b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/LineActivity.java @@ -9,10 +9,10 @@ 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.plugins.annotation.Line; import org.maplibre.android.plugins.annotation.LineManager; import org.maplibre.android.plugins.annotation.LineOptions; +import org.maplibre.android.plugins.testapp.TestStyles; import org.maplibre.android.plugins.testapp.R; import org.maplibre.android.plugins.testapp.Utils; import org.maplibre.android.utils.ColorUtils; @@ -38,7 +38,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_annotation); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(maplibreMap -> maplibreMap.setStyle(Style.getPredefinedStyle("Streets"), style -> { + mapView.getMapAsync(maplibreMap -> maplibreMap.setStyle(TestStyles.BRIGHT.getUrl(), style -> { findViewById(R.id.fabStyles).setOnClickListener(v -> maplibreMap.setStyle(Utils.INSTANCE.getNextStyle())); maplibreMap.moveCamera(CameraUpdateFactory.zoomTo(2)); diff --git a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/LineChangeActivity.java b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/LineChangeActivity.java index 9a444652..f2d1ed98 100644 --- a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/LineChangeActivity.java +++ b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/LineChangeActivity.java @@ -14,6 +14,7 @@ import org.maplibre.android.plugins.annotation.Line; import org.maplibre.android.plugins.annotation.LineManager; import org.maplibre.android.plugins.annotation.LineOptions; +import org.maplibre.android.plugins.testapp.TestStyles; import org.maplibre.android.plugins.testapp.R; import org.maplibre.android.plugins.testapp.Utils; import org.maplibre.android.utils.ColorUtils; @@ -67,7 +68,7 @@ protected void onCreate(Bundle savedInstanceState) { 4) ); - maplibreMap.setStyle(new Style.Builder().fromUri(Style.getPredefinedStyle("Streets")), style -> { + maplibreMap.setStyle(new Style.Builder().fromUri(TestStyles.BRIGHT.getUrl()), style -> { findViewById(R.id.fabStyles).setOnClickListener(v -> maplibreMap.setStyle(Utils.INSTANCE.getNextStyle())); lineManager = new LineManager(mapView, maplibreMap, style); diff --git a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/PressForSymbolActivity.java b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/PressForSymbolActivity.java index 40cb03ff..d5f517e9 100644 --- a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/PressForSymbolActivity.java +++ b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/PressForSymbolActivity.java @@ -17,6 +17,7 @@ import org.maplibre.android.maps.Style; import org.maplibre.android.plugins.annotation.SymbolManager; import org.maplibre.android.plugins.annotation.SymbolOptions; +import org.maplibre.android.plugins.testapp.TestStyles; import org.maplibre.android.plugins.testapp.R; import org.maplibre.android.plugins.testapp.Utils; @@ -53,7 +54,7 @@ protected void onCreate(@Nullable final Bundle savedInstanceState) { ); maplibreMap.addOnMapLongClickListener(this::addSymbol); maplibreMap.addOnMapClickListener(this::addSymbol); - maplibreMap.setStyle(getStyleBuilder(Style.getPredefinedStyle("Streets")), style -> { + maplibreMap.setStyle(getStyleBuilder(TestStyles.BRIGHT.getUrl()), style -> { findViewById(R.id.fabStyles).setOnClickListener(v -> maplibreMap.setStyle(getStyleBuilder(Utils.INSTANCE.getNextStyle()))); diff --git a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/SymbolActivity.java b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/SymbolActivity.java index 6ee52e51..db181e18 100644 --- a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/SymbolActivity.java +++ b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/annotation/SymbolActivity.java @@ -19,6 +19,7 @@ import org.maplibre.android.plugins.annotation.Symbol; import org.maplibre.android.plugins.annotation.SymbolManager; import org.maplibre.android.plugins.annotation.SymbolOptions; +import org.maplibre.android.plugins.testapp.TestStyles; import org.maplibre.android.plugins.testapp.R; import org.maplibre.android.plugins.testapp.Utils; import org.maplibre.android.style.expressions.Expression; @@ -64,7 +65,7 @@ protected void onCreate(Bundle savedInstanceState) { mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); - mapView.getMapAsync(maplibreMap -> maplibreMap.setStyle(Style.getPredefinedStyle("Streets"), style -> { + mapView.getMapAsync(maplibreMap -> maplibreMap.setStyle(TestStyles.BRIGHT.getUrl(), style -> { findViewById(R.id.fabStyles).setOnClickListener(v -> { maplibreMap.setStyle(Utils.INSTANCE.getNextStyle()); maplibreMap.getStyle(this::addAirplaneImageToStyle); diff --git a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/ktx/maps/MapLibreKtxActivity.kt b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/ktx/maps/MapLibreKtxActivity.kt index f7e208a2..3c88955e 100644 --- a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/ktx/maps/MapLibreKtxActivity.kt +++ b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/ktx/maps/MapLibreKtxActivity.kt @@ -4,7 +4,11 @@ import android.os.Bundle import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import org.maplibre.android.geometry.LatLng -import org.maplibre.android.maps.* +import org.maplibre.android.maps.MapLibreMap +import org.maplibre.android.maps.MapView +import org.maplibre.android.maps.OnMapReadyCallback +import org.maplibre.android.maps.queryRenderedFeatures +import org.maplibre.android.plugins.testapp.TestStyles import org.maplibre.android.plugins.testapp.databinding.ActivityMapsKtxBinding class MapLibreKtxActivity : AppCompatActivity(), OnMapReadyCallback, MapLibreMap.OnMapClickListener { @@ -26,7 +30,7 @@ class MapLibreKtxActivity : AppCompatActivity(), OnMapReadyCallback, MapLibreMap override fun onMapReady(maplibreMap: MapLibreMap) { this.maplibreMap = maplibreMap - maplibreMap.setStyle(Style.getPredefinedStyle("Streets")) { + maplibreMap.setStyle(TestStyles.BRIGHT.url) { maplibreMap.addOnMapClickListener(this) Toast.makeText(this, "Click on the map", Toast.LENGTH_SHORT).show() } diff --git a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/localization/LocalizationActivity.kt b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/localization/LocalizationActivity.kt index c1e801fe..ac941c8e 100644 --- a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/localization/LocalizationActivity.kt +++ b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/localization/LocalizationActivity.kt @@ -12,6 +12,7 @@ import org.maplibre.android.maps.OnMapReadyCallback import org.maplibre.android.maps.Style import org.maplibre.android.plugins.localization.LocalizationPlugin import org.maplibre.android.plugins.localization.MapLocale +import org.maplibre.android.plugins.testapp.TestStyles import org.maplibre.android.plugins.testapp.R import org.maplibre.android.plugins.testapp.Utils import org.maplibre.android.plugins.testapp.databinding.ActivityLocalizationBinding @@ -35,7 +36,7 @@ class LocalizationActivity : AppCompatActivity(), OnMapReadyCallback { } override fun onMapReady(maplibreMap: MapLibreMap) { - maplibreMap?.setStyle(Style.getPredefinedStyle("Streets")) { style -> + maplibreMap?.setStyle(TestStyles.BRIGHT.url) { style -> this.maplibreMap = maplibreMap localizationPlugin = LocalizationPlugin( diff --git a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/markerview/MarkerViewActivity.kt b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/markerview/MarkerViewActivity.kt index e02c2fa7..2142451d 100644 --- a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/markerview/MarkerViewActivity.kt +++ b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/markerview/MarkerViewActivity.kt @@ -13,12 +13,12 @@ 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.android.plugins.markerview.MarkerView import org.maplibre.android.plugins.markerview.MarkerViewManager +import org.maplibre.android.plugins.testapp.TestStyles import org.maplibre.android.plugins.testapp.R import org.maplibre.android.plugins.testapp.Utils -import java.util.* +import java.util.Random class MarkerViewActivity : AppCompatActivity(), @@ -37,7 +37,7 @@ class MarkerViewActivity : mapView.onCreate(savedInstanceState) mapView.getMapAsync { maplibreMap -> - maplibreMap.setStyle(Style.getPredefinedStyle("Streets")) { _ -> + maplibreMap.setStyle(TestStyles.BRIGHT.url) { _ -> findViewById(R.id.fabStyles).setOnClickListener { maplibreMap.setStyle(Utils.nextStyle) } maplibreMap.moveCamera(CameraUpdateFactory.zoomTo(2.0)) diff --git a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/offline/OfflineDownloadActivity.kt b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/offline/OfflineDownloadActivity.kt index bbe5be36..fd950344 100644 --- a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/offline/OfflineDownloadActivity.kt +++ b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/offline/OfflineDownloadActivity.kt @@ -8,12 +8,12 @@ import androidx.appcompat.app.AppCompatActivity 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 org.maplibre.android.plugins.offline.model.NotificationOptions import org.maplibre.android.plugins.offline.model.OfflineDownloadOptions import org.maplibre.android.plugins.offline.offline.OfflinePlugin import org.maplibre.android.plugins.offline.utils.OfflineUtils +import org.maplibre.android.plugins.testapp.TestStyles import org.maplibre.android.plugins.testapp.R import org.maplibre.android.plugins.testapp.databinding.ActivityOfflineDownloadBinding @@ -69,10 +69,9 @@ class OfflineDownloadActivity : AppCompatActivity() { private fun initSpinner() { val styles = ArrayList() - styles.add(Style.getPredefinedStyle("Streets")) - styles.add(Style.getPredefinedStyle("Dark")) - styles.add(Style.getPredefinedStyle("Light")) - styles.add(Style.getPredefinedStyle("Outdoors")) + styles.add(TestStyles.BRIGHT.url) + styles.add(TestStyles.POSITRON.url) + styles.add(TestStyles.LIBERTY.url) val spinnerArrayAdapter = ArrayAdapter(this, android.R.layout.simple_spinner_item, styles) spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) binding.spinnerStyleUrl.adapter = spinnerArrayAdapter diff --git a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/scalebar/ScalebarActivity.kt b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/scalebar/ScalebarActivity.kt index 0f1b08b2..3bdec42b 100644 --- a/app/src/main/java/org/maplibre/android/plugins/testapp/activity/scalebar/ScalebarActivity.kt +++ b/app/src/main/java/org/maplibre/android/plugins/testapp/activity/scalebar/ScalebarActivity.kt @@ -7,7 +7,7 @@ import org.maplibre.android.maps.MapView import org.maplibre.android.maps.Style import org.maplibre.android.plugins.scalebar.ScaleBarOptions import org.maplibre.android.plugins.scalebar.ScaleBarPlugin -import org.maplibre.android.plugins.testapp.BuildConfig +import org.maplibre.android.plugins.testapp.TestStyles import org.maplibre.android.plugins.testapp.databinding.ActivityScalebarBinding import org.maplibre.android.style.layers.LineLayer import org.maplibre.android.style.sources.GeoJsonSource @@ -30,7 +30,7 @@ class ScalebarActivity : AppCompatActivity() { mapView = binding.mapView mapView.onCreate(savedInstanceState) mapView.getMapAsync { maplibreMap -> - maplibreMap.setStyle("https://api.maptiler.com/maps/basic-v2/style.json?key=" + BuildConfig.MAPTILER_API_KEY) { + maplibreMap.setStyle(TestStyles.BRIGHT.url) { addScalebar(maplibreMap) setupTestLine(it) }