Skip to content

Commit

Permalink
Fix : Missing init key for maptiler and update style
Browse files Browse the repository at this point in the history
  • Loading branch information
ravenfeld committed Oct 18, 2024
1 parent 256967a commit 1f7b11c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ package org.maplibre.android.plugins.testapp

import android.app.Application
import org.maplibre.android.MapLibre
import org.maplibre.android.WellKnownTileServer
import timber.log.Timber

class PluginApplication : Application() {

override fun onCreate() {
super.onCreate()
initializeLogger()
MapLibre.getInstance(this)
MapLibre.getInstance(this, BuildConfig.MAPTILER_API_KEY, WellKnownTileServer.MapTiler)
}

private fun initializeLogger() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ object Utils {

private val STYLES = arrayOf(
Style.getPredefinedStyle("Streets"),
Style.getPredefinedStyle("Outdoors"),
Style.getPredefinedStyle("Light"),
Style.getPredefinedStyle("Dark")
Style.getPredefinedStyle("Outdoor"),
Style.getPredefinedStyle("Basic"),
Style.getPredefinedStyle("Pastel")
)

private var index: Int = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ 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.BuildConfig
import org.maplibre.android.plugins.testapp.R
import org.maplibre.android.plugins.testapp.databinding.ActivityOfflineDownloadBinding

Expand Down Expand Up @@ -70,9 +71,9 @@ class OfflineDownloadActivity : AppCompatActivity() {
private fun initSpinner() {
val styles = ArrayList<String>()
styles.add(Style.getPredefinedStyle("Streets"))
styles.add(Style.getPredefinedStyle("Dark"))
styles.add(Style.getPredefinedStyle("Light"))
styles.add(Style.getPredefinedStyle("Outdoors"))
styles.add(Style.getPredefinedStyle("Basic"))
styles.add(Style.getPredefinedStyle("Pastel"))
styles.add(Style.getPredefinedStyle("Outdoor"))
val spinnerArrayAdapter = ArrayAdapter(this, android.R.layout.simple_spinner_item, styles)
spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
binding.spinnerStyleUrl.adapter = spinnerArrayAdapter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(Style.getPredefinedStyle("Basic")) {
addScalebar(maplibreMap)
setupTestLine(it)
}
Expand Down

0 comments on commit 1f7b11c

Please sign in to comment.