aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
authorJavaDog <culmor30@gmail.com>2013-07-19 12:14:17 -0400
committerJavaDog <culmor30@gmail.com>2013-07-19 12:14:17 -0400
commit71dc6fd3d4f551b7200c7c68417a71c15f2d3b00 (patch)
treed87ea0aa9814bf090c358e8a7223e0b2512f6f11 /main/src
parent46bcd8d179e95a80680e83eb43e9bf6ddfaf6f12 (diff)
downloadcgeo-71dc6fd3d4f551b7200c7c68417a71c15f2d3b00.zip
cgeo-71dc6fd3d4f551b7200c7c68417a71c15f2d3b00.tar.gz
cgeo-71dc6fd3d4f551b7200c7c68417a71c15f2d3b00.tar.bz2
Implements #2234: Hide own/found from Live Map
Added a button to show/hide own/found caches in the Live Map menu, under the "Map settings" option (renamed from "Map modes"). Refactored boolean "liveChanged" in CGeoMap.java, renamed to "markersInvalidated" as it now has more than that one use.
Diffstat (limited to 'main/src')
-rw-r--r--main/src/cgeo/geocaching/maps/CGeoMap.java20
-rw-r--r--main/src/cgeo/geocaching/settings/Settings.java2
2 files changed, 17 insertions, 5 deletions
diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java
index 007f707..b370afb 100644
--- a/main/src/cgeo/geocaching/maps/CGeoMap.java
+++ b/main/src/cgeo/geocaching/maps/CGeoMap.java
@@ -182,7 +182,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 +571,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 +629,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 +677,11 @@ 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);
+ return true;
case R.id.menu_theme_mode:
selectMapTheme();
return true;
@@ -1018,7 +1030,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 +1041,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);
}