Merge heads

This commit is contained in:
youtaol
2012-06-20 09:45:23 +08:00
parent f1a3c5dffa
commit 978b6c5a09
123 changed files with 2475 additions and 5323 deletions
+2 -1
View File
@@ -16,7 +16,7 @@ limitations under the License.
--> -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto" android:installLocation="auto"
android:versionCode="43" android:versionCode="44"
android:versionName="2.0" android:versionName="2.0"
package="com.google.android.maps.mytracks" > package="com.google.android.maps.mytracks" >
@@ -126,6 +126,7 @@ limitations under the License.
<application <application
android:backupAgent="com.google.android.apps.mytracks.io.backup.MyTracksBackupAgent" android:backupAgent="com.google.android.apps.mytracks.io.backup.MyTracksBackupAgent"
android:icon="@drawable/my_tracks_icon" android:icon="@drawable/my_tracks_icon"
android:hardwareAccelerated="true"
android:label="@string/my_tracks_app_name" android:label="@string/my_tracks_app_name"
android:name="com.google.android.apps.mytracks.MyTracksApplication" android:name="com.google.android.apps.mytracks.MyTracksApplication"
android:theme="@style/ThemeSelector" > android:theme="@style/ThemeSelector" >
Binary file not shown.

After

Width:  |  Height:  |  Size: 810 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 892 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 859 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 681 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 892 B

