From 3a71233073c62df5d8cc5b090a4526ef9c3a9d7f Mon Sep 17 00:00:00 2001 From: "arthur.valin" Date: Fri, 3 Mar 2023 17:33:09 +0100 Subject: [PATCH] Adding OpenStreetMap view --- app/build.gradle | 3 ++ app/src/main/AndroidManifest.xml | 34 +++++++++++++++---- .../baptistearthur/geocaching/MainWindow.kt | 6 ++++ app/src/main/res/layout/main_window.xml | 11 +++--- app/src/main/res/menu/bottom_tabs.xml | 34 +++++++++---------- build.gradle | 1 + settings.gradle | 1 + 7 files changed, 61 insertions(+), 29 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 16f2993..92336a8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,6 +1,7 @@ plugins { id 'com.android.application' id 'org.jetbrains.kotlin.android' + id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin' } android { @@ -40,4 +41,6 @@ dependencies { testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' + implementation "androidx.fragment:fragment-ktx:1.5.5" + implementation 'org.osmdroid:osmdroid-android:6.1.14' } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a2340f2..3471887 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ + xmlns:tools="http://schemas.android.com/tools" > + tools:targetApi="31" > - + + + + - - + + + - + + + + + \ No newline at end of file diff --git a/app/src/main/java/uca/baptistearthur/geocaching/MainWindow.kt b/app/src/main/java/uca/baptistearthur/geocaching/MainWindow.kt index 1730b46..65491c7 100644 --- a/app/src/main/java/uca/baptistearthur/geocaching/MainWindow.kt +++ b/app/src/main/java/uca/baptistearthur/geocaching/MainWindow.kt @@ -3,10 +3,16 @@ package uca.baptistearthur.geocaching import android.os.Bundle import androidx.appcompat.app.AppCompatActivity +import org.osmdroid.config.Configuration class MainWindow: AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + Configuration.getInstance().userAgentValue = "Geocaching" + + // Set the user agent for OsmDroid + setContentView(R.layout.main_window) } diff --git a/app/src/main/res/layout/main_window.xml b/app/src/main/res/layout/main_window.xml index 51e72d5..44b5448 100644 --- a/app/src/main/res/layout/main_window.xml +++ b/app/src/main/res/layout/main_window.xml @@ -6,8 +6,6 @@ android:layout_height="match_parent" android:orientation="vertical"> - - - - + android:layout_weight="8" + android:clickable="true" + android:focusable="true" /> - - - - - - + + + + + diff --git a/build.gradle b/build.gradle index c518bc1..f8ba472 100644 --- a/build.gradle +++ b/build.gradle @@ -3,4 +3,5 @@ plugins { id 'com.android.application' version '7.3.0' apply false id 'com.android.library' version '7.3.0' apply false id 'org.jetbrains.kotlin.android' version '1.7.10' apply false + id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin' version '2.0.1' apply false } \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index a3c4cc7..9087274 100644 --- a/settings.gradle +++ b/settings.gradle @@ -3,6 +3,7 @@ pluginManagement { gradlePluginPortal() google() mavenCentral() + } } dependencyResolutionManagement {