aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorBananeweizen <Bananeweizen@gmx.de>2013-05-30 06:24:29 -0700
committerBananeweizen <Bananeweizen@gmx.de>2013-05-30 06:24:29 -0700
commitee9dd42b6fc88640d09bc8ed55da653301778a32 (patch)
treedb1a9a2de7bc05371a35a44404ec88190244c672 /main
parent2145e897a26752602f613d8b055d14ceeca17ee6 (diff)
parent203b55090e511cacb1bc464465e71366d8641359 (diff)
downloadcgeo-ee9dd42b6fc88640d09bc8ed55da653301778a32.zip
cgeo-ee9dd42b6fc88640d09bc8ed55da653301778a32.tar.gz
cgeo-ee9dd42b6fc88640d09bc8ed55da653301778a32.tar.bz2
Merge pull request #2806 from campbeb/fix2799
Fix #2799 - Retain trail on map when device is rotated
Diffstat (limited to 'main')
-rw-r--r--main/src/cgeo/geocaching/maps/CGeoMap.java10
-rw-r--r--main/src/cgeo/geocaching/maps/PositionOverlay.java11
2 files changed, 19 insertions, 2 deletions
diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java
index ea51375..97c4b7e 100644
--- a/main/src/cgeo/geocaching/maps/CGeoMap.java
+++ b/main/src/cgeo/geocaching/maps/CGeoMap.java
@@ -119,6 +119,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
private static final String BUNDLE_MAP_SOURCE = "mapSource";
private static final String BUNDLE_MAP_STATE = "mapState";
private static final String BUNDLE_LIVE_ENABLED = "liveEnabled";
+ private static final String BUNDLE_TRAIL_HISTORY = "trailHistory";
private Resources res = null;
private MapItemFactory mapItemFactory = null;
@@ -343,6 +344,9 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
outState.putInt(BUNDLE_MAP_SOURCE, currentSourceId);
outState.putIntArray(BUNDLE_MAP_STATE, currentMapState());
outState.putBoolean(BUNDLE_LIVE_ENABLED, isLiveEnabled);
+ if (overlayPosition != null) {
+ outState.putParcelableArrayList(BUNDLE_TRAIL_HISTORY, overlayPosition.getHistory());
+ }
}
@Override
@@ -380,11 +384,14 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
mapTitle = res.getString(R.string.map_map);
}
+ ArrayList<Location> trailHistory = null;
+
// Get fresh map information from the bundle if any
if (savedInstanceState != null) {
currentSourceId = savedInstanceState.getInt(BUNDLE_MAP_SOURCE, Settings.getMapSource().getNumericalId());
mapStateIntent = savedInstanceState.getIntArray(BUNDLE_MAP_STATE);
isLiveEnabled = savedInstanceState.getBoolean(BUNDLE_LIVE_ENABLED, false);
+ trailHistory = savedInstanceState.getParcelableArrayList(BUNDLE_TRAIL_HISTORY);
} else {
currentSourceId = Settings.getMapSource().getNumericalId();
}
@@ -421,6 +428,9 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
if (overlayPosition == null) {
overlayPosition = mapView.createAddPositionOverlay(activity);
+ if (trailHistory != null) {
+ overlayPosition.setHistory(trailHistory);
+ }
}
if (overlayScale == null) {
diff --git a/main/src/cgeo/geocaching/maps/PositionOverlay.java b/main/src/cgeo/geocaching/maps/PositionOverlay.java
index fec67ef..08acd2f 100644
--- a/main/src/cgeo/geocaching/maps/PositionOverlay.java
+++ b/main/src/cgeo/geocaching/maps/PositionOverlay.java
@@ -22,7 +22,6 @@ import android.graphics.Point;
import android.location.Location;
import java.util.ArrayList;
-import java.util.List;
public class PositionOverlay implements GeneralOverlay {
private Location coordinates = null;
@@ -39,7 +38,7 @@ public class PositionOverlay implements GeneralOverlay {
private PaintFlagsDrawFilter setfil = null;
private PaintFlagsDrawFilter remfil = null;
private Location historyRecent = null;
- private List<Location> history = new ArrayList<Location>();
+ private ArrayList<Location> history = new ArrayList<Location>();
private Point historyPointN = new Point();
private Point historyPointP = new Point();
private Activity activity;
@@ -229,4 +228,12 @@ public class PositionOverlay implements GeneralOverlay {
public OverlayImpl getOverlayImpl() {
return this.ovlImpl;
}
+
+ public ArrayList<Location> getHistory() {
+ return history;
+ }
+
+ public void setHistory(ArrayList<Location> inHistory) {
+ history = inHistory;
+ }
}