Change getLastTrack to return the last track on the track list.

This commit is contained in:
Jimmy Shih
2013-04-11 14:28:38 -07:00
parent 5447b357d2
commit 86410b1f80
3 changed files with 10 additions and 21 deletions
@@ -684,12 +684,14 @@ public class MyTracksMapFragment extends SupportMapFragment implements TrackData
*/
private LatLng getDefaultLatLng() {
MyTracksProviderUtils myTracksProviderUtils = MyTracksProviderUtils.Factory.get(getActivity());
Location location = myTracksProviderUtils.getLastValidTrackPoint();
if (location != null) {
return new LatLng(location.getLatitude(), location.getLongitude());
} else {
return new LatLng(DEFAULT_LATITUDE, DEFAULT_LONGITUDE);
Track track = myTracksProviderUtils.getLastTrack();
if (track != null) {
Location location = myTracksProviderUtils.getLastValidTrackPoint(track.getId());
if (location != null) {
return new LatLng(location.getLatitude(), location.getLongitude());
}
}
return new LatLng(DEFAULT_LATITUDE, DEFAULT_LONGITUDE);
}
/**