aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/maps/google/GoogleMapView.java
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2013-12-18 19:30:20 +0100
committerBananeweizen <bananeweizen@gmx.de>2013-12-18 19:30:20 +0100
commitcf77b87b439e016999afc181fca133d68313867d (patch)
treee340355fa8da99a5ff3922fb3b176c0cde71931d /main/src/cgeo/geocaching/maps/google/GoogleMapView.java
parente20a20f09474ad7187dccdd54ce044c91d165196 (diff)
downloadcgeo-cf77b87b439e016999afc181fca133d68313867d.zip
cgeo-cf77b87b439e016999afc181fca133d68313867d.tar.gz
cgeo-cf77b87b439e016999afc181fca133d68313867d.tar.bz2
refactoring: reduce mapsforge memory usage
This puts scale and position into one overlay, instead of using 2 overlays. That reduces memory usage by 2 times a full screen bitmap due to double buffering in mapsforge. The only downside is that scale and position now have to be drawn at the same depth-level (below or on top of the caches), but they were both on top previously anyway.
Diffstat (limited to 'main/src/cgeo/geocaching/maps/google/GoogleMapView.java')
-rw-r--r--main/src/cgeo/geocaching/maps/google/GoogleMapView.java19
1 files changed, 5 insertions, 14 deletions
diff --git a/main/src/cgeo/geocaching/maps/google/GoogleMapView.java b/main/src/cgeo/geocaching/maps/google/GoogleMapView.java
index 740c944..d02e3c2 100644
--- a/main/src/cgeo/geocaching/maps/google/GoogleMapView.java
+++ b/main/src/cgeo/geocaching/maps/google/GoogleMapView.java
@@ -4,8 +4,7 @@ import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
import cgeo.geocaching.geopoint.Viewport;
import cgeo.geocaching.maps.CachesOverlay;
-import cgeo.geocaching.maps.PositionOverlay;
-import cgeo.geocaching.maps.ScaleOverlay;
+import cgeo.geocaching.maps.PositionAndScaleOverlay;
import cgeo.geocaching.maps.interfaces.GeneralOverlay;
import cgeo.geocaching.maps.interfaces.GeoPointImpl;
import cgeo.geocaching.maps.interfaces.MapControllerImpl;
@@ -13,13 +12,13 @@ import cgeo.geocaching.maps.interfaces.MapProjectionImpl;
import cgeo.geocaching.maps.interfaces.MapViewImpl;
import cgeo.geocaching.maps.interfaces.OnMapDragListener;
import cgeo.geocaching.maps.interfaces.OverlayImpl;
-import cgeo.geocaching.maps.interfaces.OverlayImpl.OverlayType;
import cgeo.geocaching.settings.Settings;
import cgeo.geocaching.utils.Log;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
+
import org.apache.commons.lang3.reflect.MethodUtils;
import android.app.Activity;
@@ -126,19 +125,11 @@ public class GoogleMapView extends MapView implements MapViewImpl {
}
@Override
- public PositionOverlay createAddPositionOverlay(Activity activity) {
-
- GoogleOverlay ovl = new GoogleOverlay(activity, OverlayType.PositionOverlay);
- getOverlays().add(ovl);
- return (PositionOverlay) ovl.getBase();
- }
-
- @Override
- public ScaleOverlay createAddScaleOverlay(Activity activity) {
+ public PositionAndScaleOverlay createAddPositionAndScaleOverlay(Activity activity) {
- GoogleOverlay ovl = new GoogleOverlay(activity, OverlayType.ScaleOverlay);
+ GoogleOverlay ovl = new GoogleOverlay(activity);
getOverlays().add(ovl);
- return (ScaleOverlay) ovl.getBase();
+ return (PositionAndScaleOverlay) ovl.getBase();
}
@Override