aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsudev <rasch@munin-soft.de>2015-01-16 16:31:39 +0100
committerrsudev <rasch@munin-soft.de>2015-01-16 16:35:40 +0100
commit4dab903b443f4985c4af207faf97de563304fdd6 (patch)
treeb7c20ec346127c3b43a78723dd49bd9f6dabbbfe
parent59927ca5ecf68ed8fc5a5f9be6e60b2eb4003c47 (diff)
downloadcgeo-4dab903b443f4985c4af207faf97de563304fdd6.zip
cgeo-4dab903b443f4985c4af207faf97de563304fdd6.tar.gz
cgeo-4dab903b443f4985c4af207faf97de563304fdd6.tar.bz2
Fixes #2687, OSM:Offline: After selecting new map it is opend at map center but not at the previous location
- re-apply current position and zoom after changing the source without re-starting the map activity
-rw-r--r--main/src/cgeo/geocaching/maps/CGeoMap.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java
index 18826a4..457b06c 100644
--- a/main/src/cgeo/geocaching/maps/CGeoMap.java
+++ b/main/src/cgeo/geocaching/maps/CGeoMap.java
@@ -876,7 +876,12 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
if (restartRequired) {
mapRestart();
} else if (mapView != null) { // changeMapSource can be called by onCreate()
+ mapStateIntent = currentMapState();
mapView.setMapSource();
+ // re-center the map
+ centered = false;
+ centerMap(geocodeIntent, searchIntent, coordsIntent, mapStateIntent);
+ // re-build menues
ActivityMixin.invalidateOptionsMenu(activity);
}
@@ -887,9 +892,6 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
* Restart the current activity with the default map source.
*/
private void mapRestart() {
- // close old mapview
- activity.finish();
-
// prepare information to restart a similar view
final Intent mapIntent = new Intent(activity, Settings.getMapProvider().getMapClass());
@@ -908,6 +910,9 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
mapIntent.putExtra(Intents.EXTRA_MAPSTATE, mapState);
}
+ // close old map
+ activity.finish();
+
// start the new map
activity.startActivity(mapIntent);
}