Skip to content

Commit ec1428e

Browse files
committed
Add some flexibility to NavigationLocationProvider
1 parent cb77fca commit ec1428e

File tree

22 files changed

+172
-94
lines changed

22 files changed

+172
-94
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ Mapbox welcomes participation and contributions from everyone.
1414
- Mitigated a rare issue that caused a crash in alternative routes fork offset calculation when using `MapboxRouteLineApi#setNavigationRoutes`. [#6404](https://github.com/mapbox/mapbox-navigation-android/pull/6404)
1515
- Improved `MapboxNavigation#startTripSession(withForegroundService = true)` docs to indicate that it should only be called from a foreground state. [#6405](https://github.com/mapbox/mapbox-navigation-android/pull/6405)
1616
- Fixed an issue where registered `RouteProgressObserver`s were not invoked, while alternative routes were updated. [#6397](https://github.com/mapbox/mapbox-navigation-android/pull/6397)
17+
- Make `NavigationLocationProvider` an open class so it can be extended. [#6420](https://github.com/mapbox/mapbox-navigation-android/pull/6420)
18+
- Make `NavigationLocationProvider` inherit from `MapboxNavigationObserver` so it can be used with `MapboxNavigationApp`. [#6420](https://github.com/mapbox/mapbox-navigation-android/pull/6420)
19+
- Convert `LocationObserver` into a java interface with default functions so the functions are optional and new functions can be added. [#6420](https://github.com/mapbox/mapbox-navigation-android/pull/6420)
1720

1821
## Mapbox Navigation SDK 2.8.0 - 29 September, 2022
1922
### Changelog

examples/src/main/java/com/mapbox/navigation/examples/core/IndependentRouteGenerationActivity.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ class IndependentRouteGenerationActivity : AppCompatActivity() {
129129
private val locationObserver = object : LocationObserver {
130130
private var initialUpdateDone = false
131131

132-
override fun onNewRawLocation(rawLocation: Location) {}
133132
override fun onNewLocationMatcherResult(locationMatcherResult: LocationMatcherResult) {
134133
val enhancedLocation = locationMatcherResult.enhancedLocation
135134
if (!initialUpdateDone) {

examples/src/main/java/com/mapbox/navigation/examples/core/MapboxBuildingHighlightActivity.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ class MapboxBuildingHighlightActivity : AppCompatActivity(), OnMapLongClickListe
149149
}
150150

151151
private val locationObserver = object : LocationObserver {
152-
override fun onNewRawLocation(rawLocation: Location) {}
153152
override fun onNewLocationMatcherResult(locationMatcherResult: LocationMatcherResult) {
154153
navigationLocationProvider.changePosition(
155154
locationMatcherResult.enhancedLocation,

examples/src/main/java/com/mapbox/navigation/examples/core/MapboxCustomStyleActivity.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ class MapboxCustomStyleActivity : AppCompatActivity(), OnMapLongClickListener {
134134
private val replayProgressObserver = ReplayProgressObserver(mapboxReplayer)
135135

136136
private val locationObserver = object : LocationObserver {
137-
override fun onNewRawLocation(rawLocation: Location) {}
138137
override fun onNewLocationMatcherResult(locationMatcherResult: LocationMatcherResult) {
139138
navigationLocationProvider.changePosition(
140139
locationMatcherResult.enhancedLocation,

examples/src/main/java/com/mapbox/navigation/examples/core/MapboxJunctionActivity.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ class MapboxJunctionActivity : AppCompatActivity(), OnMapLongClickListener {
129129
private val replayProgressObserver = ReplayProgressObserver(mapboxReplayer)
130130

131131
private val locationObserver = object : LocationObserver {
132-
override fun onNewRawLocation(rawLocation: Location) {}
133132
override fun onNewLocationMatcherResult(locationMatcherResult: LocationMatcherResult) {
134133
navigationLocationProvider.changePosition(
135134
locationMatcherResult.enhancedLocation,

examples/src/main/java/com/mapbox/navigation/examples/core/MapboxManeuverActivity.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ class MapboxManeuverActivity : AppCompatActivity(), OnMapLongClickListener {
132132
}
133133

134134
private val locationObserver = object : LocationObserver {
135-
136-
override fun onNewRawLocation(rawLocation: Location) {}
137-
138135
override fun onNewLocationMatcherResult(locationMatcherResult: LocationMatcherResult) {
139136
navigationLocationProvider.changePosition(
140137
locationMatcherResult.enhancedLocation,

examples/src/main/java/com/mapbox/navigation/examples/core/MapboxNavigationActivity.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,6 @@ class MapboxNavigationActivity : AppCompatActivity() {
178178

179179
/* ----- Location and route progress callbacks ----- */
180180
private val locationObserver = object : LocationObserver {
181-
override fun onNewRawLocation(rawLocation: Location) {
182-
// not handled
183-
}
184-
185181
override fun onNewLocationMatcherResult(locationMatcherResult: LocationMatcherResult) {
186182
// update location puck's position on the map
187183
navigationLocationProvider.changePosition(

examples/src/main/java/com/mapbox/navigation/examples/core/MapboxRouteLineAndArrowActivity.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,6 @@ class MapboxRouteLineAndArrowActivity : AppCompatActivity(), OnMapLongClickListe
321321
}
322322

323323
private val locationObserver = object : LocationObserver {
324-
override fun onNewRawLocation(rawLocation: Location) {}
325324
override fun onNewLocationMatcherResult(locationMatcherResult: LocationMatcherResult) {
326325
navigationLocationProvider.changePosition(
327326
locationMatcherResult.enhancedLocation,

examples/src/main/java/com/mapbox/navigation/examples/core/camera/MapboxCameraAnimationsActivity.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,6 @@ class MapboxCameraAnimationsActivity :
146146
private val poiSource = geoJsonSource("circle_source") {}.data("")
147147

148148
private val locationObserver = object : LocationObserver {
149-
150-
override fun onNewRawLocation(rawLocation: Location) {}
151-
152149
override fun onNewLocationMatcherResult(locationMatcherResult: LocationMatcherResult) {
153150
val transitionOptions: (ValueAnimator.() -> Unit) =
154151
if (locationMatcherResult.isTeleport) {

instrumentation-tests/src/androidTest/java/com/mapbox/navigation/instrumentation_tests/utils/idling/FirstLocationIdlingResource.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ class FirstLocationIdlingResource(
5454

5555
/** Used to communicate with [MapboxNavigation.registerLocationObserver] **/
5656
private val locationObserver = object : LocationObserver {
57-
override fun onNewRawLocation(rawLocation: Location) {
58-
// Do nothing
59-
}
60-
6157
override fun onNewLocationMatcherResult(locationMatcherResult: LocationMatcherResult) {
6258
if (firstLocation == null) {
6359
firstLocation = locationMatcherResult.enhancedLocation

0 commit comments

Comments
 (0)