aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorrsudev <rasch@munin-soft.de>2011-10-29 21:01:14 +0200
committerrsudev <rasch@munin-soft.de>2011-10-29 21:01:14 +0200
commitc2e758026725d0400807416e5f57efd72582ed63 (patch)
treeb388444109a7622a200b8ddb138252481721a6b2 /main
parentf1fcedc8bc92be5f0069262d7171186c4692849c (diff)
downloadcgeo-c2e758026725d0400807416e5f57efd72582ed63.zip
cgeo-c2e758026725d0400807416e5f57efd72582ed63.tar.gz
cgeo-c2e758026725d0400807416e5f57efd72582ed63.tar.bz2
Fixing #113 for Mapsforge as well
- removing wrong method invalidate from MapViewImpl
Diffstat (limited to 'main')
-rw-r--r--main/src/cgeo/geocaching/maps/CGeoMap.java8
-rw-r--r--main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java10
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java18
3 files changed, 23 insertions, 13 deletions
diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java
index 6725b83..ceddb5e 100644
--- a/main/src/cgeo/geocaching/maps/CGeoMap.java
+++ b/main/src/cgeo/geocaching/maps/CGeoMap.java
@@ -189,7 +189,7 @@ public class CGeoMap extends AbstractMap implements OnDragListener, ViewFactory
ActivityMixin.setTitle(activity, title.toString());
} else if (what == 1 && mapView != null) {
- mapView.invalidate();
+ mapView.repaintRequired(null);
}
}
};
@@ -338,7 +338,7 @@ public class CGeoMap extends AbstractMap implements OnDragListener, ViewFactory
overlayScale = mapView.createAddScaleOverlay(activity);
}
- mapView.invalidate();
+ mapView.repaintRequired(null);
mapController = mapView.getMapController();
mapController.setZoom(Settings.getMapZoom());
@@ -683,7 +683,7 @@ public class CGeoMap extends AbstractMap implements OnDragListener, ViewFactory
}
overlayCaches.switchCircles();
- mapView.invalidate();
+ mapView.repaintRequired(overlayCaches);
return true;
case MENU_AS_LIST: {
final cgSearch search = new cgSearch();
@@ -850,7 +850,7 @@ public class CGeoMap extends AbstractMap implements OnDragListener, ViewFactory
if (overlayPosition != null && mapView != null && (geo == null || geo.speedNow == null || geo.speedNow <= 5)) { // use compass when speed is lower than 18 km/h
overlayPosition.setHeading(dir.directionNow);
- mapView.invalidate();
+ mapView.repaintRequired(overlayPosition);
}
}
}
diff --git a/main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java b/main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java
index 8231d92..1f4c304 100644
--- a/main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java
+++ b/main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java
@@ -18,8 +18,6 @@ import android.graphics.drawable.Drawable;
*/
public interface MapViewImpl {
- void invalidate();
-
void setBuiltInZoomControls(boolean b);
void displayZoomControls(boolean b);
@@ -61,6 +59,14 @@ public interface MapViewImpl {
void setMapSource();
+ /**
+ * Map-library unspecific method to request a repaint of either
+ * a specific overlay, that changed, or the mapview as a whole
+ * (if overlay is null)
+ *
+ * @param overlay
+ * Overlay to repaint or null if the mapview has changed
+ */
void repaintRequired(GeneralOverlay overlay);
void setOnDragListener(OnDragListener onDragListener);
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java
index 2b24c0b..cfcdfb6 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java
@@ -188,15 +188,19 @@ public class MapsforgeMapView extends MapView implements MapViewImpl {
@Override
public void repaintRequired(GeneralOverlay overlay) {
- try {
- MapsforgeOverlay ovl = (MapsforgeOverlay) overlay.getOverlayImpl();
+ if (null == overlay) {
+ invalidate();
+ } else {
+ try {
+ Overlay ovl = (Overlay) overlay.getOverlayImpl();
+
+ if (ovl != null) {
+ ovl.requestRedraw();
+ }
- if (ovl != null) {
- ovl.requestRedraw();
+ } catch (Exception e) {
+ Log.e(Settings.tag, "mfMapView.repaintRequired: " + e.toString());
}
-
- } catch (Exception e) {
- Log.e(Settings.tag, "mfMapView.repaintRequired: " + e.toString());
}
}