aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/Waypoint.java
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2013-11-10 18:11:52 +0100
committerBananeweizen <bananeweizen@gmx.de>2013-11-10 18:11:52 +0100
commit24e96ef66b990ec4851ce4cceb4d841090ae5ada (patch)
tree3f6461a07ec1cdc21c6eb6f6077ddf1c57b05221 /main/src/cgeo/geocaching/Waypoint.java
parent145d909a8ebc3e5f5105b4fc85007172d2626daf (diff)
downloadcgeo-24e96ef66b990ec4851ce4cceb4d841090ae5ada.zip
cgeo-24e96ef66b990ec4851ce4cceb4d841090ae5ada.tar.gz
cgeo-24e96ef66b990ec4851ce4cceb4d841090ae5ada.tar.bz2
fix #3421: WP from personal note doubled
Diffstat (limited to 'main/src/cgeo/geocaching/Waypoint.java')
-rw-r--r--main/src/cgeo/geocaching/Waypoint.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/main/src/cgeo/geocaching/Waypoint.java b/main/src/cgeo/geocaching/Waypoint.java
index e1a8b2f..facd914 100644
--- a/main/src/cgeo/geocaching/Waypoint.java
+++ b/main/src/cgeo/geocaching/Waypoint.java
@@ -4,6 +4,7 @@ import cgeo.geocaching.enumerations.WaypointType;
import cgeo.geocaching.geopoint.Geopoint;
import org.apache.commons.lang3.StringUtils;
+import org.eclipse.jdt.annotation.NonNull;
import java.util.Comparator;
import java.util.HashMap;
@@ -93,11 +94,18 @@ public class Waypoint implements IWaypoint {
if (newPrefixes.containsKey(prefix)) {
newPrefixes.get(prefix).merge(oldWaypoint);
} else if (oldWaypoint.isUserDefined() || forceMerge) {
- newPoints.add(oldWaypoint);
+ // personal note waypoints should always be taken from the new list only
+ if (!isPersonalNoteWaypoint(oldWaypoint)) {
+ newPoints.add(oldWaypoint);
+ }
}
}
}
+ private static boolean isPersonalNoteWaypoint(final @NonNull Waypoint waypoint) {
+ return StringUtils.startsWith(waypoint.getName(), CgeoApplication.getInstance().getString(R.string.cache_personal_note) + " ");
+ }
+
public boolean isUserDefined() {
return own || WaypointType.OWN == waypointType;
}