From a07e3f1223cc9102571ac6401a1326c1f4c5cbf6 Mon Sep 17 00:00:00 2001 From: Koen Rabaey Date: Sun, 4 May 2014 21:02:30 +0200 Subject: [PATCH] keep informing at regular intervals --- OsmAnd/res/values/strings.xml | 3 ++ OsmAnd/res/xml/navigation_settings.xml | 16 ++++--- .../src/net/osmand/plus/OsmandSettings.java | 10 +++++ .../SettingsNavigationActivity.java | 16 +++++-- .../osmand/plus/routing/RoutingHelper.java | 2 +- .../net/osmand/plus/routing/VoiceRouter.java | 43 ++++++++++++++----- 6 files changed, 68 insertions(+), 22 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 362dd1be0f..4e810ee3a7 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -1090,6 +1090,9 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A Auto-center map view Time until map view synchronizes with current position Never + Never + Announce navigation instructions at regular intervals + Repeat navigation instructions Auto-center nav only Auto-center map view only while navigating. Auto-center map view in use. diff --git a/OsmAnd/res/xml/navigation_settings.xml b/OsmAnd/res/xml/navigation_settings.xml index af38b5d697..d998d757fe 100644 --- a/OsmAnd/res/xml/navigation_settings.xml +++ b/OsmAnd/res/xml/navigation_settings.xml @@ -1,19 +1,23 @@ - + + android:key="fast_route_mode" /> + android:summary="@string/choose_auto_follow_route_descr" /> - + android:summary="@string/auto_zoom_map_descr" /> + - + + diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 16e6a2d14e..6156f4e8f2 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -848,6 +848,16 @@ public class OsmandSettings { AUTO_FOLLOW_ROUTE.setModeDefaultValue(ApplicationMode.PEDESTRIAN, 0); } + // this value string is synchronized with settings_pref.xml preference name + // seconds to auto_follow + public final CommonPreference KEEP_INFORMING = new IntPreference("keep_informing", 0).makeProfile(); + { + // 0 means never + KEEP_INFORMING.setModeDefaultValue(ApplicationMode.CAR, 0); + KEEP_INFORMING.setModeDefaultValue(ApplicationMode.BICYCLE, 0); + KEEP_INFORMING.setModeDefaultValue(ApplicationMode.PEDESTRIAN, 0); + } + // this value string is synchronized with settings_pref.xml preference name // try without AUTO_FOLLOW_ROUTE_NAV (see forum discussion 'Simplify our navigation preference menu') //public final CommonPreference AUTO_FOLLOW_ROUTE_NAV = new BooleanPreference("auto_follow_route_navigation", true, false); diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java index 7a896f4d50..650fc83625 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java @@ -64,7 +64,7 @@ public class SettingsNavigationActivity extends SettingsBaseActivity { registerBooleanPreference(settings.SNAP_TO_ROAD, screen); - + Integer[] intValues = new Integer[] { 0, 5, 10, 15, 20, 25, 30, 45, 60, 90}; entries = new String[intValues.length]; entries[0] = getString(R.string.auto_follow_route_never); @@ -72,15 +72,23 @@ public class SettingsNavigationActivity extends SettingsBaseActivity { entries[i] = (int) intValues[i] + " " + getString(R.string.int_seconds); } registerListPreference(settings.AUTO_FOLLOW_ROUTE, screen, entries, intValues); - - - + entries = new String[AutoZoomMap.values().length]; for(int i=0; i notBefore; + } + + /** * Updates status of voice guidance * @param currentLocation */ @@ -297,7 +311,6 @@ public class VoiceRouter { speed = Math.max(currentLocation.getSpeed(), speed); } - NextDirectionInfo nextInfo = router.getNextRouteDirectionInfo(new NextDirectionInfo(), true); RouteSegmentResult currentSegment = router.getCurrentSegmentResult(); if (nextInfo.directionInfo == null) { @@ -314,11 +327,19 @@ public class VoiceRouter { playGoAheadDist = 0; } - if (!repeat && (dist == 0 || currentStatus == STATUS_TOLD)) { - // nothing said possibly that's wrong case we should say before that - // however it should be checked manually ? - return; + if (!repeat) { + if (dist == 0) { + return; + } else if (needsInforming()) { + playGoAhead(dist, getSpeakableStreetName(currentSegment, next)); + return; + } else if (currentStatus == STATUS_TOLD) { + // nothing said possibly that's wrong case we should say before that + // however it should be checked manually ? + return; + } } + // say how much to go if there is next turn is a bit far if (currentStatus == STATUS_UNKNOWN) { if (!isDistanceLess(speed, dist, TURN_IN_DISTANCE * 1.3)) {