From 899e18719890949553ca9512f5f059d4cd9715ec Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 12 Jul 2012 23:36:41 +0200 Subject: [PATCH] Introduce compass in navigation --- OsmAnd/res/values/strings.xml | 3 ++- OsmAnd/res/xml/settings_pref.xml | 6 ++---- OsmAnd/src/net/osmand/plus/OsmandSettings.java | 3 +++ OsmAnd/src/net/osmand/plus/activities/MapActivity.java | 2 +- OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index a5c81f3add..33db75c2d9 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -12,7 +12,8 @@ Hours Minutes The car was parked at: - + Use compass in navigation when diretion is not detected + Use compass Select animate route acceleration Info Control Show monitoring state on the info pane diff --git a/OsmAnd/res/xml/settings_pref.xml b/OsmAnd/res/xml/settings_pref.xml index b98172ca38..fed811d545 100644 --- a/OsmAnd/res/xml/settings_pref.xml +++ b/OsmAnd/res/xml/settings_pref.xml @@ -25,10 +25,8 @@ - + diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 3122ae5e76..ba7428aed8 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -1159,6 +1159,9 @@ public class OsmandSettings { // this value string is synchronized with settings_pref.xml preference name public final OsmandPreference VOICE_PROVIDER = new StringPreference("voice_provider", null).makeProfile(); + // this value string is synchronized with settings_pref.xml preference name + public final OsmandPreference USE_COMPASS_IN_NAVIGATION = new BooleanPreference("use_compass_navigation", true).makeProfile().cache(); + // this value string is synchronized with settings_pref.xml preference name public final CommonPreference RENDERER = new StringPreference("renderer", RendererRegistry.DEFAULT_RENDER) { { diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index d035b3d1a8..9da1dd84e5 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -728,7 +728,7 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe updateSpeedBearingEmulator(location); } - boolean enableSensorNavigation = routingHelper.isFollowingMode() ? + boolean enableSensorNavigation = routingHelper.isFollowingMode() && settings.USE_COMPASS_IN_NAVIGATION.get() ? location == null || !location.hasBearing() : false; registerUnregisterSensor(location, enableSensorNavigation); diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java index ff1b328430..3c68d02b36 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java @@ -262,7 +262,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference registerBooleanPreference(osmandSettings.USE_ENGLISH_NAMES,screen); registerBooleanPreference(osmandSettings.AUTO_ZOOM_MAP,screen); registerBooleanPreference(osmandSettings.FAST_ROUTE_MODE,screen); -// registerBooleanPreference(osmandSettings.USE_OSMAND_ROUTING_SERVICE_ALWAYS,screen); + registerBooleanPreference(osmandSettings.USE_COMPASS_IN_NAVIGATION,screen); registerBooleanPreference(osmandSettings.LEFT_SIDE_NAVIGATION,screen);