Merge pull request #624 from krabaey/feature-arrival-factor
arrival distance factor
This commit is contained in:
commit
5fb8142608
5 changed files with 31 additions and 7 deletions
|
@ -968,7 +968,15 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
|
|||
<string name="use_short_object_names">Use object names</string>
|
||||
<string name="accessibility_preferences_descr">Accessibility related preferences</string>
|
||||
<string name="accessibility_preferences">Accessibility</string>
|
||||
<string name="rendering_out_of_memory">Not enough process memory to display selected area</string>
|
||||
<string-array name="arrival_distance_factors">
|
||||
<item>Early</item>
|
||||
<item>Normally</item>
|
||||
<item>Late</item>
|
||||
<item>At last metres</item>
|
||||
</string-array>
|
||||
<string name="arrival_distance">Arrival announcement</string>
|
||||
<string name="arrival_distance_descr">How soon do you want the arrival announcement?</string>
|
||||
<string name="rendering_out_of_memory">Not enough process memory to display selected area</string>
|
||||
<string name="use_fluorescent_overlays">Fluorescent overlays</string>
|
||||
<string name="use_fluorescent_overlays_descr">Use fluorescent colors to display tracks and routes</string>
|
||||
<string name="offline_edition">Offline editing</string>
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -662,6 +662,9 @@ public class OsmandSettings {
|
|||
public final OsmandPreference<Float> SPEECH_RATE =
|
||||
new FloatPreference("speech_rate", 1f).makeGlobal();
|
||||
|
||||
public final OsmandPreference<Float> ARRIVAL_DISTANCE_FACTOR =
|
||||
new FloatPreference("arrival_distance_factor", 1f).makeGlobal();
|
||||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final OsmandPreference<Boolean> USE_TRACKBALL_FOR_MOVEMENTS =
|
||||
new BooleanPreference("use_trackball_for_movements", true).makeGlobal();
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue