Skip to content

Instantly share code, notes, and snippets.

@rsudev
Created February 10, 2019 17:26
Show Gist options
  • Save rsudev/c013984060f350ba2dccfac2b9c04bf9 to your computer and use it in GitHub Desktop.
Save rsudev/c013984060f350ba2dccfac2b9c04bf9 to your computer and use it in GitHub Desktop.
patch suggestion fro invalidateAll in new map (c:geo)
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/v6/caches/AbstractCachesOverlay.java b/main/src/cgeo/geocaching/maps/mapsforge/v6/caches/AbstractCachesOverlay.java
index fef98dc0f..4df04d697 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/v6/caches/AbstractCachesOverlay.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/v6/caches/AbstractCachesOverlay.java
@@ -96,6 +96,11 @@ public abstract class AbstractCachesOverlay {
invalidate();
}
+ public void invalidateAll() {
+ removeItems(getGeocodes());
+ invalidate();
+ }
+
protected boolean isInvalidated() {
return invalidated;
}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/v6/caches/CachesBundle.java b/main/src/cgeo/geocaching/maps/mapsforge/v6/caches/CachesBundle.java
index dc8c30340..0baeb0b48 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/v6/caches/CachesBundle.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/v6/caches/CachesBundle.java
@@ -213,6 +213,22 @@ public class CachesBundle {
}
}
+ /**
+ * Forces redraw of all cache layers (e.g. for icon change)
+ */
+ public void invalidateAll()
+ {
+ if (baseOverlay != null) {
+ baseOverlay.invalidateAll();
+ }
+ if (storedOverlay != null) {
+ storedOverlay.invalidateAll();
+ }
+ if (liveOverlay != null) {
+ liveOverlay.invalidateAll();
+ }
+ }
+
public boolean isDownloading() {
return liveOverlay != null && liveOverlay.isDownloading();
}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/v6/caches/CachesOverlay.java b/main/src/cgeo/geocaching/maps/mapsforge/v6/caches/CachesOverlay.java
index 9227a1553..91367c6b5 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/v6/caches/CachesOverlay.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/v6/caches/CachesOverlay.java
@@ -104,6 +104,13 @@ public class CachesOverlay extends AbstractCachesOverlay {
}
}
+ @Override
+ public void invalidate() {
+ firstRun = true;
+
+ super.invalidate();
+ }
+
@Override
public void onDestroy() {
timer.dispose();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment