diff --git a/app/build.gradle b/app/build.gradle
index 9eec6d0..a08ce67 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -10,10 +10,11 @@ android {
defaultConfig {
applicationId "fr.iut.mapping"
- minSdk 16
- targetSdk 32
+ minSdk 19
+ targetSdk 33
versionCode 1
versionName "1.0"
+ multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@@ -31,17 +32,23 @@ android {
kotlinOptions {
jvmTarget = '1.8'
}
+
}
dependencies {
+ implementation 'org.maplibre.gl:android-sdk:9.5.2'
+
+ //implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.5.0'
- implementation 'androidx.core:core-ktx:1.7.0'
+ implementation 'androidx.fragment:fragment-ktx:1.5.5'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
+ implementation 'com.google.android.material:material:1.2.0'
+
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
- implementation 'com.google.android.material:material:1.2.0'
-}
\ No newline at end of file
+
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 5dfbefa..65a7334 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -2,6 +2,8 @@
+
+
-
-
+
\ No newline at end of file
diff --git a/app/src/main/java/fr/iut/mapping/MainActivity.kt b/app/src/main/java/fr/iut/mapping/MainActivity.kt
index 60f2af8..2bd4c0c 100644
--- a/app/src/main/java/fr/iut/mapping/MainActivity.kt
+++ b/app/src/main/java/fr/iut/mapping/MainActivity.kt
@@ -3,6 +3,7 @@ package fr.iut.mapping
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.fragment.app.Fragment
+import com.mapbox.mapboxsdk.Mapbox
import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity() {
@@ -10,6 +11,8 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
+
+ /*navBar*/
val firstFragment=FirstFragment()
val secondFragment=SecondFragment()
diff --git a/app/src/main/java/fr/iut/mapping/MapPage.kt b/app/src/main/java/fr/iut/mapping/MapPage.kt
index a73210e..74bc298 100644
--- a/app/src/main/java/fr/iut/mapping/MapPage.kt
+++ b/app/src/main/java/fr/iut/mapping/MapPage.kt
@@ -1,6 +1,77 @@
package fr.iut.mapping
+import android.os.Bundle
+import android.provider.Settings.Global.getString
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
import androidx.fragment.app.Fragment
+import com.mapbox.mapboxsdk.Mapbox
+import com.mapbox.mapboxsdk.geometry.LatLng
+import com.mapbox.mapboxsdk.maps.MapView
+import com.mapbox.mapboxsdk.maps.MapboxMapOptions
+import com.mapbox.mapboxsdk.maps.Style
class FirstFragment:Fragment(R.layout.fragment_map_page) {
+ private var mapView: MapView? = null
+
+ // Returns the Jawg url depending on the style given (jawg-streets by default)
+ // See /res/values/strings which contains the url, the list of styles and your access token.
+ private fun makeStyleUrl(): String {
+ print("${getString(R.string.mapbox_style_url)}")
+ return "${getString(R.string.mapbox_style_url)}";
+ }
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
+ super.onCreate(savedInstanceState)
+
+ Mapbox.getInstance(requireContext())
+ // Inflate the layout for this fragment
+ val rootView = inflater.inflate(R.layout.fragment_map_page, container, false)
+
+
+
+ // We get the map view to set its style with the desired Jawg url.
+ mapView = rootView.findViewById(R.id.mapView)
+ mapView?.onCreate(savedInstanceState)
+ mapView?.getMapAsync { map ->
+ map.setStyle(makeStyleUrl()) {
+ // Map fully loaded in this scope.
+ // Update attributions position
+ map.uiSettings.setAttributionMargins(15, 0, 0, 15)
+ }
+ }
+
+ return rootView
+ }
+
+ override fun onStart() {
+ super.onStart()
+ mapView?.onStart()
+ }
+
+ override fun onResume() {
+ super.onResume()
+ mapView?.onResume()
+ }
+
+ override fun onPause() {
+ super.onPause()
+ mapView?.onPause()
+ }
+
+ override fun onStop() {
+ super.onStop()
+ mapView?.onStop()
+ }
+
+ override fun onLowMemory() {
+ super.onLowMemory()
+ mapView?.onLowMemory()
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ mapView?.onDestroy()
+ }
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_map_page.xml b/app/src/main/res/layout/fragment_map_page.xml
index 718dd54..fade03c 100644
--- a/app/src/main/res/layout/fragment_map_page.xml
+++ b/app/src/main/res/layout/fragment_map_page.xml
@@ -1,14 +1,13 @@
+ android:layout_height="match_parent">
-
-
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 2e392a1..2a400f1 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -3,4 +3,6 @@
likes page
mapPage
+ BrSQRu6QFT4Q4zQVBux0vT9bkiOFpQUrEWGyBnYddcBo4hY1e60eYnSs50rLmFP4
+ https://tile.jawg.io/jawg-streets.json?access-token=BrSQRu6QFT4Q4zQVBux0vT9bkiOFpQUrEWGyBnYddcBo4hY1e60eYnSs50rLmFP4
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
index 3c5031e..c22da57 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -20,4 +20,5 @@ kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
-android.nonTransitiveRClass=true
\ No newline at end of file
+android.nonTransitiveRClass=true
+android.enableJetifier=true
\ No newline at end of file