diff options
| author | rsudev <rasch@munin-soft.de> | 2013-07-19 10:59:37 -0700 |
|---|---|---|
| committer | rsudev <rasch@munin-soft.de> | 2013-07-19 10:59:37 -0700 |
| commit | 05f8940bd3c7911fae8902f315b4d5f3931678a7 (patch) | |
| tree | 8193dbd9302ade6ce773d4481d6584f7f5064747 /main/src | |
| parent | 46bcd8d179e95a80680e83eb43e9bf6ddfaf6f12 (diff) | |
| parent | 509499b5afdf91242b0cf1f13559236ccd7d9f1d (diff) | |
| download | cgeo-05f8940bd3c7911fae8902f315b4d5f3931678a7.zip cgeo-05f8940bd3c7911fae8902f315b4d5f3931678a7.tar.gz cgeo-05f8940bd3c7911fae8902f315b4d5f3931678a7.tar.bz2 | |
Merge pull request #3030 from culmor30/issue-2234
Implements #2234: Hide own/found from Live Map
Diffstat (limited to 'main/src')
| -rw-r--r-- | main/src/cgeo/geocaching/connector/gc/Tile.java | 4 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/maps/CGeoMap.java | 24 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/settings/Settings.java | 2 |
3 files changed, 25 insertions, 5 deletions
diff --git a/main/src/cgeo/geocaching/connector/gc/Tile.java b/main/src/cgeo/geocaching/connector/gc/Tile.java index ec90036..3177f2c 100644 --- a/main/src/cgeo/geocaching/connector/gc/Tile.java +++ b/main/src/cgeo/geocaching/connector/gc/Tile.java @@ -324,6 +324,10 @@ public class Tile { public static void add(final Tile tile) { tileCache.put(tile.hashCode(), tile); } + + public static void clear() { + tileCache.clear(); + } } } diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java index 007f707..f892622 100644 --- a/main/src/cgeo/geocaching/maps/CGeoMap.java +++ b/main/src/cgeo/geocaching/maps/CGeoMap.java @@ -13,6 +13,7 @@ import cgeo.geocaching.cgeocaches; import cgeo.geocaching.activity.ActivityMixin; import cgeo.geocaching.connector.ConnectorFactory; import cgeo.geocaching.connector.gc.Login; +import cgeo.geocaching.connector.gc.Tile; import cgeo.geocaching.enumerations.CacheType; import cgeo.geocaching.enumerations.LiveMapStrategy.Strategy; import cgeo.geocaching.enumerations.LoadFlags; @@ -182,7 +183,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto /** Live mode enabled for map. **/ private boolean isLiveEnabled; // other things - private boolean liveChanged = false; // previous state for loadTimer + private boolean markersInvalidated = false; // previous state for loadTimer private boolean centered = false; // if map is already centered private boolean alreadyCentered = false; // -""- for setting my location private static Set<String> dirtyCaches = null; @@ -571,6 +572,13 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto item.setTitle(res.getString(R.string.map_live_enable)); } + item = menu.findItem(R.id.menu_mycaches_mode); // own & found caches + if (Settings.isExcludeMyCaches()) { + item.setTitle(res.getString(R.string.map_mycaches_show)); + } else { + item.setTitle(res.getString(R.string.map_mycaches_hide)); + } + final Set<String> geocodesInViewport = getGeocodesForCachesInViewport(); menu.findItem(R.id.menu_store_caches).setEnabled(!isLoading() && CollectionUtils.isNotEmpty(geocodesInViewport) && new SearchResult(geocodesInViewport).hasUnsavedCaches()); @@ -622,7 +630,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto if (mapMode == MapMode.LIVE) { Settings.setLiveMap(isLiveEnabled); } - liveChanged = true; + markersInvalidated = true; lastSearchResult = null; searchIntent = null; ActivityMixin.invalidateOptionsMenu(activity); @@ -670,6 +678,14 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto mapView.repaintRequired(overlayCaches); ActivityMixin.invalidateOptionsMenu(activity); return true; + case R.id.menu_mycaches_mode: + Settings.setExcludeMine(!Settings.isExcludeMyCaches()); + markersInvalidated = true; + ActivityMixin.invalidateOptionsMenu(activity); + if (!Settings.isExcludeMyCaches()) { + Tile.Cache.clear(); + } + return true; case R.id.menu_theme_mode: selectMapTheme(); return true; @@ -1018,7 +1034,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto // check if map moved or zoomed //TODO Portree Use Rectangle inside with bigger search window. That will stop reloading on every move - final boolean moved = liveChanged || (isLiveEnabled && !downloaded) || (viewport == null) || zoomNow != zoom || + final boolean moved = markersInvalidated || (isLiveEnabled && !downloaded) || (viewport == null) || zoomNow != zoom || (mapMoved(viewport, viewportNow) && (cachesCnt <= 0 || CollectionUtils.isEmpty(caches) || !viewport.includes(viewportNow))); // update title on any change @@ -1029,7 +1045,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto // save new values if (moved) { - liveChanged = false; + markersInvalidated = false; long currentTime = System.currentTimeMillis(); diff --git a/main/src/cgeo/geocaching/settings/Settings.java b/main/src/cgeo/geocaching/settings/Settings.java index 08f30af..e44f9c0 100644 --- a/main/src/cgeo/geocaching/settings/Settings.java +++ b/main/src/cgeo/geocaching/settings/Settings.java @@ -934,7 +934,7 @@ public final class Settings { putBoolean(R.string.pref_excludedisabled, exclude); } - static void setExcludeMine(final boolean exclude) { + public static void setExcludeMine(final boolean exclude) { putBoolean(R.string.pref_excludemine, exclude); } |
