diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 3cebacd24b..5dc07ab55c 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -9,6 +9,8 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
+ Map orientation change in accordance with speed
+ Use built in compass instead of direction of movement to determine map orientation at low speed
All markers moved to History
Marker moved to History
Marker moved to Active
diff --git a/OsmAnd/res/xml/navigation_settings.xml b/OsmAnd/res/xml/navigation_settings.xml
index 5463abb74c..47eefe9ade 100644
--- a/OsmAnd/res/xml/navigation_settings.xml
+++ b/OsmAnd/res/xml/navigation_settings.xml
@@ -1,55 +1,92 @@
-
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
index f2f6b625a2..29a0d165b5 100644
--- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java
+++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
@@ -855,6 +855,9 @@ public class OsmandSettings {
public final OsmandPreference SPEED_LIMIT_EXCEED =
new FloatPreference("speed_limit_exceed", 5f).makeProfile();
+ public final OsmandPreference SWITCH_MAP_DIRECTION_TO_COMPASS =
+ new FloatPreference("speed_for_map_to_direction_of_movement", 0f).makeProfile();
+
// 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/activities/SettingsNavigationActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java
index eda15c2989..7978fe9b15 100644
--- a/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java
@@ -202,12 +202,14 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
speedNames[i] = speedLimitsKm[i] + " " + getString(R.string.km_h);
}
registerListPreference(settings.SPEED_LIMIT_EXCEED, screen, speedNames, speedLimitsKm);
+ registerListPreference(settings.SWITCH_MAP_DIRECTION_TO_COMPASS, screen, speedNames, speedLimitsKm);
} else {
String[] speedNames = new String[speedLimitsKm.length];
for (int i =0; i 1) {
mapView.setRotate(-val);
}
@@ -201,13 +203,17 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
zoom = autozoom(location);
}
int currentMapRotation = settings.ROTATE_MAP.get();
+ float speedForDirectionOfMovement = settings.SWITCH_MAP_DIRECTION_TO_COMPASS.get();
+ boolean smallSpeedForDirectionOfMovement = speedForDirectionOfMovement != 0 && isSmallSpeedForDirectionOfMovement(location, speedForDirectionOfMovement);
boolean smallSpeedForCompass = isSmallSpeedForCompass(location);
boolean smallSpeedForAnimation = isSmallSpeedForAnimation(location);
// boolean virtualBearing = fMode && settings.SNAP_TO_ROAD.get();
showViewAngle = (!location.hasBearing() || smallSpeedForCompass) && (tb != null &&
tb.containsLatLon(location.getLatitude(), location.getLongitude()));
if (currentMapRotation == OsmandSettings.ROTATE_MAP_BEARING) {
- if (location.hasBearing() && !smallSpeedForCompass) {
+ if (smallSpeedForDirectionOfMovement) {
+ showViewAngle = routePlanningMode;
+ } else if (location.hasBearing() && !smallSpeedForCompass) {
// special case when bearing equals to zero (we don't change anything)
if (location.getBearing() != 0f) {
rotation = -location.getBearing();
@@ -216,7 +222,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
} else if(currentMapRotation == OsmandSettings.ROTATE_MAP_COMPASS) {
showViewAngle = routePlanningMode; // disable compass rotation in that mode
}
- registerUnregisterSensor(location);
+ registerUnregisterSensor(location, smallSpeedForDirectionOfMovement);
if (settings.ANIMATE_MY_LOCATION.get() && !smallSpeedForAnimation && !movingToMyLocation &&
settings.WAKE_ON_VOICE_INT.get() == 0) {
mapView.getAnimatedDraggingThread().startMoving(
@@ -233,7 +239,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
} else if(location != null) {
showViewAngle = (!location.hasBearing() || isSmallSpeedForCompass(location)) && (tb != null &&
tb.containsLatLon(location.getLatitude(), location.getLongitude()));
- registerUnregisterSensor(location);
+ registerUnregisterSensor(location, false);
}
RoutingHelper routingHelper = app.getRoutingHelper();
followingMode = routingHelper.isFollowingMode();
@@ -252,6 +258,10 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
}
}
+ public static boolean isSmallSpeedForDirectionOfMovement(Location location, float speedToDirectionOfMovement) {
+ return !location.hasSpeed() || location.getSpeed() < speedToDirectionOfMovement;
+ }
+
public static boolean isSmallSpeedForCompass(Location location) {
return !location.hasSpeed() || location.getSpeed() < 0.5;
}
@@ -285,14 +295,15 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
&& !settings.CENTER_POSITION_ON_MAP.get() ?
OsmandSettings.BOTTOM_CONSTANT : OsmandSettings.CENTER_CONSTANT);
}
- registerUnregisterSensor(app.getLocationProvider().getLastKnownLocation());
+ registerUnregisterSensor(app.getLocationProvider().getLastKnownLocation(), false);
}
- private void registerUnregisterSensor(net.osmand.Location location) {
+ private void registerUnregisterSensor(net.osmand.Location location, boolean smallSpeedForDirectionOfMovement) {
int currentMapRotation = settings.ROTATE_MAP.get();
boolean registerCompassListener = ((showViewAngle || contextMenu != null) && location != null)
- || (currentMapRotation == OsmandSettings.ROTATE_MAP_COMPASS && !routePlanningMode);
+ || (currentMapRotation == OsmandSettings.ROTATE_MAP_COMPASS && !routePlanningMode)
+ || (currentMapRotation == OsmandSettings.ROTATE_MAP_BEARING && smallSpeedForDirectionOfMovement);
// show point view only if gps enabled
if(sensorRegistered != registerCompassListener) {
app.getLocationProvider().registerOrUnregisterCompassListener(registerCompassListener);