diff options
| author | koem <koem@petoria.de> | 2013-03-05 15:29:12 +1300 |
|---|---|---|
| committer | koem <koem@petoria.de> | 2013-03-05 15:29:12 +1300 |
| commit | 6de18e951489144131a9c09ca733c1f9ba4b973f (patch) | |
| tree | bdcbec97c6bf6bb77ebe9a2f4747afe26e220cf9 | |
| parent | 710d3b5e41ad920519902f828f5a6ccc0a1c3c34 (diff) | |
| download | cgeo-6de18e951489144131a9c09ca733c1f9ba4b973f.zip cgeo-6de18e951489144131a9c09ca733c1f9ba4b973f.tar.gz cgeo-6de18e951489144131a9c09ca733c1f9ba4b973f.tar.bz2 | |
issue 1640 - Found Caches shown on live map (low zoom problem)
solved
| -rw-r--r-- | main/src/cgeo/geocaching/maps/CGeoMap.java | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java index 4b8d1a0..3b15965 100644 --- a/main/src/cgeo/geocaching/maps/CGeoMap.java +++ b/main/src/cgeo/geocaching/maps/CGeoMap.java @@ -69,6 +69,7 @@ import android.widget.ViewSwitcher.ViewFactory; import java.io.File; import java.util.ArrayList; +import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -1109,13 +1110,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto final boolean excludeMine = Settings.isExcludeMyCaches(); final boolean excludeDisabled = Settings.isExcludeDisabledCaches(); if (mapMode == MapMode.LIVE) { - final List<Geocache> tempList = caches.getAsList(); - - for (Geocache cache : tempList) { - if ((cache.isFound() && excludeMine) || (cache.isOwner() && excludeMine) || (cache.isDisabled() && excludeDisabled)) { - caches.remove(cache); - } - } + CGeoMap.filter(caches); } countVisibleCaches(); if (cachesCnt < Settings.getWayPointsThreshold() || geocodeIntent != null) { @@ -1196,6 +1191,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto if (searchResult != null) { Set<Geocache> result = searchResult.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB); + CGeoMap.filter(result); // update the caches // new collection type needs to remove first caches.removeAll(result); @@ -1451,6 +1447,19 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto } } + private static void filter(Collection<Geocache> caches) { + boolean excludeMine = Settings.isExcludeMyCaches(); + boolean excludeDisabled = Settings.isExcludeDisabledCaches(); + + List<Geocache> removeList = new ArrayList<Geocache>(); + for (Geocache cache : caches) { + if ((cache.isFound() && excludeMine) || (cache.isOwner() && excludeMine) || (cache.isDisabled() && excludeDisabled)) { + removeList.add(cache); + } + } + caches.removeAll(removeList); + } + private static boolean mapMoved(final Viewport referenceViewport, final Viewport newViewport) { return Math.abs(newViewport.getLatitudeSpan() - referenceViewport.getLatitudeSpan()) > 50e-6 || Math.abs(newViewport.getLongitudeSpan() - referenceViewport.getLongitudeSpan()) > 50e-6 || |