File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+4
View File
@@ -18,6 +18,8 @@ limitations under the License.
<!-- Keys for persisted preferences. Sorted alphabetically. DO NOT TRANSLATE. --> <!-- Keys for persisted preferences. Sorted alphabetically. DO NOT TRANSLATE. -->
<string name="allow_access_key">allowAccess</string> <string name="allow_access_key">allowAccess</string>
<string name="announcement_frequency_key">announcementFrequency</string> <string name="announcement_frequency_key">announcementFrequency</string>
<string name="ant_bike_cadence_sensor_id_key">antBikeCadenceSensorId</string>
<string name="ant_combined_bike_sensor_id_key">antCombinedBikeSensorId</string>
<string name="ant_heart_rate_monitor_id_key">antHeartRateMonitorId</string> <string name="ant_heart_rate_monitor_id_key">antHeartRateMonitorId</string>
<string name="ant_speed_distance_monitor_id_key">antSpeedDistanceMonitorId</string> <string name="ant_speed_distance_monitor_id_key">antSpeedDistanceMonitorId</string>
<string name="auto_resume_track_current_retry_key">autoResumeTrackCurrentRetry</string> <string name="auto_resume_track_current_retry_key">autoResumeTrackCurrentRetry</string>
@@ -71,6 +73,8 @@ limitations under the License.
<string name="settings_reset_key">settingsReset</string> <string name="settings_reset_key">settingsReset</string>
<string name="settings_sensor_key">settingsSensor</string> <string name="settings_sensor_key">settingsSensor</string>
<string name="settings_sensor_ant_key">settingsSensorAnt</string> <string name="settings_sensor_ant_key">settingsSensorAnt</string>
<string name="settings_sensor_ant_reset_bike_cadence_sensor_key">settingsSensorAntResetBikeCadenceSensor</string>
<string name="settings_sensor_ant_reset_combined_bike_sensor_key">settingsSensorAntResetCombinedBikeSensor</string>
<string name="settings_sensor_ant_reset_heart_rate_monitor_key">settingsSensorAntResetHeartRateMonitor</string> <string name="settings_sensor_ant_reset_heart_rate_monitor_key">settingsSensorAntResetHeartRateMonitor</string>
<string name="settings_sensor_ant_reset_speed_distance_monitor_key">settingsSensorAntResetSpeedDistanceMonitor</string> <string name="settings_sensor_ant_reset_speed_distance_monitor_key">settingsSensorAntResetSpeedDistanceMonitor</string>
<string name="settings_sensor_bluetooth_key">settingsSensorBluetooth</string> <string name="settings_sensor_bluetooth_key">settingsSensorBluetooth</string>
+18 -4
View File
@@ -368,7 +368,7 @@ limitations under the License.
completion suggestion for wind surfing."> completion suggestion for wind surfing.">
wind surfing wind surfing
</string> </string>
<!-- Description --> <!-- Description -->
<string name="description_activity_type" <string name="description_activity_type"
translation_description="Activity type description. translation_description="Activity type description.
@@ -737,7 +737,7 @@ limitations under the License.
</string> </string>
<string name="help_google_services_answer" <string name="help_google_services_answer"
translation_description="In the 'Help' page, the answer on locations of google services. translation_description="In the 'Help' page, the answer on locations of google services.
%1$s url. E.g., 'maps.google.com'. %1$s url. E.g., 'maps.google.com'.
%2$s url. E.g., 'google.com/fusiontables'. %2$s url. E.g., 'google.com/fusiontables'.
%3$s url. E.g., 'docs.google.com'."> %3$s url. E.g., 'docs.google.com'.">
@@ -1296,12 +1296,12 @@ limitations under the License.
<string name="send_google_new_public_map" <string name="send_google_new_public_map"
translation_description="When sending a track to Google Maps, the radio option to create a translation_description="When sending a track to Google Maps, the radio option to create a
new public map as opposed to use an existing map."> new public map as opposed to use an existing map.">
Create new public map Create new public map
</string> </string>
<string name="send_google_new_unlisted_map" <string name="send_google_new_unlisted_map"
translation_description="When sending a track to Google Maps, the radio option to create a translation_description="When sending a track to Google Maps, the radio option to create a
new unlisted map as opposed to use an existing map."> new unlisted map as opposed to use an existing map.">
Create new unlisted map Create new unlisted map
</string> </string>
<string name="send_google_no_account_message" <string name="send_google_no_account_message"
translation_description="When sending to Google, the dialog message when no Google account is translation_description="When sending to Google, the dialog message when no Google account is
@@ -1730,6 +1730,20 @@ limitations under the License.
%1$d: device id number. E.g., '1'."> %1$d: device id number. E.g., '1'.">
Paired with: %1$d Paired with: %1$d
</string> </string>
<string name="settings_sensor_ant_reset_bike_candence_sensor"
translation_description="In the 'Sensor' settings, under the 'ANT+ options', the option to reset
an ANT+ bike cadence sensor. Note that ANT+ is a radio standard.
Character limit: ~26 (1 line)">
Reset bike cadence
</string>
<string name="settings_sensor_ant_reset_combined_bike_sensor"
translation_description="In the 'Sensor' settings, under the 'ANT+ options', the option to reset
an ANT+ combined bike cadence and speed sensor. Note that ANT+ is a radio standard.
Character limit: ~26 (1 line)">
Reset combined bike
</string>
<string name="settings_sensor_ant_reset_heart_rate_monitor" <string name="settings_sensor_ant_reset_heart_rate_monitor"
translation_description="In the 'Sensor' settings, under the 'ANT+ options', the option to reset translation_description="In the 'Sensor' settings, under the 'ANT+ options', the option to reset
an ANT+ heart rate monitor. Note that ANT+ is a radio standard. an ANT+ heart rate monitor. Note that ANT+ is a radio standard.
+1
View File
@@ -40,6 +40,7 @@ limitations under the License.
</style> </style>
<!-- The style for choose upload service image view --> <!-- The style for choose upload service image view -->
<style name="ChooseUploadServiceImageView"> <style name="ChooseUploadServiceImageView">
<item name="android:layout_gravity">center</item>
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item> <item name="android:layout_width">wrap_content</item>
</style> </style>
+8
View File
@@ -47,5 +47,13 @@ limitations under the License.
android:key="@string/settings_sensor_ant_reset_speed_distance_monitor_key" android:key="@string/settings_sensor_ant_reset_speed_distance_monitor_key"
android:persistent="false" android:persistent="false"
android:title="@string/settings_sensor_ant_reset_speed_distance_monitor" /> android:title="@string/settings_sensor_ant_reset_speed_distance_monitor" />
<Preference
android:key="@string/settings_sensor_ant_reset_bike_cadence_sensor_key"
android:persistent="false"
android:title="@string/settings_sensor_ant_reset_bike_candence_sensor" />
<Preference
android:key="@string/settings_sensor_ant_reset_combined_bike_sensor_key"
android:persistent="false"
android:title="@string/settings_sensor_ant_reset_combined_bike_sensor" />
</PreferenceCategory> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>
@@ -86,7 +86,7 @@ public class MarkerDetailActivity extends AbstractMyTracksActivity {
} else { } else {
waypointSection.setVisibility(View.GONE); waypointSection.setVisibility(View.GONE);
statisticsSection.setVisibility(View.VISIBLE); statisticsSection.setVisibility(View.VISIBLE);
StatsUtils.setTripStatisticsValues(this, waypoint.getStatistics()); StatsUtils.setTripStatisticsValues(this, waypoint.getTripStatistics());
StatsUtils.setLocationValues(this, waypoint.getLocation(), false); StatsUtils.setLocationValues(this, waypoint.getLocation(), false);
} }
} }
@@ -59,12 +59,13 @@ public class MarkerListActivity extends AbstractMyTracksActivity {
private static final String TAG = MarkerListActivity.class.getSimpleName(); private static final String TAG = MarkerListActivity.class.getSimpleName();
private static final String[] PROJECTION = new String[] { WaypointsColumns._ID, private static final String[] PROJECTION = new String[] {
WaypointsColumns.TYPE, WaypointsColumns._ID,
WaypointsColumns.NAME, WaypointsColumns.NAME,
WaypointsColumns.DESCRIPTION,
WaypointsColumns.CATEGORY, WaypointsColumns.CATEGORY,
WaypointsColumns.TIME, WaypointsColumns.TYPE,
WaypointsColumns.DESCRIPTION }; WaypointsColumns.TIME};
// Callback when an item is selected in the contextual action mode // Callback when an item is selected in the contextual action mode
private ContextualActionModeCallback contextualActionModeCallback = private ContextualActionModeCallback contextualActionModeCallback =
@@ -128,11 +129,11 @@ public class MarkerListActivity extends AbstractMyTracksActivity {
resourceCursorAdapter = new ResourceCursorAdapter(this, R.layout.list_item, null, 0) { resourceCursorAdapter = new ResourceCursorAdapter(this, R.layout.list_item, null, 0) {
@Override @Override
public void bindView(View view, Context context, Cursor cursor) { public void bindView(View view, Context context, Cursor cursor) {
int typeIndex = cursor.getColumnIndex(WaypointsColumns.TYPE);
int nameIndex = cursor.getColumnIndex(WaypointsColumns.NAME); int nameIndex = cursor.getColumnIndex(WaypointsColumns.NAME);
int categoryIndex = cursor.getColumnIndex(WaypointsColumns.CATEGORY);
int timeIndex = cursor.getColumnIndexOrThrow(WaypointsColumns.TIME);
int descriptionIndex = cursor.getColumnIndex(WaypointsColumns.DESCRIPTION); int descriptionIndex = cursor.getColumnIndex(WaypointsColumns.DESCRIPTION);
int categoryIndex = cursor.getColumnIndex(WaypointsColumns.CATEGORY);
int typeIndex = cursor.getColumnIndex(WaypointsColumns.TYPE);
int timeIndex = cursor.getColumnIndexOrThrow(WaypointsColumns.TIME);
boolean statistics = cursor.getInt(typeIndex) == Waypoint.TYPE_STATISTICS; boolean statistics = cursor.getInt(typeIndex) == Waypoint.TYPE_STATISTICS;
String name = cursor.getString(nameIndex); String name = cursor.getString(nameIndex);
@@ -77,7 +77,7 @@ public class DescriptionGeneratorImpl implements DescriptionGenerator {
@Override @Override
public String generateWaypointDescription(Waypoint waypoint) { public String generateWaypointDescription(Waypoint waypoint) {
return generateTripStatisticsDescription(waypoint.getStatistics(), false); return generateTripStatisticsDescription(waypoint.getTripStatistics(), false);
} }
/** /**
@@ -52,8 +52,6 @@ public class MyTracksProvider extends ContentProvider {
private static final int TRACKS_ID = 4; private static final int TRACKS_ID = 4;
private static final int WAYPOINTS = 5; private static final int WAYPOINTS = 5;
private static final int WAYPOINTS_ID = 6; private static final int WAYPOINTS_ID = 6;
private static final String TRACKPOINTS_TABLE = "trackpoints";
private static final String WAYPOINTS_TABLE = "waypoints";
private static final String TAG = MyTracksProvider.class.getSimpleName(); private static final String TAG = MyTracksProvider.class.getSimpleName();
/** /**
@@ -67,49 +65,9 @@ public class MyTracksProvider extends ContentProvider {
@Override @Override
public void onCreate(SQLiteDatabase db) { public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE " + TRACKPOINTS_TABLE + " (" db.execSQL(TrackPointsColumns.CREATE_TABLE);
+ TrackPointsColumns._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
+ TrackPointsColumns.TRACKID + " INTEGER, "
+ TrackPointsColumns.LONGITUDE + " INTEGER, "
+ TrackPointsColumns.LATITUDE + " INTEGER, "
+ TrackPointsColumns.TIME + " INTEGER, "
+ TrackPointsColumns.ALTITUDE + " FLOAT, "
+ TrackPointsColumns.ACCURACY + " FLOAT, "
+ TrackPointsColumns.SPEED + " FLOAT, "
+ TrackPointsColumns.BEARING + " FLOAT, "
+ TrackPointsColumns.SENSOR + " BLOB);");
db.execSQL(TracksColumns.CREATE_TABLE); db.execSQL(TracksColumns.CREATE_TABLE);
db.execSQL("CREATE TABLE " + WAYPOINTS_TABLE + " (" db.execSQL(WaypointsColumns.CREATE_TABLE);
+ WaypointsColumns._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
+ WaypointsColumns.NAME + " STRING, "
+ WaypointsColumns.DESCRIPTION + " STRING, "
+ WaypointsColumns.CATEGORY + " STRING, "
+ WaypointsColumns.ICON + " STRING, "
+ WaypointsColumns.TRACKID + " INTEGER, "
+ WaypointsColumns.TYPE + " INTEGER, "
+ WaypointsColumns.LENGTH + " FLOAT, "
+ WaypointsColumns.DURATION + " INTEGER, "
+ WaypointsColumns.STARTTIME + " INTEGER, "
+ WaypointsColumns.STARTID + " INTEGER, "
+ WaypointsColumns.STOPID + " INTEGER, "
+ WaypointsColumns.LONGITUDE + " INTEGER, "
+ WaypointsColumns.LATITUDE + " INTEGER, "
+ WaypointsColumns.TIME + " INTEGER, "
+ WaypointsColumns.ALTITUDE + " FLOAT, "
+ WaypointsColumns.ACCURACY + " FLOAT, "
+ WaypointsColumns.SPEED + " FLOAT, "
+ WaypointsColumns.BEARING + " FLOAT, "
+ WaypointsColumns.TOTALDISTANCE + " FLOAT, "
+ WaypointsColumns.TOTALTIME + " INTEGER, "
+ WaypointsColumns.MOVINGTIME + " INTEGER, "
+ WaypointsColumns.AVGSPEED + " FLOAT, "
+ WaypointsColumns.AVGMOVINGSPEED + " FLOAT, "
+ WaypointsColumns.MAXSPEED + " FLOAT, "
+ WaypointsColumns.MINELEVATION + " FLOAT, "
+ WaypointsColumns.MAXELEVATION + " FLOAT, "
+ WaypointsColumns.ELEVATIONGAIN + " FLOAT, "
+ WaypointsColumns.MINGRADE + " FLOAT, "
+ WaypointsColumns.MAXGRADE + " FLOAT);");
} }
@Override @Override
@@ -118,9 +76,9 @@ public class MyTracksProvider extends ContentProvider {
if (oldVersion < 17) { if (oldVersion < 17) {
// Delete the old data // Delete the old data
Log.w(TAG, "Delete all old data"); Log.w(TAG, "Delete all old data");
db.execSQL("DROP TABLE IF EXISTS " + TRACKPOINTS_TABLE); db.execSQL("DROP TABLE IF EXISTS " + TrackPointsColumns.TABLE_NAME);
db.execSQL("DROP TABLE IF EXISTS " + TracksColumns.TABLE_NAME); db.execSQL("DROP TABLE IF EXISTS " + TracksColumns.TABLE_NAME);
db.execSQL("DROP TABLE IF EXISTS " + WAYPOINTS_TABLE); db.execSQL("DROP TABLE IF EXISTS " + WaypointsColumns.TABLE_NAME);
onCreate(db); onCreate(db);
} else { } else {
// Incremental updates go here. For each DB version, add a corresponding if clause. // Incremental updates go here. For each DB version, add a corresponding if clause.
@@ -128,8 +86,8 @@ public class MyTracksProvider extends ContentProvider {
// Track points sensor column // Track points sensor column
if (oldVersion <= 17) { if (oldVersion <= 17) {
Log.w(TAG, "Upgrade DB: Adding sensor column."); Log.w(TAG, "Upgrade DB: Adding sensor column.");
db.execSQL( db.execSQL("ALTER TABLE " + TrackPointsColumns.TABLE_NAME + " ADD "
"ALTER TABLE " + TRACKPOINTS_TABLE + " ADD " + TrackPointsColumns.SENSOR + " BLOB"); + TrackPointsColumns.SENSOR + " BLOB");
} }
// Tracks table id column // Tracks table id column
if (oldVersion <= 18) { if (oldVersion <= 18) {
@@ -196,14 +154,14 @@ public class MyTracksProvider extends ContentProvider {
boolean shouldVacuum = false; boolean shouldVacuum = false;
switch (urlMatcher.match(url)) { switch (urlMatcher.match(url)) {
case TRACKPOINTS: case TRACKPOINTS:
table = TRACKPOINTS_TABLE; table = TrackPointsColumns.TABLE_NAME;
break; break;
case TRACKS: case TRACKS:
table = TracksColumns.TABLE_NAME; table = TracksColumns.TABLE_NAME;
shouldVacuum = true; shouldVacuum = true;
break; break;
case WAYPOINTS: case WAYPOINTS:
table = WAYPOINTS_TABLE; table = WaypointsColumns.TABLE_NAME;
break; break;
default: default:
throw new IllegalArgumentException("Unknown URL " + url); throw new IllegalArgumentException("Unknown URL " + url);
@@ -311,7 +269,7 @@ public class MyTracksProvider extends ContentProvider {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Latitude, longitude, and time values are required."); "Latitude, longitude, and time values are required.");
} }
long rowId = db.insert(TRACKPOINTS_TABLE, TrackPointsColumns._ID, values); long rowId = db.insert(TrackPointsColumns.TABLE_NAME, TrackPointsColumns._ID, values);
if (rowId >= 0) { if (rowId >= 0) {
Uri uri = ContentUris.appendId( Uri uri = ContentUris.appendId(
TrackPointsColumns.CONTENT_URI.buildUpon(), rowId).build(); TrackPointsColumns.CONTENT_URI.buildUpon(), rowId).build();
@@ -339,7 +297,7 @@ public class MyTracksProvider extends ContentProvider {
} }
private Uri insertWaypoint(Uri url, ContentValues values) { private Uri insertWaypoint(Uri url, ContentValues values) {
long rowId = db.insert(WAYPOINTS_TABLE, WaypointsColumns._ID, values); long rowId = db.insert(WaypointsColumns.TABLE_NAME, WaypointsColumns._ID, values);
if (rowId > 0) { if (rowId > 0) {
Uri uri = ContentUris.appendId( Uri uri = ContentUris.appendId(
WaypointsColumns.CONTENT_URI.buildUpon(), rowId).build(); WaypointsColumns.CONTENT_URI.buildUpon(), rowId).build();
@@ -360,14 +318,14 @@ public class MyTracksProvider extends ContentProvider {
int match = urlMatcher.match(url); int match = urlMatcher.match(url);
String sortOrder = null; String sortOrder = null;
if (match == TRACKPOINTS) { if (match == TRACKPOINTS) {
qb.setTables(TRACKPOINTS_TABLE); qb.setTables(TrackPointsColumns.TABLE_NAME);
if (sort != null) { if (sort != null) {
sortOrder = sort; sortOrder = sort;
} else { } else {
sortOrder = TrackPointsColumns.DEFAULT_SORT_ORDER; sortOrder = TrackPointsColumns.DEFAULT_SORT_ORDER;
} }
} else if (match == TRACKPOINTS_ID) { } else if (match == TRACKPOINTS_ID) {
qb.setTables(TRACKPOINTS_TABLE); qb.setTables(TrackPointsColumns.TABLE_NAME);
qb.appendWhere("_id=" + url.getPathSegments().get(1)); qb.appendWhere("_id=" + url.getPathSegments().get(1));
} else if (match == TRACKS) { } else if (match == TRACKS) {
qb.setTables(TracksColumns.TABLE_NAME); qb.setTables(TracksColumns.TABLE_NAME);
@@ -380,14 +338,14 @@ public class MyTracksProvider extends ContentProvider {
qb.setTables(TracksColumns.TABLE_NAME); qb.setTables(TracksColumns.TABLE_NAME);
qb.appendWhere("_id=" + url.getPathSegments().get(1)); qb.appendWhere("_id=" + url.getPathSegments().get(1));
} else if (match == WAYPOINTS) { } else if (match == WAYPOINTS) {
qb.setTables(WAYPOINTS_TABLE); qb.setTables(WaypointsColumns.TABLE_NAME);
if (sort != null) { if (sort != null) {
sortOrder = sort; sortOrder = sort;
} else { } else {
sortOrder = WaypointsColumns.DEFAULT_SORT_ORDER; sortOrder = WaypointsColumns.DEFAULT_SORT_ORDER;
} }
} else if (match == WAYPOINTS_ID) { } else if (match == WAYPOINTS_ID) {
qb.setTables(WAYPOINTS_TABLE); qb.setTables(WaypointsColumns.TABLE_NAME);
qb.appendWhere("_id=" + url.getPathSegments().get(1)); qb.appendWhere("_id=" + url.getPathSegments().get(1));
} else { } else {
throw new IllegalArgumentException("Unknown URL " + url); throw new IllegalArgumentException("Unknown URL " + url);
@@ -410,10 +368,10 @@ public class MyTracksProvider extends ContentProvider {
int count; int count;
int match = urlMatcher.match(url); int match = urlMatcher.match(url);
if (match == TRACKPOINTS) { if (match == TRACKPOINTS) {
count = db.update(TRACKPOINTS_TABLE, values, where, selectionArgs); count = db.update(TrackPointsColumns.TABLE_NAME, values, where, selectionArgs);
} else if (match == TRACKPOINTS_ID) { } else if (match == TRACKPOINTS_ID) {
String segment = url.getPathSegments().get(1); String segment = url.getPathSegments().get(1);
count = db.update(TRACKPOINTS_TABLE, values, "_id=" + segment count = db.update(TrackPointsColumns.TABLE_NAME, values, "_id=" + segment
+ (!TextUtils.isEmpty(where) + (!TextUtils.isEmpty(where)
? " AND (" + where + ')' ? " AND (" + where + ')'
: ""), : ""),
@@ -428,10 +386,10 @@ public class MyTracksProvider extends ContentProvider {
: ""), : ""),
selectionArgs); selectionArgs);
} else if (match == WAYPOINTS) { } else if (match == WAYPOINTS) {
count = db.update(WAYPOINTS_TABLE, values, where, selectionArgs); count = db.update(WaypointsColumns.TABLE_NAME, values, where, selectionArgs);
} else if (match == WAYPOINTS_ID) { } else if (match == WAYPOINTS_ID) {
String segment = url.getPathSegments().get(1); String segment = url.getPathSegments().get(1);
count = db.update(WAYPOINTS_TABLE, values, "_id=" + segment count = db.update(WaypointsColumns.TABLE_NAME, values, "_id=" + segment
+ (!TextUtils.isEmpty(where) + (!TextUtils.isEmpty(where)
? " AND (" + where + ')' ? " AND (" + where + ')'
: ""), : ""),
@@ -1,57 +0,0 @@
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks.io.backup;
import static com.google.android.apps.mytracks.content.ContentTypeIds.BLOB_TYPE_ID;
import static com.google.android.apps.mytracks.content.ContentTypeIds.FLOAT_TYPE_ID;
import static com.google.android.apps.mytracks.content.ContentTypeIds.INT_TYPE_ID;
import static com.google.android.apps.mytracks.content.ContentTypeIds.LONG_TYPE_ID;
import static com.google.android.apps.mytracks.content.ContentTypeIds.STRING_TYPE_ID;
import com.google.android.apps.mytracks.content.TrackPointsColumns;
import com.google.android.apps.mytracks.content.WaypointsColumns;
public class BackupColumns {
/** Columns that go into the backup. */
public static final String[] POINTS_BACKUP_COLUMNS =
{ TrackPointsColumns._ID, TrackPointsColumns.TRACKID, TrackPointsColumns.LATITUDE,
TrackPointsColumns.LONGITUDE, TrackPointsColumns.ALTITUDE, TrackPointsColumns.BEARING,
TrackPointsColumns.TIME, TrackPointsColumns.ACCURACY, TrackPointsColumns.SPEED,
TrackPointsColumns.SENSOR };
public static final byte[] POINTS_BACKUP_COLUMN_TYPES =
{ LONG_TYPE_ID, LONG_TYPE_ID, INT_TYPE_ID, INT_TYPE_ID, FLOAT_TYPE_ID,
FLOAT_TYPE_ID, LONG_TYPE_ID, FLOAT_TYPE_ID, FLOAT_TYPE_ID, BLOB_TYPE_ID };
public static final String[] WAYPOINTS_BACKUP_COLUMNS = {
WaypointsColumns._ID, WaypointsColumns.TRACKID, WaypointsColumns.NAME,
WaypointsColumns.DESCRIPTION, WaypointsColumns.CATEGORY, WaypointsColumns.ICON,
WaypointsColumns.TYPE, WaypointsColumns.LENGTH, WaypointsColumns.DURATION,
WaypointsColumns.STARTTIME, WaypointsColumns.STARTID, WaypointsColumns.STOPID,
WaypointsColumns.LATITUDE, WaypointsColumns.LONGITUDE, WaypointsColumns.ALTITUDE,
WaypointsColumns.BEARING, WaypointsColumns.TIME, WaypointsColumns.ACCURACY,
WaypointsColumns.SPEED, WaypointsColumns.TOTALDISTANCE, WaypointsColumns.TOTALTIME,
WaypointsColumns.MOVINGTIME, WaypointsColumns.AVGSPEED, WaypointsColumns.AVGMOVINGSPEED,
WaypointsColumns.MAXSPEED, WaypointsColumns.MINELEVATION, WaypointsColumns.MAXELEVATION,
WaypointsColumns.ELEVATIONGAIN, WaypointsColumns.MINGRADE, WaypointsColumns.MAXGRADE };
public static final byte[] WAYPOINTS_BACKUP_COLUMN_TYPES = {
LONG_TYPE_ID, LONG_TYPE_ID, STRING_TYPE_ID, STRING_TYPE_ID,
STRING_TYPE_ID, STRING_TYPE_ID, INT_TYPE_ID, FLOAT_TYPE_ID, LONG_TYPE_ID,
LONG_TYPE_ID, LONG_TYPE_ID, LONG_TYPE_ID, INT_TYPE_ID, INT_TYPE_ID,
FLOAT_TYPE_ID, FLOAT_TYPE_ID, LONG_TYPE_ID, FLOAT_TYPE_ID, FLOAT_TYPE_ID,
FLOAT_TYPE_ID, LONG_TYPE_ID, LONG_TYPE_ID, FLOAT_TYPE_ID, FLOAT_TYPE_ID,
FLOAT_TYPE_ID, FLOAT_TYPE_ID, FLOAT_TYPE_ID, FLOAT_TYPE_ID, FLOAT_TYPE_ID,
FLOAT_TYPE_ID };
}
@@ -156,12 +156,12 @@ class ExternalFileBackup {
TracksColumns.COLUMN_TYPES, TracksColumns.COLUMN_TYPES,
false); false);
DatabaseDumper waypointDumper = new DatabaseDumper( DatabaseDumper waypointDumper = new DatabaseDumper(
BackupColumns.WAYPOINTS_BACKUP_COLUMNS, WaypointsColumns.COLUMNS,
BackupColumns.WAYPOINTS_BACKUP_COLUMN_TYPES, WaypointsColumns.COLUMN_TYPES,
false); false);
DatabaseDumper pointDumper = new DatabaseDumper( DatabaseDumper pointDumper = new DatabaseDumper(
BackupColumns.POINTS_BACKUP_COLUMNS, TrackPointsColumns.COLUMNS,
BackupColumns.POINTS_BACKUP_COLUMN_TYPES, TrackPointsColumns.COLUMN_TYPES,
false); false);
// Open the target for writing // Open the target for writing
@@ -628,10 +628,10 @@ public class TrackRecordingService extends Service {
lastValidLocation = null; lastValidLocation = null;
Waypoint waypoint = providerUtils.getFirstWaypoint(recordingTrackId); Waypoint waypoint = providerUtils.getFirstWaypoint(recordingTrackId);
if (waypoint != null && waypoint.getStatistics() != null) { if (waypoint != null && waypoint.getTripStatistics() != null) {
currentWaypointId = waypoint.getId(); currentWaypointId = waypoint.getId();
waypointStatsBuilder = new TripStatisticsBuilder( waypointStatsBuilder = new TripStatisticsBuilder(
waypoint.getStatistics()); waypoint.getTripStatistics());
} else { } else {
// This should never happen, but we got to do something so life goes on: // This should never happen, but we got to do something so life goes on:
waypointStatsBuilder = new TripStatisticsBuilder(stats.getStartTime()); waypointStatsBuilder = new TripStatisticsBuilder(stats.getStartTime());
@@ -1010,7 +1010,7 @@ public class TrackRecordingService extends Service {
name = getString(R.string.marker_split_name_format, nextMarkerNumber); name = getString(R.string.marker_split_name_format, nextMarkerNumber);
} }
waypoint.setName(name); waypoint.setName(name);
waypoint.setStatistics(waypointStatsBuilder.getStatistics()); waypoint.setTripStatistics(waypointStatsBuilder.getStatistics());
waypoint.setDescription(descriptionGenerator.generateWaypointDescription(waypoint)); waypoint.setDescription(descriptionGenerator.generateWaypointDescription(waypoint));
waypoint.setIcon(getString(R.string.marker_statistics_icon_url)); waypoint.setIcon(getString(R.string.marker_statistics_icon_url));

Some files were not shown because too many files have changed in this diff Show More