diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 4e810ee3a7..7fe73e8181 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -968,7 +968,15 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
Use object names
Accessibility related preferences
Accessibility
- Not enough process memory to display selected area
+
+ - Early
+ - Normally
+ - Late
+ - At last metres
+
+ Arrival announcement
+ How soon do you want the arrival announcement?
+ Not enough process memory to display selected area
Fluorescent overlays
Use fluorescent colors to display tracks and routes
Offline editing
diff --git a/OsmAnd/src/net/osmand/access/SettingsAccessibilityActivity.java b/OsmAnd/src/net/osmand/access/SettingsAccessibilityActivity.java
index 2c60fd6800..80c407c97c 100644
--- a/OsmAnd/src/net/osmand/access/SettingsAccessibilityActivity.java
+++ b/OsmAnd/src/net/osmand/access/SettingsAccessibilityActivity.java
@@ -84,6 +84,10 @@ public class SettingsAccessibilityActivity extends SettingsBaseActivity {
cat.addPreference(createCheckBoxPreference(settings.ACCESSIBILITY_EXTENSIONS, R.string.accessibility_extensions,
R.string.accessibility_extensions));
}
+
+ Float[] arrivalValues = new Float[] {1.5f, 1f, 0.5f, 0.25f} ;
+ String[] arrivalNames = getResources().getStringArray(R.array.arrival_distance_factors);
+ cat.addPreference(createListPreference(settings.ARRIVAL_DISTANCE_FACTOR, arrivalNames, arrivalValues, R.string.arrival_distance, R.string.arrival_distance_descr));
}
diff --git a/OsmAnd/src/net/osmand/plus/ApplicationMode.java b/OsmAnd/src/net/osmand/plus/ApplicationMode.java
index dea67aaaad..30f151d6f1 100644
--- a/OsmAnd/src/net/osmand/plus/ApplicationMode.java
+++ b/OsmAnd/src/net/osmand/plus/ApplicationMode.java
@@ -20,16 +20,16 @@ public class ApplicationMode {
/*
* DEFAULT("Browse map"), CAR("Car"), BICYCLE("Bicycle"), PEDESTRIAN("Pedestrian");
*/
- public static final ApplicationMode DEFAULT = create(R.string.app_mode_default, "default").speed(1.5f, 5).defLocation().
+ public static final ApplicationMode DEFAULT = create(R.string.app_mode_default, "default").speed(1.5f, 5).arrivalDistance(90).defLocation().
icon(R.drawable.ic_browse_map, R.drawable.app_mode_globus_light, R.drawable.app_mode_globus_dark).reg();
- public static final ApplicationMode CAR = create(R.string.app_mode_car, "car").speed(15.3f, 35).carLocation().
+ public static final ApplicationMode CAR = create(R.string.app_mode_car, "car").speed(15.3f, 35).arrivalDistance(90).carLocation().
icon(R.drawable.ic_car, R.drawable.ic_action_car_light, R.drawable.ic_action_car_dark).reg();
- public static final ApplicationMode BICYCLE = create(R.string.app_mode_bicycle, "bicycle").speed(5.5f, 15).bicycleLocation().
+ public static final ApplicationMode BICYCLE = create(R.string.app_mode_bicycle, "bicycle").speed(5.5f, 15).arrivalDistance(60).bicycleLocation().
icon(R.drawable.ic_bicycle, R.drawable.ic_action_bicycle_light, R.drawable.ic_action_bicycle_dark).reg();
- public static final ApplicationMode PEDESTRIAN = create(R.string.app_mode_pedestrian, "pedestrian").speed(1.5f, 5).
+ public static final ApplicationMode PEDESTRIAN = create(R.string.app_mode_pedestrian, "pedestrian").speed(1.5f, 5).arrivalDistance(45).
icon(R.drawable.ic_pedestrian, R.drawable.ic_action_pedestrian_light, R.drawable.ic_action_pedestrian_dark).reg();
public static final ApplicationMode AIRCRAFT = create(R.string.app_mode_aircraft, "aircraft").speed(40f, 100).carLocation().
@@ -127,6 +127,11 @@ public class ApplicationMode {
applicationMode.minDistanceForTurn = distForTurn;
return this;
}
+
+ public ApplicationModeBuilder arrivalDistance(int arrivalDistance) {
+ applicationMode.arrivalDistance = arrivalDistance;
+ return this;
+ }
}
private static ApplicationModeBuilder create(int key, String stringKey) {
@@ -146,6 +151,7 @@ public class ApplicationMode {
private int smallIconLight = R.drawable.app_mode_globus_light ;
private float defaultSpeed = 10f;
private int minDistanceForTurn = 50;
+ private int arrivalDistance = 90;
private int bearingIcon = R.drawable.pedestrian_bearing;
private int locationIcon = R.drawable.pedestrian_location;
@@ -280,7 +286,10 @@ public class ApplicationMode {
return minDistanceForTurn;
}
-
+ public int getArrivalDistance() {
+ return arrivalDistance;
+ }
+
public boolean isDerivedRoutingFrom(ApplicationMode mode) {
return this == mode || getParent() == mode;
}
diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
index 6156f4e8f2..1d165b248f 100644
--- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java
+++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
@@ -662,6 +662,9 @@ public class OsmandSettings {
public final OsmandPreference SPEECH_RATE =
new FloatPreference("speech_rate", 1f).makeGlobal();
+ public final OsmandPreference ARRIVAL_DISTANCE_FACTOR =
+ new FloatPreference("arrival_distance_factor", 1f).makeGlobal();
+
// this value string is synchronized with settings_pref.xml preference name
public final OsmandPreference USE_TRACKBALL_FOR_MOVEMENTS =
new BooleanPreference("use_trackball_for_movements", true).makeGlobal();
diff --git a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java
index 5bf794cf5d..2dadb2178a 100644
--- a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java
+++ b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java
@@ -433,7 +433,7 @@ public class RoutingHelper {
// 3. check if destination found
Location lastPoint = routeNodes.get(routeNodes.size() - 1);
- if (currentRoute > routeNodes.size() - 3 && currentLocation.distanceTo(lastPoint) < POSITION_TOLERANCE * 1.5) {
+ if (currentRoute > routeNodes.size() - 3 && currentLocation.distanceTo(lastPoint) < (((float)settings.getApplicationMode().getArrivalDistance()) * settings.ARRIVAL_DISTANCE_FACTOR.get())) {
showMessage(app.getString(R.string.arrived_at_destination));
TargetPointsHelper targets = app.getTargetPointsHelper();
String description = targets.getPointNavigateDescription();