Fix Map View to improve the initial camera position after screen rotation.

If showing a marker, after rotation, will zoom to the marker.
If showing a track, after rotation, will zoom to the current location
if is recording and is in tracking mode, else will zoom to the track.
This commit is contained in:
Jimmy Shih
2013-05-29 10:34:15 -07:00
parent 4f13b62a81
commit 55861ecf0e
3 changed files with 67 additions and 66 deletions
@@ -252,6 +252,12 @@ public interface MyTracksProviderUtils {
*/
public Location getLastValidTrackPoint(long trackId);
/**
* Gets the last valid location.
*/
public Location getLastValidTrackPoint();
/**
* Creates a location cursor. The caller owns the returned cursor and is
* responsible for closing it.
@@ -816,6 +816,14 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
return findTrackPointBy(selection, selectionArgs);
}
@Override
public Location getLastValidTrackPoint() {
String selection = TrackPointsColumns._ID + "=(select max(" + TrackPointsColumns._ID + ") from "
+ TrackPointsColumns.TABLE_NAME + " WHERE " + TrackPointsColumns.LATITUDE + "<="
+ MAX_LATITUDE + ")";
return findTrackPointBy(selection, null);
}
@Override
public Cursor getTrackPointCursor(
long trackId, long startTrackPointId, int maxLocations, boolean descending) {