Code refactor. Remove DynamicSpeedTrackPathDescriptor's dependency on selected_track_id_key.

This commit is contained in:
Jimmy Shih
2013-05-29 11:06:23 -07:00
parent 55861ecf0e
commit aafe93b723
9 changed files with 36 additions and 45 deletions
@@ -22,6 +22,7 @@ import com.google.android.apps.mytracks.content.Waypoint;
import com.google.android.apps.mytracks.content.Waypoint.WaypointType;
import com.google.android.apps.mytracks.maps.TrackPath;
import com.google.android.apps.mytracks.maps.TrackPathFactory;
import com.google.android.apps.mytracks.stats.TripStatistics;
import com.google.android.apps.mytracks.util.LocationUtils;
import com.google.android.apps.mytracks.util.PreferencesUtils;
import com.google.android.apps.mytracks.util.UnitConversions;
@@ -209,17 +210,19 @@ public class MapOverlay {
*
* @param googleMap the google map
* @param paths the paths
* @param tripStatistics the trip statistics
* @param reload true to reload all points
* @return true if has the start marker
*/
public boolean update(GoogleMap googleMap, ArrayList<Polyline> paths, boolean reload) {
public boolean update(GoogleMap googleMap, ArrayList<Polyline> paths,
TripStatistics tripStatistics, boolean reload) {
synchronized (locations) {
boolean hasStartMarker = false;
// Merge pendingLocations with locations
int newLocations = pendingLocations.drainTo(locations);
// Call updateState first because we want to update its state each time
// (for dynamic coloring)
if (trackPath.updateState() || reload) {
if (trackPath.updateState(tripStatistics) || reload) {
googleMap.clear();
paths.clear();
trackPath.updatePath(googleMap, paths, 0, locations);