-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
203 additions
and
1,287 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
151 changes: 0 additions & 151 deletions
151
android-auto-app/src/main/java/com/mapbox/navigation/examples/androidauto/MainActivity.kt
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
android-auto-app/src/main/java/com/mapbox/navigation/examples/androidauto/MainViewModel.kt
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
...auto-app/src/main/java/com/mapbox/navigation/examples/androidauto/ReplayRoutesObserver.kt
This file was deleted.
Oops, something went wrong.
56 changes: 56 additions & 0 deletions
56
...o-app/src/main/java/com/mapbox/navigation/examples/androidauto/app/CarAppSyncComponent.kt
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,56 @@ | ||
package com.mapbox.navigation.examples.androidauto.app | ||
|
||
import com.mapbox.androidauto.ActiveGuidanceState | ||
import com.mapbox.androidauto.ArrivalState | ||
import com.mapbox.androidauto.FreeDriveState | ||
import com.mapbox.androidauto.MapboxCarApp | ||
import com.mapbox.androidauto.RoutePreviewState | ||
import com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI | ||
import com.mapbox.navigation.core.MapboxNavigation | ||
import com.mapbox.navigation.dropin.NavigationView | ||
import com.mapbox.navigation.dropin.NavigationViewListener | ||
import com.mapbox.navigation.ui.base.lifecycle.UIComponent | ||
|
||
/** | ||
* This is a temporarily solution for syncing two new libraries, Drop-in-ui and the Mapbox AA. | ||
* | ||
* The libraries are defining public apis so that there can be options to determine the experience | ||
* while both the car and phone are displayed. | ||
*/ | ||
@OptIn(ExperimentalPreviewMapboxNavigationAPI::class) | ||
class CarAppSyncComponent( | ||
private val navigationView: NavigationView | ||
) : UIComponent() { | ||
|
||
private val appListener = object : NavigationViewListener() { | ||
override fun onFreeDrive() { | ||
MapboxCarApp.updateCarAppState(FreeDriveState) | ||
} | ||
|
||
override fun onDestinationPreview() { | ||
MapboxCarApp.updateCarAppState(FreeDriveState) | ||
} | ||
|
||
override fun onRoutePreview() { | ||
MapboxCarApp.updateCarAppState(RoutePreviewState) | ||
} | ||
|
||
override fun onActiveNavigation() { | ||
MapboxCarApp.updateCarAppState(ActiveGuidanceState) | ||
} | ||
|
||
override fun onArrival() { | ||
MapboxCarApp.updateCarAppState(ArrivalState) | ||
} | ||
} | ||
|
||
override fun onAttached(mapboxNavigation: MapboxNavigation) { | ||
super.onAttached(mapboxNavigation) | ||
navigationView.addListener(appListener) | ||
} | ||
|
||
override fun onDetached(mapboxNavigation: MapboxNavigation) { | ||
super.onDetached(mapboxNavigation) | ||
navigationView.removeListener(appListener) | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...oid-auto-app/src/main/java/com/mapbox/navigation/examples/androidauto/app/MainActivity.kt
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,24 @@ | ||
|
||
package com.mapbox.navigation.examples.androidauto.app | ||
|
||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatActivity | ||
import com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI | ||
import com.mapbox.navigation.core.internal.extensions.attachStarted | ||
import com.mapbox.navigation.examples.androidauto.databinding.MapboxActivityNavigationViewBinding | ||
|
||
@OptIn(ExperimentalPreviewMapboxNavigationAPI::class) | ||
class MainActivity : AppCompatActivity() { | ||
private lateinit var binding: MapboxActivityNavigationViewBinding | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
binding = MapboxActivityNavigationViewBinding.inflate(layoutInflater) | ||
setContentView(binding.root) | ||
|
||
// This allows to simulate your location | ||
binding.navigationView.api.enableReplaySession() | ||
|
||
attachStarted(CarAppSyncComponent(binding.navigationView)) | ||
} | ||
} |
Oops, something went wrong.