From 5c6bceb9ba518154bc710e43e8ad0c0172768598 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 8 Oct 2011 13:12:10 +0200 Subject: [PATCH] Fix auto follow in viewing mode. Introduce special settings to manipulate with it. --- OsmAnd/res/values/strings.xml | 2 ++ OsmAnd/res/xml/settings_pref.xml | 3 +++ OsmAnd/src/net/osmand/plus/OsmandSettings.java | 9 ++++++--- OsmAnd/src/net/osmand/plus/activities/MapActivity.java | 2 +- .../src/net/osmand/plus/activities/SettingsActivity.java | 1 + 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index be390f7133..4595c8de30 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -1,5 +1,7 @@ + Enable auto follow position only in navigation mode. + Auto follow navigation Auto follow settings are enabled. Animate off Animate on diff --git a/OsmAnd/res/xml/settings_pref.xml b/OsmAnd/res/xml/settings_pref.xml index cd82f71132..b17bc493e4 100644 --- a/OsmAnd/res/xml/settings_pref.xml +++ b/OsmAnd/res/xml/settings_pref.xml @@ -59,6 +59,9 @@ + + AUTO_FOLLOW_ROUTE = new IntPreference("auto_follow_route", 0, false); { - AUTO_FOLLOW_ROUTE.setModeDefaultValue(ApplicationMode.CAR, 10); - AUTO_FOLLOW_ROUTE.setModeDefaultValue(ApplicationMode.BICYCLE, 15); - AUTO_FOLLOW_ROUTE.setModeDefaultValue(ApplicationMode.PEDESTRIAN, 20); + AUTO_FOLLOW_ROUTE.setModeDefaultValue(ApplicationMode.CAR, 7); + AUTO_FOLLOW_ROUTE.setModeDefaultValue(ApplicationMode.BICYCLE, 10); + AUTO_FOLLOW_ROUTE.setModeDefaultValue(ApplicationMode.PEDESTRIAN, 15); } + + // this value string is synchronized with settings_pref.xml preference name + public final CommonPreference AUTO_FOLLOW_ROUTE_NAV = new BooleanPreference("auto_follow_route_navigation", true, false); // this value string is synchronized with settings_pref.xml preference name public static final int ROTATE_MAP_NONE = 0; diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 38c2fc8d92..c050dcab98 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -1238,7 +1238,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso public void setMapLinkedToLocation(boolean isMapLinkedToLocation) { if(!isMapLinkedToLocation){ int autoFollow = settings.AUTO_FOLLOW_ROUTE.get(); - if(autoFollow > 0){ + if(autoFollow > 0 && (!settings.AUTO_FOLLOW_ROUTE_NAV.get() || routingHelper.isFollowingMode())){ uiHandler.removeMessages(AUTO_FOLLOW_MSG_ID); Message msg = Message.obtain(uiHandler, new Runnable() { @Override diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java index 67ba5e063f..f201c1b924 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java @@ -162,6 +162,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference registerBooleanPreference(osmandSettings.USE_ENGLISH_NAMES,screen); registerBooleanPreference(osmandSettings.SHOW_MORE_MAP_DETAIL,screen); registerBooleanPreference(osmandSettings.AUTO_ZOOM_MAP,screen); + registerBooleanPreference(osmandSettings.AUTO_FOLLOW_ROUTE_NAV,screen); registerBooleanPreference(osmandSettings.SAVE_TRACK_TO_GPX,screen); registerBooleanPreference(osmandSettings.DEBUG_RENDERING_INFO,screen); registerBooleanPreference(osmandSettings.USE_STEP_BY_STEP_RENDERING,screen);