Merge pull request #3488 from poretsky/proposal

Respect actual moving state when emitting accessibility related orientation hints.
This commit is contained in:
vshcherb 2017-02-08 23:00:17 +01:00 committed by GitHub
commit f2f620f067
2 changed files with 4 additions and 3 deletions

View file

@ -18,6 +18,7 @@ import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper.TargetPoint;
import net.osmand.plus.access.RelativeDirectionStyle;
import net.osmand.plus.base.MapViewTrackingUtilities;
import net.osmand.plus.routing.RouteCalculationResult.NextDirectionInfo;
import net.osmand.plus.routing.RoutingHelper;
@ -193,7 +194,7 @@ public class NavigationInfo implements OsmAndCompassListener, OsmAndLocationList
RelativeDirection direction = null;
String result = distanceString(point);
result += " "; //$NON-NLS-1$
if (currentLocation.hasBearing())
if (currentLocation.hasBearing() && !MapViewTrackingUtilities.isSmallSpeedForCompass(currentLocation))
direction = new RelativeDirection(point);
else if (heading != null)
direction = new RelativeDirection(point, heading);
@ -250,7 +251,7 @@ public class NavigationInfo implements OsmAndCompassListener, OsmAndLocationList
if (autoAnnounce && app.accessibilityEnabled()) {
final TargetPoint point = app.getTargetPointsHelper().getPointToNavigate();
if (point != null) {
if ((currentLocation != null) && currentLocation.hasBearing()) {
if ((currentLocation != null) && currentLocation.hasBearing() && !MapViewTrackingUtilities.isSmallSpeedForCompass(currentLocation)) {
final long now = SystemClock.uptimeMillis();
if ((now - lastNotificationTime) >= settings.ACCESSIBILITY_AUTOANNOUNCE_PERIOD.get()) {
Location destination = new Location("map"); //$NON-NLS-1$

View file

@ -187,7 +187,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
}
}
private boolean isSmallSpeedForCompass(Location location) {
public static boolean isSmallSpeedForCompass(Location location) {
return !location.hasSpeed() || location.getSpeed() < 0.5;
}