diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2014-09-06 06:34:49 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2014-09-06 06:34:49 +0200 |
| commit | e9c93380f8eda43671236e2cdb6a96468bbfcd24 (patch) | |
| tree | c6d8a0beb32c32d1b2f56165dc06d8bec3948a34 /main/src | |
| parent | d9ac63ca44d590397d985d9ee9b3d0df4088aa60 (diff) | |
| download | cgeo-e9c93380f8eda43671236e2cdb6a96468bbfcd24.zip cgeo-e9c93380f8eda43671236e2cdb6a96468bbfcd24.tar.gz cgeo-e9c93380f8eda43671236e2cdb6a96468bbfcd24.tar.bz2 | |
fix #4244: different zoom for normal map and map of single cache
Diffstat (limited to 'main/src')
| -rw-r--r-- | main/src/cgeo/geocaching/maps/CGeoMap.java | 4 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/settings/Settings.java | 42 |
2 files changed, 42 insertions, 4 deletions
diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java index d257cc6..b27693b 100644 --- a/main/src/cgeo/geocaching/maps/CGeoMap.java +++ b/main/src/cgeo/geocaching/maps/CGeoMap.java @@ -459,7 +459,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory { mapView.repaintRequired(null); - setZoom(Settings.getMapZoom()); + setZoom(Settings.getMapZoom(mapMode)); mapView.getMapController().setCenter(Settings.getMapCenter()); if (null == mapStateIntent) { @@ -886,7 +886,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory { } private void savePrefs() { - Settings.setMapZoom(mapView.getMapZoomLevel()); + Settings.setMapZoom(mapMode, mapView.getMapZoomLevel()); Settings.setMapCenter(mapView.getMapViewCenter()); } diff --git a/main/src/cgeo/geocaching/settings/Settings.java b/main/src/cgeo/geocaching/settings/Settings.java index 4dd959b..d2bc416 100644 --- a/main/src/cgeo/geocaching/settings/Settings.java +++ b/main/src/cgeo/geocaching/settings/Settings.java @@ -12,6 +12,7 @@ import cgeo.geocaching.enumerations.LiveMapStrategy.Strategy; import cgeo.geocaching.enumerations.LogType; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.list.StoredList; +import cgeo.geocaching.maps.CGeoMap.MapMode; import cgeo.geocaching.maps.MapProviderFactory; import cgeo.geocaching.maps.google.v1.GoogleMapProvider; import cgeo.geocaching.maps.interfaces.GeoPointImpl; @@ -620,14 +621,51 @@ public class Settings { putBoolean(R.string.pref_maptrail, showTrail); } - public static int getMapZoom() { + /** + * Get last used zoom of the internal map. Differentiate between two use cases for a map of multiple caches (e.g. + * live map) and the map of a single cache (which is often zoomed in more deep). + * + * @param mapMode + * @return + */ + public static int getMapZoom(final MapMode mapMode) { + if (mapMode == MapMode.SINGLE || mapMode == MapMode.COORDS) { + return getCacheZoom(); + } + return getMapZoom(); + } + + public static void setMapZoom(final MapMode mapMode, final int zoomLevel) { + if (mapMode == MapMode.SINGLE || mapMode == MapMode.COORDS) { + setCacheZoom(zoomLevel); + } + else { + setMapZoom(zoomLevel); + } + } + + /** + * @return zoom used for the (live) map + */ + private static int getMapZoom() { return getInt(R.string.pref_lastmapzoom, 14); } - public static void setMapZoom(final int mapZoomLevel) { + private static void setMapZoom(final int mapZoomLevel) { putInt(R.string.pref_lastmapzoom, mapZoomLevel); } + /** + * @return zoom used for the map of a single cache + */ + private static int getCacheZoom() { + return getInt(R.string.pref_cache_zoom, 14); + } + + private static void setCacheZoom(final int zoomLevel) { + putInt(R.string.pref_cache_zoom, zoomLevel); + } + public static GeoPointImpl getMapCenter() { return getMapProvider().getMapItemFactory() .getGeoPointBase(new Geopoint(getInt(R.string.pref_lastmaplat, 0) / 1e6, |
