-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(navigation-app): Add Navigation support to Maps Compose
Adds support for the Navigation SDK to Maps Compose. It just allows the user to replace a standard MapView with a NavigationView within a GoogleMap composable. The following changes were made: Added a new NavigationViewDelegate class to handle the integration between NavigationView and Maps Compose. Added a new NavigationScreen composable function to display the navigation view. Added a new MovableMarker composable function to display a draggable marker on the map. Updated the GoogleMap composable function to support the use of NavigationView. Added a new NavigationApplication class to initialize the Places SDK. Added a new ApiKeyProvider class to provide API keys for the Maps and Places SDKs. Added a new LocationProvider class to provide location data. Added a new PermissionChecker class to check for location permissions. Updated the build.gradle.kts files to include the necessary dependencies. Updated the local.defaults.properties file to include the Places API key.
- Loading branch information
Showing
44 changed files
with
1,104 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
plugins { | ||
alias(libs.plugins.android.application) | ||
alias(libs.plugins.kotlin.android) | ||
alias(libs.plugins.compose.compiler) | ||
id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin") | ||
} | ||
|
||
android { | ||
namespace = "com.google.maps.android.compose.navigation" | ||
compileSdk = 35 | ||
|
||
defaultConfig { | ||
applicationId = "com.google.maps.android.compose.navigation" | ||
minSdk = 24 | ||
targetSdk = 35 | ||
versionCode = 1 | ||
versionName = "1.0" | ||
|
||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
isMinifyEnabled = false | ||
proguardFiles( | ||
getDefaultProguardFile("proguard-android-optimize.txt"), | ||
"proguard-rules.pro" | ||
) | ||
} | ||
} | ||
|
||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
|
||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn" | ||
} | ||
|
||
buildFeatures { | ||
buildConfig = true | ||
compose = true | ||
} | ||
} | ||
|
||
configurations.all { | ||
resolutionStrategy { | ||
exclude(group = "com.google.android.gms", module = "play-services-maps") | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation(libs.androidx.core) | ||
implementation(libs.androidx.lifecycle.runtime.ktx) | ||
implementation(libs.androidx.compose.activity) | ||
implementation(platform(libs.androidx.compose.bom)) | ||
implementation(libs.androidx.compose.ui) | ||
implementation(libs.androidx.ui.graphics) | ||
implementation(libs.androidx.compose.ui.preview.tooling) | ||
implementation(libs.androidx.material3) | ||
testImplementation(libs.test.junit) | ||
androidTestImplementation(libs.androidx.junit) | ||
androidTestImplementation(libs.androidx.test.espresso) | ||
androidTestImplementation(platform(libs.androidx.compose.bom)) | ||
androidTestImplementation(libs.androidx.test.compose.ui) | ||
debugImplementation(libs.androidx.compose.ui.tooling) | ||
debugImplementation(libs.androidx.ui.test.manifest) | ||
|
||
// Instead of the lines below, regular apps would load these libraries from Maven according to | ||
// the README installation instructions | ||
implementation(project(":maps-compose")) | ||
implementation(project(":maps-compose-widgets")) | ||
implementation(project(":maps-compose-utils")) | ||
|
||
implementation(libs.maps.ktx.std) | ||
implementation(libs.maps.ktx.utils) | ||
|
||
// Use the navigation SDK which includes the maps SDK | ||
implementation(libs.navigation) | ||
|
||
implementation(libs.play.services.location) | ||
|
||
// testImplementation(libs.robolectric) | ||
testImplementation(libs.androidx.core) | ||
testImplementation(libs.truth) | ||
|
||
implementation(libs.androidx.lifecycle.viewmodel.compose) | ||
implementation(libs.androidx.lifecycle.runtime.compose) | ||
|
||
implementation(libs.places) | ||
|
||
// Accompanist permission helper | ||
implementation(libs.accompanist.permissions) | ||
|
||
} | ||
|
||
secrets { | ||
// To add your Maps API key to this project: | ||
// 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file. | ||
// 2. Add this line, where YOUR_API_KEY is your API key: | ||
// MAPS_API_KEY=YOUR_API_KEY | ||
propertiesFileName = "secrets.properties" | ||
|
||
// A properties file containing default secret values. This file can be | ||
// checked in version control. | ||
defaultPropertiesFileName = "local.defaults.properties" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
Oops, something went wrong.