├── jitpack.yml ├── app ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── .gitignore │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── arrays.xml │ │ │ │ ├── styles.xml │ │ │ │ └── strings.xml │ │ │ ├── values-he │ │ │ │ └── strings.xml │ │ │ ├── values-hu │ │ │ │ └── strings.xml │ │ │ ├── values-it │ │ │ │ └── strings.xml │ │ │ ├── values-bn │ │ │ │ └── strings.xml │ │ │ ├── values-pt-rBR │ │ │ │ └── strings.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── drawable-hdpi │ │ │ │ ├── ic_settings.png │ │ │ │ └── paella_icon.png │ │ │ ├── drawable-ldpi │ │ │ │ └── ic_settings.png │ │ │ ├── drawable-mdpi │ │ │ │ ├── ic_settings.png │ │ │ │ └── paella_icon.png │ │ │ ├── drawable-xhdpi │ │ │ │ ├── ic_settings.png │ │ │ │ └── paella_icon.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── ic_settings.png │ │ │ │ └── paella_icon.png │ │ │ ├── drawable-xxxhdpi │ │ │ │ ├── ic_car_top.png │ │ │ │ ├── ic_settings.png │ │ │ │ └── paella_icon.png │ │ │ ├── drawable │ │ │ │ ├── demo_switch_background.xml │ │ │ │ ├── ic_delete_black_24dp.xml │ │ │ │ ├── ic_layers.xml │ │ │ │ ├── ic_new_location.xml │ │ │ │ ├── ic_refresh.xml │ │ │ │ └── ic_car.xml │ │ │ ├── menu │ │ │ │ ├── navigation_view_activity_menu.xml │ │ │ │ └── menu_off_route_detection.xml │ │ │ ├── values-id │ │ │ │ └── strings.xml │ │ │ ├── values-bg │ │ │ │ └── strings.xml │ │ │ ├── values-sv │ │ │ │ └── strings.xml │ │ │ ├── values-da │ │ │ │ └── strings.xml │ │ │ ├── values-ca │ │ │ │ └── strings.xml │ │ │ ├── values-fr │ │ │ │ └── strings.xml │ │ │ ├── layout │ │ │ │ ├── activity_main.xml │ │ │ │ ├── item_main_feature.xml │ │ │ │ ├── activity_snap_to_route_navigation.xml │ │ │ │ ├── activity_navigation_ui.xml │ │ │ │ └── activity_mock_navigation.xml │ │ │ ├── xml │ │ │ │ └── fragment_navigation_view_preferences.xml │ │ │ ├── values-uk │ │ │ │ └── strings.xml │ │ │ ├── values-my │ │ │ │ └── strings.xml │ │ │ ├── values-cs │ │ │ │ └── strings.xml │ │ │ ├── values-vi │ │ │ │ └── strings.xml │ │ │ ├── values-ru │ │ │ │ └── strings.xml │ │ │ ├── values-pt-rPT │ │ │ │ └── strings.xml │ │ │ ├── values-de │ │ │ │ └── strings.xml │ │ │ └── values-es │ │ │ │ └── strings.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── mapbox │ │ │ │ └── services │ │ │ │ └── android │ │ │ │ └── navigation │ │ │ │ └── testapp │ │ │ │ ├── NavigationApplication.java │ │ │ │ ├── SampleItem.java │ │ │ │ ├── Utils.java │ │ │ │ ├── CustomNavigationNotification.java │ │ │ │ ├── MainActivity.java │ │ │ │ ├── SnapToRouteNavigationActivity.kt │ │ │ │ ├── NavigationUIActivity.kt │ │ │ │ └── MockNavigationActivity.kt │ │ ├── assets │ │ │ ├── long_step.json │ │ │ └── reroute.json │ │ └── AndroidManifest.xml │ └── androidTest │ │ └── java │ │ └── testapp │ │ ├── NavigationViewTest.java │ │ ├── action │ │ └── OrientationChangeAction.java │ │ ├── activity │ │ └── BaseNavigationActivityTest.java │ │ ├── NavigationViewOrientationTest.java │ │ └── utils │ │ └── OnNavigationReadyIdlingResource.java └── build.gradle ├── settings.gradle ├── .github ├── preview.png └── ISSUE_TEMPLATE.md ├── gradle ├── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── checkstyle.gradle ├── dependency-updates.gradle ├── dependencies-graph.gradle ├── developer-config.gradle ├── mvn-push-android.gradle └── dependencies.gradle ├── .gitignore ├── README.md ├── config └── checkstyle │ ├── suppressions.xml │ └── checkstyle.xml ├── .tx └── config ├── LICENSE ├── gradle.properties ├── CONTRIBUTING.md ├── gradlew.bat ├── Makefile ├── localization.md ├── circle.yml ├── gradlew └── scripts └── release.py /jitpack.yml: -------------------------------------------------------------------------------- 1 | jdk: 2 | - openjdk11 3 | -------------------------------------------------------------------------------- /app/src/main/res/values/.gitignore: -------------------------------------------------------------------------------- 1 | developer-config.xml 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | include ':libandroid-navigation' 3 | include ':libandroid-navigation-ui' 4 | -------------------------------------------------------------------------------- /.github/preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/.github/preview.png -------------------------------------------------------------------------------- /app/src/main/res/values-he/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Maplibre Navigation SDK for Android 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values-hu/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Mapbox Navigációs SDK Androidhoz 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values-it/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Maplibre Navigation SDK per Android 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/values-bn/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Android এর জন্য ম্যাপবক্স নেভিগেশন SDK 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values-pt-rBR/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | SDK de Navegação Mapbox para Android 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/app/src/main/res/drawable-hdpi/ic_settings.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/paella_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/app/src/main/res/drawable-hdpi/paella_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-ldpi/ic_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/app/src/main/res/drawable-ldpi/ic_settings.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/app/src/main/res/drawable-mdpi/ic_settings.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/paella_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/app/src/main/res/drawable-mdpi/paella_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/app/src/main/res/drawable-xhdpi/ic_settings.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/paella_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/app/src/main/res/drawable-xhdpi/paella_icon.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/app/src/main/res/drawable-xxhdpi/ic_settings.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/paella_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/app/src/main/res/drawable-xxhdpi/paella_icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_car_top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/app/src/main/res/drawable-xxxhdpi/ic_car_top.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/app/src/main/res/drawable-xxxhdpi/ic_settings.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/paella_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/app/src/main/res/drawable-xxxhdpi/paella_icon.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/graphhopper/graphhopper-navigation-example/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Gradle 2 | .gradle 3 | /local.properties 4 | 5 | # IntelliJ 6 | out/ 7 | 8 | build/ 9 | /captures 10 | .externalNativeBuild 11 | 12 | # Idea 13 | .idea 14 | *.iml 15 | 16 | # MacOS 17 | .DS_Store 18 | 19 | # joe 20 | *~ -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/demo_switch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #8D64F9 4 | #7845F3 5 | #F56FA3 6 | #FF0000 7 | #FFFFFF 8 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GraphHopper Navigation Example for Android 2 | 3 | You can use this repository which uses the Maplibre SDK. 4 | 5 | But it might be simpler to use the Maplibre SDK directly. See [this PR](https://github.com/maplibre/maplibre-navigation-android/pull/162). 6 | 7 | Furthermore you can use GraphHopper with the ferrostar SDK. See [this PR](https://github.com/stadiamaps/ferrostar/pull/514). 8 | -------------------------------------------------------------------------------- /app/src/main/res/menu/navigation_view_activity_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_delete_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values-id/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Navigasi Rekayasa 3 | Mengubah Rute 4 | Navigasi Rute Peta 5 | Gambar Rute pada Peta 6 | 7 | Coba Tampilan Drop-in 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_layers.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_new_location.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /config/checkstyle/suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 16dp 6 | 16dp 7 | 16dp 8 | 50sp 9 | 10sp 10 | 96dp 11 | 56dp 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_refresh.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 8 | 9 | **Android API:** 10 | **Maplibre Navigation SDK version:** 11 | 12 | ### Steps to trigger behavior 13 | 14 | 1. 15 | 2. 16 | 3. 17 | 18 | ### Expected behavior 19 | 20 | ### Actual behavior 21 | -------------------------------------------------------------------------------- /gradle/checkstyle.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'checkstyle' 2 | 3 | checkstyle.toolVersion = '7.1.1' 4 | 5 | task checkstyle(type: Checkstyle) { 6 | description 'Checks if the code adheres to coding standards' 7 | group 'verification' 8 | 9 | configFile = new File(rootDir, "config/checkstyle/checkstyle.xml") 10 | source 'src' 11 | include '**/*.java' 12 | exclude '**/gen/**' 13 | exclude '**/*Test.java' 14 | exclude '**/*FeatureOverviewActivity.java' 15 | exclude '**/*ManeuversStyleKit.java' 16 | exclude '**/*LanesStyleKit.java' 17 | 18 | classpath = files() 19 | ignoreFailures = false 20 | } -------------------------------------------------------------------------------- /app/src/main/java/com/mapbox/services/android/navigation/testapp/NavigationApplication.java: -------------------------------------------------------------------------------- 1 | package com.mapbox.services.android.navigation.testapp; 2 | 3 | import android.app.Application; 4 | 5 | import com.mapbox.mapboxsdk.BuildConfig; 6 | import com.mapbox.mapboxsdk.Mapbox; 7 | 8 | import timber.log.Timber; 9 | 10 | public class NavigationApplication extends Application { 11 | 12 | @Override 13 | public void onCreate() { 14 | super.onCreate(); 15 | 16 | if (BuildConfig.DEBUG) { 17 | Timber.plant(new Timber.DebugTree()); 18 | } 19 | 20 | Mapbox.getInstance(getApplicationContext()); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/mapbox/services/android/navigation/testapp/SampleItem.java: -------------------------------------------------------------------------------- 1 | package com.mapbox.services.android.navigation.testapp; 2 | 3 | public class SampleItem { 4 | 5 | private String name; 6 | private String description; 7 | private Class activity; 8 | 9 | public SampleItem(String name, String description, Class activity) { 10 | this.name = name; 11 | this.description = description; 12 | this.activity = activity; 13 | } 14 | 15 | public String getName() { 16 | return name; 17 | } 18 | 19 | public String getDescription() { 20 | return description; 21 | } 22 | 23 | public Class getActivity() { 24 | return activity; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_car.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_off_route_detection.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/values-bg/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Тестова навигация 3 | Имитирай навигационна сесия с тестовия локализатор. 4 | 5 | Откриване извън маршрута 6 | Използва Route Utils клас за определяне дали потребител е извън маршрута. 7 | 8 | Пренасочване 9 | Тествай функцията за пренасочване вътре в SDK навигацията 10 | 11 | Навигационен картов маршрут 12 | Изчертава маршрут на картата 13 | 14 | 15 | -------------------------------------------------------------------------------- /gradle/dependency-updates.gradle: -------------------------------------------------------------------------------- 1 | import com.github.benmanes.gradle.versions.VersionsPlugin 2 | 3 | buildscript { 4 | repositories { 5 | gradlePluginPortal() 6 | } 7 | dependencies { 8 | classpath 'com.github.ben-manes:gradle-versions-plugin:0.44.0' 9 | } 10 | } 11 | 12 | apply plugin: VersionsPlugin 13 | 14 | // disallow release candidates as upgradable versions 15 | dependencyUpdates.resolutionStrategy { 16 | componentSelection { rules -> 17 | rules.all { ComponentSelection selection -> 18 | boolean rejected = ['alpha', 'beta', 'rc', 'cr', 'm'].any { qualifier -> 19 | selection.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/ 20 | } 21 | if (rejected) { 22 | selection.reject('Release candidate') 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/res/values-sv/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Simulera Navigering 3 | Simulera navigering med en platsmotor 4 | 5 | Avvägsdetektering 6 | Använder klassen RouteUtils för att avgöra om en användare är på rätt väg. 7 | 8 | Omdirigera 9 | Testa omdirigering via Navigations SDKt 10 | 11 | Navigeringskarta Rutt 12 | Rita en rutt på kartan 13 | 14 | Drop-in användarupplevelse 15 | 16 | 17 | -------------------------------------------------------------------------------- /.tx/config: -------------------------------------------------------------------------------- 1 | [main] 2 | host = https://www.transifex.com 3 | minimum_perc = 20 4 | lang_map = pt_BR: pt-rBR, pt_PT: pt-rPT 5 | 6 | [mapbox-navigation-sdk-for-android.test-app-strings-file] 7 | file_filter = app/src/main/res/values-/strings.xml 8 | source_file = app/src/main/res/values/strings.xml 9 | source_lang = en 10 | type = ANDROID 11 | 12 | [mapbox-navigation-sdk-for-android.libandroid-navigation-strings-file] 13 | file_filter = libandroid-navigation/src/main/res/values-/strings.xml 14 | source_file = libandroid-navigation/src/main/res/values/strings.xml 15 | source_lang = en 16 | type = ANDROID 17 | 18 | [mapbox-navigation-sdk-for-android.libandroid-navigation-ui-strings-file] 19 | file_filter = libandroid-navigation-ui/src/main/res/values-/strings.xml 20 | source_file = libandroid-navigation-ui/src/main/res/values/strings.xml 21 | source_lang = en 22 | type = ANDROID 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/values-da/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Mock navigation 3 | Kør en navigationsession ved hjælp af en lokations simulering 4 | 5 | tabt rute detektion 6 | Brug Route Utils class til at bestemme om brugeren har forladt ruten. 7 | 8 | Omdirigere 9 | Test funktionen omdirigering inde i navigation SDK 10 | 11 | Navigation kort rute 12 | Tegner en rute på kortet 13 | 14 | Drop-in UI oplevelse 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/values-ca/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Simular navegació 3 | Simular una sessió de navegació amb un motor simulat d\'ubicació. 4 | 5 | Detecció fora de ruta 6 | Empra les classes Route Utils per determinar si un usuari és fora de la ruta. 7 | 8 | Redirigir 9 | Prova la funció de redirecció dins del SDK de navegació 10 | 11 | Mapa de navegació de la ruta 12 | Dibuixa una ruta al mapa 13 | 14 | Experiència UI casual 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/values-fr/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Navigation simulée 3 | Simule une session de navigation en utilisant un moteur de localisation simulée. 4 | 5 | Détection de sortie d’itinéraire 6 | Utilise la classe Utilitaires d’Itinéraire pour déterminer is un utilisateur sort de l’itinéraire prévu. 7 | 8 | Recalcul d’itinéraire 9 | Teste la fonction de recalcul d’itinéraire du SDK de navigation 10 | 11 | Itinéraire de navigation sur carte 12 | Trace un itinéraire sur la carte 13 | 14 | Expérimentation de l’interface utilisateur 15 | 16 | Langue 17 | 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/testapp/NavigationViewTest.java: -------------------------------------------------------------------------------- 1 | package testapp; 2 | 3 | import com.mapbox.services.android.navigation.ui.v5.map.NavigationMapboxMap; 4 | import com.mapbox.services.android.navigation.v5.navigation.MapboxNavigation; 5 | 6 | import org.junit.Test; 7 | 8 | import testapp.activity.BaseNavigationActivityTest; 9 | 10 | import static junit.framework.Assert.assertNotNull; 11 | 12 | public class NavigationViewTest extends BaseNavigationActivityTest { 13 | 14 | @Override 15 | protected Class getActivityClass() { 16 | return NavigationViewTest.class; 17 | } 18 | 19 | @Test 20 | public void onInitialization_navigationMapboxMapIsNotNull() { 21 | validateTestSetup(); 22 | 23 | NavigationMapboxMap navigationMapboxMap = getNavigationView().retrieveNavigationMapboxMap(); 24 | 25 | assertNotNull(navigationMapboxMap); 26 | } 27 | 28 | @Test 29 | public void onNavigationStart_mapboxNavigationIsNotNull() { 30 | validateTestSetup(); 31 | 32 | MapboxNavigation mapboxNavigation = getNavigationView().retrieveMapboxNavigation(); 33 | 34 | assertNotNull(mapboxNavigation); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /gradle/dependencies-graph.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | mavenCentral() 4 | } 5 | 6 | dependencies { 7 | classpath pluginDependencies.dependencyGraph 8 | } 9 | } 10 | 11 | import com.vanniktech.dependency.graph.generator.DependencyGraphGeneratorPlugin 12 | import com.vanniktech.dependency.graph.generator.DependencyGraphGeneratorExtension.Generator 13 | import com.vanniktech.dependency.graph.generator.dot.GraphFormattingOptions 14 | import com.vanniktech.dependency.graph.generator.dot.Color 15 | import com.vanniktech.dependency.graph.generator.dot.Shape 16 | import com.vanniktech.dependency.graph.generator.dot.Style 17 | 18 | plugins.apply(DependencyGraphGeneratorPlugin) 19 | 20 | def mapboxGenerator = new Generator( 21 | "mapboxLibraries", // Suffix for our Gradle task. 22 | "", // Root suffix that we don't want in this case. 23 | { dependency -> dependency.getModuleGroup().startsWith("com.mapbox.mapboxsdk") }, // Only want Mapbox libs. 24 | { dependency -> true }, // Include transitive dependencies. 25 | ) 26 | 27 | dependencyGraphGenerator { 28 | generators = [mapboxGenerator] 29 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2021 Maplibre 4 | Copyright (c) 2019 Flitsmeister 5 | Copyright (c) 2018 Mapbox 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/xml/fragment_navigation_view_preferences.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 10 | 16 | 22 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Default for Device 6 | English 7 | French 8 | German 9 | Indonesian 10 | 11 | 12 | 13 | @string/default_locale 14 | en 15 | fr 16 | de 17 | in 18 | 19 | 20 | 21 | Default for Device 22 | Metric 23 | Imperial 24 | 25 | 26 | 27 | @string/default_unit_type 28 | metric 29 | imperial 30 | 31 | 32 | 33 | Driving 34 | Cycling 35 | Walking 36 | 37 | 38 | 39 | driving-traffic 40 | cycling 41 | walking 42 | 43 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_main_feature.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 24 | 25 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | VERSION_NAME=1.0.3 3 | GROUP=com.mapbox.mapboxsdk 4 | POM_URL=https://github.com/mapbox/mapbox-navigation-android 5 | POM_SCM_URL=https://github.com/mapbox/mapbox-navigation-android 6 | POM_SCM_CONNECTION=scm:git@github.com:mapbox/mapbox-navigation-android.git 7 | POM_SCM_DEV_CONNECTION=scm:git@github.com:mapbox/mapbox-navigation-android.git 8 | POM_LICENCE_NAME=The Apache Software License, Version 2.0 9 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt 10 | POM_LICENCE_DIST=repo 11 | POM_DEVELOPER_ID=mapbox 12 | POM_DEVELOPER_NAME=Mapbox 13 | # IDE (e.g. Android Studio) users: 14 | # Gradle settings configured through the IDE *will override* 15 | # any settings specified in this file. 16 | # For more details on how to configure your build environment visit 17 | # http://www.gradle.org/docs/current/userguide/build_environment.html 18 | # Specifies the JVM arguments used for the daemon process. 19 | # The setting is particularly useful for tweaking memory settings. 20 | org.gradle.jvmargs=-Xmx2048M 21 | android.useAndroidX=true 22 | android.enableJetifier=true 23 | # When configured, Gradle will run in incubating parallel mode. 24 | # This option should only be used with decoupled projects. More details, visit 25 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 26 | # org.gradle.parallel=true 27 | -------------------------------------------------------------------------------- /gradle/developer-config.gradle: -------------------------------------------------------------------------------- 1 | // 2 | // Configuration file for gradle build execution. 3 | // 4 | 5 | task accessToken { 6 | def tokenFile = new File("${projectDir}/src/main/res/values/developer-config.xml") 7 | if (!tokenFile.exists()) { 8 | String mapboxAccessToken = "$System.env.GRAPHHOPPER_API_KEY" 9 | if (mapboxAccessToken == "null") { 10 | System.out.println("You can set the GRAPHHOPPER_API_KEY environment variable.") 11 | mapboxAccessToken = "GRAPHHOPPER_API_KEY" 12 | } 13 | String tokenFileContents = "\n" + 14 | "\n" + 15 | " https://graphhopper.com/api/1/navigate/" + 16 | " \n" + 17 | " " + mapboxAccessToken + "\n" + 18 | " \n" + 19 | " https://tiles.mapilion.com/assets/osm-bright/style.json?key=MAPTILER_API_KEY\n" + 20 | " \n" + 21 | " https://tiles.mapilion.com/assets/dark-matter/style.json?key=MAPTILER_API_KEY\n" + 22 | "" 23 | tokenFile.write(tokenFileContents) 24 | } 25 | } 26 | 27 | gradle.projectsEvaluated { 28 | preBuild.dependsOn('accessToken') 29 | } -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | If you have a usage question pertaining to the Maplibre Navigation SDK for Android, or any of our other products, contact us through [our support page](https://www.mapbox.com/contact/). 4 | 5 | If you want to contribute code: 6 | 7 | 1. Please familiarize yourself with the [install process](README.md). 8 | 9 | 2. Ensure that existing [pull requests](https://github.com/maplibre/maplibre-navigation-android/pulls) and [issues](https://github.com/maplibre/maplibre-navigation-android/issues) don’t already cover your contribution or question. 10 | 11 | 3. Pull requests are gladly accepted. If there are any changes that developers should be aware of, please update the [change log](CHANGELOG.md) 12 | 13 | 4. ~~We use checkstyle to enforce good coding standards. CI will fail if your PR contains any issues.~~ Lints are currently disabled; PRs welcome to improve the situation. Unit tests still run though! 14 | 15 | ## Getting started building 16 | 17 | You can check out the repo and build locally using Android Studio or the gradle wrapper CLI, 18 | just as with any other Kotlin/Java project. 19 | Do note however that currently the lints fail, so you should run build excluding lints. 20 | For example: `./gradlew build -x lint`. 21 | 22 | # Code of conduct 23 | 24 | Everyone is invited to participate in MapLibre’s open source projects and public discussions: we want to create a welcoming and friendly environment. Harassment of participants or other unethical and unprofessional behavior will not be tolerated in our spaces. The [Contributor Covenant](http://contributor-covenant.org) applies to all projects under the Mapbox organization and we ask that you please read [the full text](http://contributor-covenant.org/version/1/2/0/). 25 | 26 | You can learn more about MapLibre at [maplibre.org](https://maplibre.org/). 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/mapbox/services/android/navigation/testapp/Utils.java: -------------------------------------------------------------------------------- 1 | package com.mapbox.services.android.navigation.testapp; 2 | 3 | import android.content.Context; 4 | import android.graphics.Bitmap; 5 | import android.graphics.Canvas; 6 | import android.graphics.drawable.Drawable; 7 | 8 | import androidx.annotation.DrawableRes; 9 | import androidx.annotation.NonNull; 10 | import androidx.core.content.res.ResourcesCompat; 11 | 12 | import com.mapbox.mapboxsdk.Mapbox; 13 | import com.mapbox.mapboxsdk.annotations.Icon; 14 | import com.mapbox.mapboxsdk.annotations.IconFactory; 15 | import com.mapbox.mapboxsdk.geometry.LatLng; 16 | 17 | import java.util.Random; 18 | 19 | import timber.log.Timber; 20 | 21 | public class Utils { 22 | 23 | /** 24 | * Demonstrates converting any Drawable to an Icon, for use as a marker icon. 25 | */ 26 | public static Icon drawableToIcon(@NonNull Context context, @DrawableRes int id) { 27 | Drawable vectorDrawable = ResourcesCompat.getDrawable(context.getResources(), id, context.getTheme()); 28 | Bitmap bitmap = Bitmap.createBitmap(vectorDrawable.getIntrinsicWidth(), 29 | vectorDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); 30 | Canvas canvas = new Canvas(bitmap); 31 | vectorDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); 32 | vectorDrawable.draw(canvas); 33 | return IconFactory.getInstance(context).fromBitmap(bitmap); 34 | } 35 | 36 | public static LatLng getRandomLatLng(double[] bbox) { 37 | Random random = new Random(); 38 | 39 | double randomLat = bbox[1] + (bbox[3] - bbox[1]) * random.nextDouble(); 40 | double randomLon = bbox[0] + (bbox[2] - bbox[0]) * random.nextDouble(); 41 | 42 | LatLng latLng = new LatLng(randomLat, randomLon); 43 | Timber.d("getRandomLatLng: %s", latLng.toString()); 44 | return latLng; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/assets/long_step.json: -------------------------------------------------------------------------------- 1 | { 2 | "waypoints": [ 3 | { 4 | "name": "Kendree Street", 5 | "location": [ 6 | -121.848098, 7 | 38.002812 8 | ] 9 | }, 10 | { 11 | "name": "Mountain Wood Lane", 12 | "location": [ 13 | -122.261111, 14 | 37.420639 15 | ] 16 | } 17 | ], 18 | "routes": [ 19 | { 20 | "legs": [ 21 | { 22 | "steps": [ 23 | { 24 | "intersections": [ 25 | { 26 | "out": 0, 27 | "entry": [ 28 | true 29 | ], 30 | "location": [ 31 | -121.848098, 32 | 38.002812 33 | ], 34 | "bearings": [ 35 | 19 36 | ] 37 | } 38 | ], 39 | "geometry": "}jongAx``lgF|bpb@z`eX", 40 | "duration": 4986.5, 41 | "distance": 119541.2, 42 | "name": "Kendree Street", 43 | "weight": 5012.2, 44 | "mode": "driving", 45 | "maneuver": { 46 | "bearing_after": 19, 47 | "location": [ 48 | -121.848098, 49 | 38.002812 50 | ], 51 | "type": "depart", 52 | "bearing_before": 0, 53 | "modifier": "left", 54 | "instruction": "Head north on Kendree Street" 55 | } 56 | } 57 | ], 58 | "weight": 5012.2, 59 | "distance": 119541.2, 60 | "summary": "CA 24, Junipero Serra Freeway", 61 | "duration": 4986.5 62 | } 63 | ], 64 | "weight_name": "routability", 65 | "geometry": "}jongAx``lgF|bpb@z`eX", 66 | "weight": 5012.2, 67 | "distance": 119541.2, 68 | "duration": 4986.5 69 | } 70 | ], 71 | "code": "Ok" 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 17 | 20 | 23 | 24 | 27 | 30 | 31 | 34 | 37 | 38 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /app/src/androidTest/java/testapp/action/OrientationChangeAction.java: -------------------------------------------------------------------------------- 1 | package testapp.action; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.content.ContextWrapper; 6 | import android.content.pm.ActivityInfo; 7 | import androidx.test.espresso.UiController; 8 | import androidx.test.espresso.ViewAction; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | 12 | import org.hamcrest.Matcher; 13 | 14 | import static androidx.test.espresso.matcher.ViewMatchers.isRoot; 15 | 16 | public class OrientationChangeAction implements ViewAction { 17 | 18 | private final int orientation; 19 | 20 | private OrientationChangeAction(int orientation) { 21 | this.orientation = orientation; 22 | } 23 | 24 | public static ViewAction orientationLandscape() { 25 | return new OrientationChangeAction(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); 26 | } 27 | 28 | public static ViewAction orientationPortrait() { 29 | return new OrientationChangeAction(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); 30 | } 31 | 32 | @Override 33 | public Matcher getConstraints() { 34 | return isRoot(); 35 | } 36 | 37 | @Override 38 | public String getDescription() { 39 | return "change orientation to " + orientation; 40 | } 41 | 42 | @Override 43 | public void perform(UiController uiController, View view) { 44 | uiController.loopMainThreadUntilIdle(); 45 | Activity activity = getActivity(view.getContext()); 46 | if (activity == null && view instanceof ViewGroup) { 47 | ViewGroup viewGroup = (ViewGroup) view; 48 | int childCount = viewGroup.getChildCount(); 49 | for (int i = 0; i < childCount && activity == null; ++i) { 50 | activity = getActivity(viewGroup.getChildAt(i).getContext()); 51 | } 52 | } 53 | activity.setRequestedOrientation(orientation); 54 | } 55 | 56 | private Activity getActivity(Context context) { 57 | while (context instanceof ContextWrapper) { 58 | if (context instanceof Activity) { 59 | return (Activity) context; 60 | } 61 | context = ((ContextWrapper) context).getBaseContext(); 62 | } 63 | return null; 64 | } 65 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_snap_to_route_navigation.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 35 | 36 |