Skip to content

Commit f5d976f

Browse files
authored
Remove MapboxNavigationOptions ignored by Navigator (#1500)
1 parent da91971 commit f5d976f

File tree

8 files changed

+4
-257
lines changed

8 files changed

+4
-257
lines changed

libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/MapboxNavigationActivity.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,11 @@ protected void onDestroy() {
9292

9393
@Override
9494
public void onNavigationReady(boolean isRunning) {
95-
MapboxNavigationOptions.Builder navigationOptions = MapboxNavigationOptions.builder();
9695
NavigationViewOptions.Builder options = NavigationViewOptions.builder();
9796
options.navigationListener(this);
9897
extractRoute(options);
99-
extractConfiguration(options, navigationOptions);
100-
options.navigationOptions(navigationOptions.build());
98+
extractConfiguration(options);
99+
options.navigationOptions(MapboxNavigationOptions.builder().build());
101100
navigationView.startNavigation(options.build());
102101
}
103102

@@ -132,16 +131,11 @@ private void extractRoute(NavigationViewOptions.Builder options) {
132131
options.directionsRoute(route);
133132
}
134133

135-
private void extractConfiguration(NavigationViewOptions.Builder options,
136-
MapboxNavigationOptions.Builder navigationOptions) {
134+
private void extractConfiguration(NavigationViewOptions.Builder options) {
137135
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
138136
options.shouldSimulateRoute(preferences
139137
.getBoolean(NavigationConstants.NAVIGATION_VIEW_SIMULATE_ROUTE, false));
140138
options.directionsProfile(preferences
141139
.getString(NavigationConstants.NAVIGATION_VIEW_ROUTE_PROFILE_KEY, DirectionsCriteria.PROFILE_DRIVING_TRAFFIC));
142-
navigationOptions.enableOffRouteDetection(preferences
143-
.getBoolean(NavigationConstants.NAVIGATION_VIEW_OFF_ROUTE_ENABLED_KEY, true));
144-
navigationOptions.snapToRoute(preferences
145-
.getBoolean(NavigationConstants.NAVIGATION_VIEW_SNAP_ENABLED_KEY, true));
146140
}
147141
}

libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationLauncher.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ private static void storeDirectionsRouteValue(NavigationLauncherOptions options,
7171
private static void storeConfiguration(NavigationLauncherOptions options, SharedPreferences.Editor editor) {
7272
editor.putBoolean(NavigationConstants.NAVIGATION_VIEW_SIMULATE_ROUTE, options.shouldSimulateRoute());
7373
editor.putString(NavigationConstants.NAVIGATION_VIEW_ROUTE_PROFILE_KEY, options.directionsProfile());
74-
editor.putBoolean(NavigationConstants.NAVIGATION_VIEW_OFF_ROUTE_ENABLED_KEY, options.enableOffRouteDetection());
75-
editor.putBoolean(NavigationConstants.NAVIGATION_VIEW_SNAP_ENABLED_KEY, options.snapToRoute());
7674
}
7775

7876
private static void storeThemePreferences(NavigationLauncherOptions options, SharedPreferences.Editor editor) {

libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/NavigationLauncherOptions.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
@AutoValue
1111
public abstract class NavigationLauncherOptions extends NavigationUiOptions {
1212

13-
public abstract boolean enableOffRouteDetection();
14-
15-
public abstract boolean snapToRoute();
16-
1713
@Nullable
1814
public abstract CameraPosition initialMapCameraPosition();
1915

@@ -32,10 +28,6 @@ public abstract static class Builder {
3228

3329
public abstract Builder waynameChipEnabled(boolean waynameChipEnabled);
3430

35-
public abstract Builder enableOffRouteDetection(boolean enableOffRouteDetection);
36-
37-
public abstract Builder snapToRoute(boolean snapToRoute);
38-
3931
public abstract Builder initialMapCameraPosition(@Nullable CameraPosition initialMapCameraPosition);
4032

4133
public abstract NavigationLauncherOptions build();
@@ -44,8 +36,6 @@ public abstract static class Builder {
4436
public static NavigationLauncherOptions.Builder builder() {
4537
return new AutoValue_NavigationLauncherOptions.Builder()
4638
.shouldSimulateRoute(false)
47-
.enableOffRouteDetection(true)
48-
.snapToRoute(true)
4939
.waynameChipEnabled(true);
5040
}
5141
}

libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigation.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,7 @@ public void startNavigation(@NonNull DirectionsRoute directionsRoute) {
331331

332332
/**
333333
* Call this when the navigation session needs to end before the user reaches their final
334-
* destination. There isn't a need to manually end the navigation session using this API when the
335-
* user arrives unless you set {@link MapboxNavigationOptions#manuallyEndNavigationUponCompletion()}
336-
* to true.
334+
* destination.
337335
* <p>
338336
* Ending the navigation session ends and unbinds the navigation service meaning any milestone,
339337
* progress change, or off-route listeners will not be invoked anymore. A call returning false

libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/MapboxNavigationOptions.java

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,12 @@
1515
@AutoValue
1616
public abstract class MapboxNavigationOptions {
1717

18-
public abstract double maxTurnCompletionOffset();
19-
20-
public abstract double maneuverZoneRadius();
21-
22-
public abstract double maximumDistanceOffRoute();
23-
24-
public abstract double deadReckoningTimeInterval();
25-
26-
public abstract double maxManipulatedCourseAngle();
27-
28-
public abstract double userLocationSnapDistance();
29-
30-
public abstract int secondsBeforeReroute();
31-
3218
public abstract boolean defaultMilestonesEnabled();
3319

34-
public abstract boolean snapToRoute();
35-
36-
public abstract boolean enableOffRouteDetection();
37-
3820
public abstract boolean enableFasterRouteDetection();
3921

40-
public abstract boolean manuallyEndNavigationUponCompletion();
41-
42-
public abstract double metersRemainingTillArrival();
43-
4422
public abstract boolean isFromNavigationUi();
4523

46-
public abstract double minimumDistanceBeforeRerouting();
47-
4824
public abstract boolean isDebugLoggingEnabled();
4925

5026
@Nullable
@@ -65,36 +41,12 @@ public abstract class MapboxNavigationOptions {
6541
@AutoValue.Builder
6642
public abstract static class Builder {
6743

68-
public abstract Builder maxTurnCompletionOffset(double maxTurnCompletionOffset);
69-
70-
public abstract Builder maneuverZoneRadius(double maneuverZoneRadius);
71-
72-
public abstract Builder maximumDistanceOffRoute(double maximumDistanceOffRoute);
73-
74-
public abstract Builder deadReckoningTimeInterval(double deadReckoningTimeInterval);
75-
76-
public abstract Builder maxManipulatedCourseAngle(double maxManipulatedCourseAngle);
77-
78-
public abstract Builder userLocationSnapDistance(double userLocationSnapDistance);
79-
80-
public abstract Builder secondsBeforeReroute(int secondsBeforeReroute);
81-
8244
public abstract Builder defaultMilestonesEnabled(boolean defaultMilestonesEnabled);
8345

84-
public abstract Builder snapToRoute(boolean snapToRoute);
85-
86-
public abstract Builder enableOffRouteDetection(boolean enableOffRouteDetection);
87-
8846
public abstract Builder enableFasterRouteDetection(boolean enableFasterRouteDetection);
8947

90-
public abstract Builder manuallyEndNavigationUponCompletion(boolean manuallyEndNavigation);
91-
92-
public abstract Builder metersRemainingTillArrival(double metersRemainingTillArrival);
93-
9448
public abstract Builder isFromNavigationUi(boolean isFromNavigationUi);
9549

96-
public abstract Builder minimumDistanceBeforeRerouting(double distanceInMeters);
97-
9850
public abstract Builder isDebugLoggingEnabled(boolean debugLoggingEnabled);
9951

10052
public abstract Builder navigationNotification(NavigationNotification notification);
@@ -112,20 +64,8 @@ public abstract static class Builder {
11264

11365
public static Builder builder() {
11466
return new AutoValue_MapboxNavigationOptions.Builder()
115-
.maxTurnCompletionOffset(NavigationConstants.MAXIMUM_ALLOWED_DEGREE_OFFSET_FOR_TURN_COMPLETION)
116-
.maneuverZoneRadius(NavigationConstants.MANEUVER_ZONE_RADIUS)
117-
.maximumDistanceOffRoute(NavigationConstants.MAXIMUM_DISTANCE_BEFORE_OFF_ROUTE)
118-
.deadReckoningTimeInterval(NavigationConstants.DEAD_RECKONING_TIME_INTERVAL)
119-
.maxManipulatedCourseAngle(NavigationConstants.MAX_MANIPULATED_COURSE_ANGLE)
120-
.userLocationSnapDistance(NavigationConstants.USER_LOCATION_SNAPPING_DISTANCE)
121-
.secondsBeforeReroute(NavigationConstants.SECONDS_BEFORE_REROUTE)
122-
.enableOffRouteDetection(true)
12367
.enableFasterRouteDetection(false)
124-
.snapToRoute(true)
125-
.manuallyEndNavigationUponCompletion(false)
12668
.defaultMilestonesEnabled(true)
127-
.minimumDistanceBeforeRerouting(NavigationConstants.MINIMUM_DISTANCE_BEFORE_REROUTING)
128-
.metersRemainingTillArrival(NavigationConstants.METERS_REMAINING_TILL_ARRIVAL)
12969
.isFromNavigationUi(false)
13070
.isDebugLoggingEnabled(false)
13171
.roundingIncrement(ROUNDING_INCREMENT_FIFTY)

libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/NavigationConstants.java

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import android.support.annotation.IntDef;
44
import android.support.annotation.StringDef;
55

6-
import com.mapbox.services.android.navigation.v5.offroute.OffRouteListener;
7-
86
/**
97
* Navigation constants
108
*
@@ -51,72 +49,6 @@ private NavigationConstants() {
5149
*/
5250
public static final int NAVIGATION_NOTIFICATION_ID = 5678;
5351

54-
/**
55-
* Threshold user must be within to count as completing a step. One of two heuristics used to know
56-
* when a user completes a step, see {@link #MANEUVER_ZONE_RADIUS}. The users heading and the
57-
* finalHeading are compared. If this number is within this defined constant, the user has
58-
* completed the step.
59-
*
60-
* @since 0.1.0
61-
*/
62-
static final int MAXIMUM_ALLOWED_DEGREE_OFFSET_FOR_TURN_COMPLETION = 30;
63-
64-
/**
65-
* Radius in meters the user must enter to count as completing a step. One of two heuristics used
66-
* to know when a user completes a step, see
67-
* {@link #MAXIMUM_ALLOWED_DEGREE_OFFSET_FOR_TURN_COMPLETION}.
68-
*
69-
* @since 0.1.0
70-
*/
71-
public static final int MANEUVER_ZONE_RADIUS = 40;
72-
73-
/**
74-
* Maximum number of meters the user can travel away from step before the
75-
* {@link OffRouteListener}'s called.
76-
*
77-
* @since 0.2.0
78-
*/
79-
static final double MAXIMUM_DISTANCE_BEFORE_OFF_ROUTE = 20;
80-
81-
/**
82-
* Seconds used before a reroute occurs.
83-
*
84-
* @since 0.2.0
85-
*/
86-
static final int SECONDS_BEFORE_REROUTE = 3;
87-
88-
/**
89-
* Accepted deviation excluding horizontal accuracy before the user is considered to be off route.
90-
*
91-
* @since 0.1.0
92-
*/
93-
static final double USER_LOCATION_SNAPPING_DISTANCE = 10;
94-
95-
/**
96-
* When calculating whether or not the user is on the route, we look where the user will be given
97-
* their speed and this variable.
98-
*
99-
* @since 0.2.0
100-
*/
101-
static final double DEAD_RECKONING_TIME_INTERVAL = 1.0;
102-
103-
/**
104-
* Maximum angle the user puck will be rotated when snapping the user's course to the route line.
105-
*
106-
* @since 0.3.0
107-
*/
108-
static final int MAX_MANIPULATED_COURSE_ANGLE = 25;
109-
110-
/**
111-
* Meter radius which the user must be inside for an arrival milestone to be triggered and
112-
* navigation to end.
113-
*/
114-
public static final double METERS_REMAINING_TILL_ARRIVAL = 40;
115-
116-
public static final double MINIMUM_BACKUP_DISTANCE_FOR_OFF_ROUTE = 50;
117-
118-
public static final double MINIMUM_DISTANCE_BEFORE_REROUTING = 50;
119-
12052
/**
12153
* Duration in which the AlertView is shown with the "Report Problem" text.
12254
*/
@@ -234,8 +166,6 @@ private NavigationConstants() {
234166
public static final String NAVIGATION_VIEW_ROUTE_KEY = "route_json";
235167
public static final String NAVIGATION_VIEW_SIMULATE_ROUTE = "navigation_view_simulate_route";
236168
public static final String NAVIGATION_VIEW_ROUTE_PROFILE_KEY = "navigation_view_route_profile";
237-
public static final String NAVIGATION_VIEW_OFF_ROUTE_ENABLED_KEY = "navigation_view_off_route_enabled";
238-
public static final String NAVIGATION_VIEW_SNAP_ENABLED_KEY = "navigation_view_snap_enabled";
239169

240170
// Step Maneuver Types
241171
public static final String STEP_MANEUVER_TYPE_TURN = "turn";

libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/ToleranceUtils.java

Lines changed: 0 additions & 43 deletions
This file was deleted.

libandroid-navigation/src/test/java/com/mapbox/services/android/navigation/v5/utils/ToleranceUtilsTest.java

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)