From bbf426e08a348cc947a2140c14ec17ca0340ba2f Mon Sep 17 00:00:00 2001 From: Denis Date: Tue, 7 Oct 2014 15:12:25 +0300 Subject: [PATCH 1/2] Updated fix to waypoint annonced many times --- OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java b/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java index d47ecf31ea..488d4919a2 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java @@ -417,7 +417,7 @@ public class WaypointHelper { } public void clearAllVisiblePoints() { - this.locationPointsStates.clear(); + //this.locationPointsStates.clear(); this.locationPoints = new ArrayList>(); } @@ -489,7 +489,7 @@ public class WaypointHelper { protected synchronized void setLocationPoints(List> locationPoints, RouteCalculationResult route) { this.locationPoints = locationPoints; - this.locationPointsStates.clear(); + //this.locationPointsStates.clear(); TIntArrayList list = new TIntArrayList(locationPoints.size()); list.fill(0, locationPoints.size(), 0); this.pointsProgress = list; From 4099177efe0a0bd19184246c3f0fca3958b7b40d Mon Sep 17 00:00:00 2001 From: Denis Date: Tue, 7 Oct 2014 15:13:56 +0300 Subject: [PATCH 2/2] simplified fix for multiple announced waypoints --- .../net/osmand/plus/helpers/WaypointHelper.java | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java b/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java index 488d4919a2..f0f6128230 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java @@ -59,8 +59,6 @@ public class WaypointHelper { private List> locationPoints = new ArrayList>(); private ConcurrentHashMap locationPointsStates = new ConcurrentHashMap(); - private List alreadyAnnouncedPoints = new ArrayList(); - private List alreadyApproachedPoints = new ArrayList(); private TIntArrayList pointsProgress = new TIntArrayList(); private RouteCalculationResult route; @@ -321,24 +319,15 @@ public class WaypointHelper { if (state != null && state.intValue() == ANNOUNCED_ONCE && getVoiceRouter().isDistanceLess(lastKnownLocation.getSpeed(), d1, SHORT_ANNOUNCE_RADIUS)) { locationPointsStates.put(point, ANNOUNCED_DONE); - if (!alreadyAnnouncedPoints.contains(lwp)){ - announcePoints.add(lwp); - alreadyAnnouncedPoints.add(lwp); - } + announcePoints.add(lwp); } else if (type != ALARMS && (state == null || state == NOT_ANNOUNCED) && getVoiceRouter().isDistanceLess(lastKnownLocation.getSpeed(), d1, LONG_ANNOUNCE_RADIUS)) { locationPointsStates.put(point, ANNOUNCED_ONCE); - if (!alreadyApproachedPoints.contains(lwp)){ - approachPoints.add(lwp); - alreadyApproachedPoints.add(lwp); - } + approachPoints.add(lwp); } else if (type == ALARMS && (state == null || state == NOT_ANNOUNCED) && getVoiceRouter().isDistanceLess(lastKnownLocation.getSpeed(), d1, ALARMS_ANNOUNCE_RADIUS)) { locationPointsStates.put(point, ANNOUNCED_ONCE); - if (!alreadyApproachedPoints.contains(lwp)){ - approachPoints.add(lwp); - alreadyApproachedPoints.add(lwp); - } + approachPoints.add(lwp); } kIterator++; }