This commit is contained in:
Chihau Chau
2011-03-24 10:34:14 -03:00
parent 1faea596f8
commit 31efcb4a86
65 changed files with 2445 additions and 2180 deletions
@@ -36,8 +36,8 @@ public class MyTracksLocation extends Location {
this.sensorDataSet = sd;
}
public MyTracksLocation(String string) {
super(string);
public MyTracksLocation(String provider) {
super(provider);
}
public Sensor.SensorDataSet getSensorDataSet() {
@@ -301,7 +301,7 @@ public interface MyTracksProviderUtils {
* @return a new waypoint object
*/
Waypoint createWaypoint(Cursor cursor);
/**
* A lightweight wrapper around the original {@link Cursor} with a method to clean up.
*/
@@ -312,13 +312,14 @@ public interface MyTracksProviderUtils {
* @return the ID of the most recent track point ID.
*/
long getLocationId();
/**
* Should be called in case the underlying iterator hasn't reached the last record.
* Calling it if it has reached the last record is a no-op.
*/
void close();
}
/**
* A factory for creating new {@class Location}s.
*/
@@ -342,6 +343,24 @@ public interface MyTracksProviderUtils {
return new Location("gps");
}
};
/**
* A location factory which uses two location instances (one for the current location,
* and one for the previous), useful when we need to keep the last location.
*/
public class DoubleBufferedLocationFactory implements LocationFactory {
private final Location locs[] = new MyTracksLocation[] {
new MyTracksLocation("gps"),
new MyTracksLocation("gps")
};
private int lastLoc = 0;
@Override
public Location createLocation() {
lastLoc = (lastLoc + 1) % locs.length;
return locs[lastLoc];
}
}
/**
* Creates a new read-only iterator over all track points for the given track. It provides
@@ -1024,7 +1024,7 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
cursor = null;
}
}
@Override
public void remove() {
throw new UnsupportedOperationException();