From 6f11e6d17d34343330c20e7f97c468541eb3f64b Mon Sep 17 00:00:00 2001 From: madwasp79 Date: Fri, 18 Jan 2019 10:54:24 +0200 Subject: [PATCH] Fixes for last pull request --- .../plus/base/MapViewTrackingUtilities.java | 6 +++--- .../src/net/osmand/plus/views/TurnPathHelper.java | 15 +++++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java b/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java index 4e3fa2093e..dcb8fd3cc5 100644 --- a/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java +++ b/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java @@ -127,7 +127,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc headingChanged = Math.abs(MapUtils.degreesDiff(prevHeading, heading)) > 1.0; } if (mapView != null) { - float speedForDirectionOfMovement = settings.SWITCH_MAP_DIRECTION_TO_COMPASS.get(); + float speedForDirectionOfMovement = settings.SWITCH_MAP_DIRECTION_TO_COMPASS.get()/3.6f; boolean smallSpeedForDirectionOfMovement = speedForDirectionOfMovement != 0 && myLocation != null && isSmallSpeedForDirectionOfMovement(myLocation, speedForDirectionOfMovement); if ((settings.ROTATE_MAP.get() == OsmandSettings.ROTATE_MAP_COMPASS || (settings.ROTATE_MAP.get() == OsmandSettings.ROTATE_MAP_BEARING && smallSpeedForDirectionOfMovement)) && !routePlanningMode) { @@ -182,7 +182,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc zoom = autozoom(tb, location); } int currentMapRotation = settings.ROTATE_MAP.get(); - float speedForDirectionOfMovement = settings.SWITCH_MAP_DIRECTION_TO_COMPASS.get(); + float speedForDirectionOfMovement = settings.SWITCH_MAP_DIRECTION_TO_COMPASS.get()/3.6f; boolean smallSpeedForDirectionOfMovement = speedForDirectionOfMovement != 0 && isSmallSpeedForDirectionOfMovement(location, speedForDirectionOfMovement); boolean smallSpeedForCompass = isSmallSpeedForCompass(location); @@ -239,7 +239,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc } public static boolean isSmallSpeedForDirectionOfMovement(Location location, float speedToDirectionOfMovement) { - return !location.hasSpeed() || location.getSpeed()* 3.6 < speedToDirectionOfMovement; + return !location.hasSpeed() || location.getSpeed() < speedToDirectionOfMovement; } public static boolean isSmallSpeedForCompass(Location location) { diff --git a/OsmAnd/src/net/osmand/plus/views/TurnPathHelper.java b/OsmAnd/src/net/osmand/plus/views/TurnPathHelper.java index f6fd3b8cf7..0ab039449f 100644 --- a/OsmAnd/src/net/osmand/plus/views/TurnPathHelper.java +++ b/OsmAnd/src/net/osmand/plus/views/TurnPathHelper.java @@ -591,15 +591,18 @@ public class TurnPathHelper { } } else if (turnIndex == SECOND_TURN) { if (TurnType.isLeftTurn(firstTurnType) && TurnType.isLeftTurn(secondTurnType)) { - if(TurnType.isSlightTurn(firstTurnType)) + if (TurnType.isSlightTurn(firstTurnType)) { turnResource = new TurnResource(secondTurnType, true, false, leftSide); - else turnResource = null; + } else { + turnResource = null; + } } else if (TurnType.isRightTurn(firstTurnType) && TurnType.isRightTurn(secondTurnType)) { - if(TurnType.isSlightTurn(firstTurnType)) + if (TurnType.isSlightTurn(firstTurnType)) { turnResource = new TurnResource(secondTurnType, true, false, leftSide); - else turnResource = null; - } else - if (firstTurnType == TurnType.C || thirdTurnType == TurnType.C) { + } else { + turnResource = null; + } + } else if (firstTurnType == TurnType.C || thirdTurnType == TurnType.C) { // get the small one turnResource = new TurnResource(secondTurnType, true, false, leftSide); } else {