Merge heads

This commit is contained in:
youtaol
2012-08-27 10:31:25 +08:00
parent 3ef2a9c901
commit 9565e81dab
23 changed files with 1376 additions and 1638 deletions
@@ -16,7 +16,6 @@
package com.google.android.apps.mytracks.content;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.location.Location;
@@ -40,14 +39,23 @@ public interface MyTracksProviderUtils {
public static final String AUTHORITY = "com.google.android.maps.mytracks";
/**
* Gets a track cursor. The caller owns the returned cursor and is responsible
* for closing it.
* Creates a {@link Track} from a cursor.
*
* @param selection the selection
* @param selectionArgs the selection arguments
* @param sortOrder the sort order
* @param cursor the cursor pointing to the track
*/
public Cursor getTracksCursor(String selection, String[] selectionArgs, String sortOrder);
public Track createTrack(Cursor cursor);
/**
* Deletes all tracks (including waypoints and track points).
*/
public void deleteAllTracks();
/**
* Deletes a track.
*
* @param trackId the track id
*/
public void deleteTrack(long trackId);
/**
* Gets all the tracks. If no track exists, an empty list is returned.
@@ -56,6 +64,11 @@ public interface MyTracksProviderUtils {
*/
public List<Track> getAllTracks();
/**
* Gets the last track. Returns null if doesn't exist.
*/
public Track getLastTrack();
/**
* Gets a track by a track id. Returns null if not found.
* <p>
@@ -66,21 +79,14 @@ public interface MyTracksProviderUtils {
public Track getTrack(long trackId);
/**
* Gets the last track. Returns null if doesn't exist.
*/
public Track getLastTrack();
/**
* Gets the last track id. Returns -1L if doesn't exist.
*/
public long getLastTrackId();
/**
* Returns true if a track exists.
* Gets a track cursor. The caller owns the returned cursor and is responsible
* for closing it.
*
* @param trackId the track id
* @param selection the selection
* @param selectionArgs the selection arguments
* @param sortOrder the sort order
*/
public boolean trackExists(long trackId);
public Cursor getTrackCursor(String selection, String[] selectionArgs, String sortOrder);
/**
* Inserts a track.
@@ -102,61 +108,21 @@ public interface MyTracksProviderUtils {
public void updateTrack(Track track);
/**
* Deletes all tracks (including waypoints and track points).
* Creates a waypoint from a cursor.
*
* @param cursor the cursor pointing to the waypoint
*/
public void deleteAllTracks();
public Waypoint createWaypoint(Cursor cursor);
/**
* Deletes a track.
* Deletes a waypoint. If deleting a statistics waypoint, this will also
* correct the next statistics waypoint after the deleted one to reflect the
* deletion. The generator is used to update the next statistics waypoint.
*
* @param trackId the track id
* @param waypointId the waypoint id
* @param descriptionGenerator the description generator
*/
public void deleteTrack(long trackId);
/**
* Creates a {@link Track} from a cursor.
*
* @param cursor the cursor pointing to the track
*/
public Track createTrack(Cursor cursor);
/**
* Creates a {@link ContentValues} from a track.
*
* @param track the track
*/
public ContentValues createContentValues(Track track);
/**
* Gets a waypoint cursor. The caller owns the returned cursor and is
* responsible for closing it.
*
* @param selection the selection
* @param selectionArgs the selection arguments
* @param sortOrder the sort order
* @param maxWaypoints the maximum number of waypoints to return
*/
public Cursor getWaypointsCursor(
String selection, String[] selectionArgs, String sortOrder, int maxWaypoints);
/**
* Gets a waypoint cursor for a track. The caller owns the returned cursor and
* is responsible for closing it.
*
* @param trackId the track id
* @param minWaypointId the minimum waypoint id
* @param maxWaypoints the maximum number of waypoints to return
*/
public Cursor getWaypointsCursor(long trackId, long minWaypointId, int maxWaypoints);
/**
* Gets the first recorded waypoint for a track. The first waypoint is special
* as it contains the stats for the current segment. Returns null if it
* doesn't exist.
*
* @param trackId the track id
*/
public Waypoint getFirstWaypoint(long trackId);
public void deleteWaypoint(long waypointId, DescriptionGenerator descriptionGenerator);
/**
* Gets the first waypoint id for a track. The first waypoint is special as it
@@ -167,36 +133,21 @@ public interface MyTracksProviderUtils {
*/
public long getFirstWaypointId(long trackId);
/**
* Gets the last waypoint id for a track. Returns -1L if it doesn't exist.
*
* @param trackId the track id
*/
public long getLastWaypointId(long trackId);
/**
* Gets the last statistics waypoint for a track. Returns null if it doesn't exist.
*
* @param trackId the track id
*/
public Waypoint getLastStatisticsWaypoint(long trackId);
/**
* Gets the next marker number. Returns -1 if not able to get the next marker
* number.
* Gets the next waypoint number. Returns -1 if not able to get the next
* waypoint number.
*
* @param trackId the track id
* @param statistics true for statistics marker, false for waypoint marker
*/
public int getNextMarkerNumber(long trackId, boolean statistics);
/**
* Gets the next statistics waypoint after the given waypoint. Returns null if
* it doesn't exists.
*
* @param waypoint the given waypoint
*/
public Waypoint getNextStatisticsWaypointAfter(Waypoint waypoint);
public int getNextWaypointNumber(long trackId, boolean statistics);
/**
* Gets a waypoint from a waypoint id. Returns null if not found.
@@ -205,6 +156,28 @@ public interface MyTracksProviderUtils {
*/
public Waypoint getWaypoint(long waypointId);
/**
* Gets a waypoint cursor. The caller owns the returned cursor and is
* responsible for closing it.
*
* @param selection the selection
* @param selectionArgs the selection arguments
* @param sortOrder the sort order
* @param maxWaypoints the maximum number of waypoints to return
*/
public Cursor getWaypointCursor(
String selection, String[] selectionArgs, String sortOrder, int maxWaypoints);
/**
* Gets a waypoint cursor for a track. The caller owns the returned cursor and
* is responsible for closing it.
*
* @param trackId the track id
* @param minWaypointId the minimum waypoint id
* @param maxWaypoints the maximum number of waypoints to return
*/
public Cursor getWaypointCursor(long trackId, long minWaypointId, int maxWaypoints);
/**
* Inserts a waypoint.
*
@@ -221,38 +194,36 @@ public interface MyTracksProviderUtils {
public boolean updateWaypoint(Waypoint waypoint);
/**
* Deletes a waypoint. If deleting a statistics waypoint, this will also
* correct the next statistics waypoint after the deleted one to reflect the
* deletion. The generator is used to update the next statistics waypoint.
* Inserts multiple track points.
*
* @param waypointId the waypoint id
* @param descriptionGenerator the description generator
* @param locations an array of locations
* @param length the number of locations (from the beginning of the array) to
* insert, or -1 for all of them
* @param trackId the track id
* @return the number of points inserted
*/
public void deleteWaypoint(long waypointId, DescriptionGenerator descriptionGenerator);
public int bulkInsertTrackPoint(Location[] locations, int length, long trackId);
/**
* Creates a waypoint from a cursor.
* Creates a location object from a cursor.
*
* @param cursor the cursor pointing to the waypoint
* @param cursor the cursor pointing to the location
*/
public Waypoint createWaypoint(Cursor cursor);
public Location createTrackPoint(Cursor cursor);
/**
* Gets the first recorded location. Returns null if it doesn't exist.
*/
public Location getFirstLocation();
/**
* Gets the last recorded location. Returns null if it doesn't exist.
*/
public Location getLastLocation();
/**
* Gets a location by track point id. Returns null if not found.
* Gets the last location id for a track. Returns -1L if it doesn't exist.
*
* @param trackPointId the track point id
* @param trackId the track id
*/
public Location getLocation(long trackPointId);
public long getLastTrackPointId(long trackId);
/**
* Gets the last valid location for a track. Returns null if it doesn't exist.
*
* @param trackId the track id
*/
public Location getLastValidTrackPoint(long trackId);
/**
* Creates a location cursor. The caller owns the returned cursor and is
@@ -264,7 +235,7 @@ public interface MyTracksProviderUtils {
* @param descending true to sort the result in descending order (latest
* location first)
*/
public Cursor getLocationsCursor(
public Cursor getTrackPointCursor(
long trackId, long startTrackPointId, int maxLocations, boolean descending);
/**
@@ -285,23 +256,9 @@ public interface MyTracksProviderUtils {
* location first)
* @param locationFactory the location factory
*/
public LocationIterator getLocationIterator(
public LocationIterator getTrackPointLocationIterator(
long trackId, long startTrackPointId, boolean descending, LocationFactory locationFactory);
/**
* Gets the last location id for a track. Returns -1L if it doesn't exist.
*
* @param trackId the track id
*/
public long getLastTrackLocationId(long trackId);
/**
* Gets the last location for a track. Returns -1L if it doesn't exist.
*
* @param trackId the track id
*/
public Location getLastTrackLocation(long trackId);
/**
* Inserts a track point.
*
@@ -311,32 +268,6 @@ public interface MyTracksProviderUtils {
*/
public Uri insertTrackPoint(Location location, long trackId);
/**
* Inserts multiple track points.
*
* @param locations an array of locations
* @param length the number of locations (from the beginning of the array) to
* insert, or -1 for all of them
* @param trackId the track id
* @return the number of points inserted
*/
public int bulkInsertTrackPoints(Location[] locations, int length, long trackId);
/**
* Fills a location from a cursor.
*
* @param cursor the cursor pointing to the location
* @param location the location to be overwritten
*/
public void fillLocation(Cursor cursor, Location location);
/**
* Creates a location object from a cursor.
*
* @param cursor the cursor pointing to the location
*/
public Location createLocation(Cursor cursor);
/**
* A lightweight wrapper around the original {@link Cursor} with a method to
* clean up.