forked from upstream-mirrors/OpenTracks
Add an icon column in track table.
This commit is contained in:
@@ -78,11 +78,12 @@ public class TrackListActivity extends FragmentActivity implements DeleteOneTrac
|
|||||||
private static final String[] PROJECTION = new String[] {
|
private static final String[] PROJECTION = new String[] {
|
||||||
TracksColumns._ID,
|
TracksColumns._ID,
|
||||||
TracksColumns.NAME,
|
TracksColumns.NAME,
|
||||||
|
TracksColumns.DESCRIPTION,
|
||||||
TracksColumns.CATEGORY,
|
TracksColumns.CATEGORY,
|
||||||
TracksColumns.TOTALTIME,
|
|
||||||
TracksColumns.TOTALDISTANCE,
|
|
||||||
TracksColumns.STARTTIME,
|
TracksColumns.STARTTIME,
|
||||||
TracksColumns.DESCRIPTION };
|
TracksColumns.TOTALDISTANCE,
|
||||||
|
TracksColumns.TOTALTIME,
|
||||||
|
TracksColumns.ICON};
|
||||||
|
|
||||||
// Callback when the trackRecordingServiceConnection binding changes.
|
// Callback when the trackRecordingServiceConnection binding changes.
|
||||||
private final Runnable bindChangedCallback = new Runnable() {
|
private final Runnable bindChangedCallback = new Runnable() {
|
||||||
@@ -211,12 +212,13 @@ public class TrackListActivity extends FragmentActivity implements DeleteOneTrac
|
|||||||
public void bindView(View view, Context context, Cursor cursor) {
|
public void bindView(View view, Context context, Cursor cursor) {
|
||||||
int idIndex = cursor.getColumnIndex(TracksColumns._ID);
|
int idIndex = cursor.getColumnIndex(TracksColumns._ID);
|
||||||
int nameIndex = cursor.getColumnIndex(TracksColumns.NAME);
|
int nameIndex = cursor.getColumnIndex(TracksColumns.NAME);
|
||||||
int categoryIndex = cursor.getColumnIndex(TracksColumns.CATEGORY);
|
|
||||||
int timeIndex = cursor.getColumnIndexOrThrow(TracksColumns.TOTALTIME);
|
|
||||||
int distanceIndex = cursor.getColumnIndexOrThrow(TracksColumns.TOTALDISTANCE);
|
|
||||||
int startIndex = cursor.getColumnIndexOrThrow(TracksColumns.STARTTIME);
|
|
||||||
int descriptionIndex = cursor.getColumnIndex(TracksColumns.DESCRIPTION);
|
int descriptionIndex = cursor.getColumnIndex(TracksColumns.DESCRIPTION);
|
||||||
|
int categoryIndex = cursor.getColumnIndex(TracksColumns.CATEGORY);
|
||||||
|
int startTimeIndex = cursor.getColumnIndexOrThrow(TracksColumns.STARTTIME);
|
||||||
|
int totalDistanceIndex = cursor.getColumnIndexOrThrow(TracksColumns.TOTALDISTANCE);
|
||||||
|
int totalTimeIndex = cursor.getColumnIndexOrThrow(TracksColumns.TOTALTIME);
|
||||||
|
int iconIndex = cursor.getColumnIndex(TracksColumns.ICON);
|
||||||
|
|
||||||
boolean isRecording = cursor.getLong(idIndex) == recordingTrackId;
|
boolean isRecording = cursor.getLong(idIndex) == recordingTrackId;
|
||||||
String name = cursor.getString(nameIndex);
|
String name = cursor.getString(nameIndex);
|
||||||
int iconId = isRecording ? R.drawable.menu_record_track : R.drawable.track;
|
int iconId = isRecording ? R.drawable.menu_record_track : R.drawable.track;
|
||||||
@@ -224,10 +226,10 @@ public class TrackListActivity extends FragmentActivity implements DeleteOneTrac
|
|||||||
: R.string.icon_track);
|
: R.string.icon_track);
|
||||||
String category = cursor.getString(categoryIndex);
|
String category = cursor.getString(categoryIndex);
|
||||||
String totalTime = isRecording
|
String totalTime = isRecording
|
||||||
? null : StringUtils.formatElapsedTime(cursor.getLong(timeIndex));
|
? null : StringUtils.formatElapsedTime(cursor.getLong(totalTimeIndex));
|
||||||
String totalDistance = isRecording ? null : StringUtils.formatDistance(
|
String totalDistance = isRecording ? null : StringUtils.formatDistance(
|
||||||
TrackListActivity.this, cursor.getDouble(distanceIndex), metricUnits);
|
TrackListActivity.this, cursor.getDouble(totalDistanceIndex), metricUnits);
|
||||||
long startTime = cursor.getLong(startIndex);
|
long startTime = cursor.getLong(startTimeIndex);
|
||||||
String description = cursor.getString(descriptionIndex);
|
String description = cursor.getString(descriptionIndex);
|
||||||
ListItemUtils.setListItem(TrackListActivity.this,
|
ListItemUtils.setListItem(TrackListActivity.this,
|
||||||
view,
|
view,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
* License for the specific language governing permissions and limitations under
|
* License for the specific language governing permissions and limitations under
|
||||||
* the License.
|
* the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.google.android.apps.mytracks.content;
|
package com.google.android.apps.mytracks.content;
|
||||||
|
|
||||||
import com.google.android.apps.mytracks.Constants;
|
import com.google.android.apps.mytracks.Constants;
|
||||||
@@ -44,7 +45,7 @@ import android.util.Log;
|
|||||||
public class MyTracksProvider extends ContentProvider {
|
public class MyTracksProvider extends ContentProvider {
|
||||||
|
|
||||||
private static final String DATABASE_NAME = "mytracks.db";
|
private static final String DATABASE_NAME = "mytracks.db";
|
||||||
private static final int DATABASE_VERSION = 19;
|
private static final int DATABASE_VERSION = 20;
|
||||||
private static final int TRACKPOINTS = 1;
|
private static final int TRACKPOINTS = 1;
|
||||||
private static final int TRACKPOINTS_ID = 2;
|
private static final int TRACKPOINTS_ID = 2;
|
||||||
private static final int TRACKS = 3;
|
private static final int TRACKS = 3;
|
||||||
@@ -52,9 +53,8 @@ public class MyTracksProvider extends ContentProvider {
|
|||||||
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 TRACKPOINTS_TABLE = "trackpoints";
|
||||||
private static final String TRACKS_TABLE = "tracks";
|
|
||||||
private static final String WAYPOINTS_TABLE = "waypoints";
|
private static final String WAYPOINTS_TABLE = "waypoints";
|
||||||
public static final String TAG = "MyTracksProvider";
|
private static final String TAG = MyTracksProvider.class.getSimpleName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper which creates or upgrades the database if necessary.
|
* Helper which creates or upgrades the database if necessary.
|
||||||
@@ -78,33 +78,7 @@ public class MyTracksProvider extends ContentProvider {
|
|||||||
+ TrackPointsColumns.SPEED + " FLOAT, "
|
+ TrackPointsColumns.SPEED + " FLOAT, "
|
||||||
+ TrackPointsColumns.BEARING + " FLOAT, "
|
+ TrackPointsColumns.BEARING + " FLOAT, "
|
||||||
+ TrackPointsColumns.SENSOR + " BLOB);");
|
+ TrackPointsColumns.SENSOR + " BLOB);");
|
||||||
db.execSQL("CREATE TABLE " + TRACKS_TABLE + " ("
|
db.execSQL(TracksColumns.CREATE_TABLE);
|
||||||
+ TracksColumns._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
|
|
||||||
+ TracksColumns.NAME + " STRING, "
|
|
||||||
+ TracksColumns.DESCRIPTION + " STRING, "
|
|
||||||
+ TracksColumns.CATEGORY + " STRING, "
|
|
||||||
+ TracksColumns.STARTID + " INTEGER, "
|
|
||||||
+ TracksColumns.STOPID + " INTEGER, "
|
|
||||||
+ TracksColumns.STARTTIME + " INTEGER, "
|
|
||||||
+ TracksColumns.STOPTIME + " INTEGER, "
|
|
||||||
+ TracksColumns.NUMPOINTS + " INTEGER, "
|
|
||||||
+ TracksColumns.TOTALDISTANCE + " FLOAT, "
|
|
||||||
+ TracksColumns.TOTALTIME + " INTEGER, "
|
|
||||||
+ TracksColumns.MOVINGTIME + " INTEGER, "
|
|
||||||
+ TracksColumns.MINLAT + " INTEGER, "
|
|
||||||
+ TracksColumns.MAXLAT + " INTEGER, "
|
|
||||||
+ TracksColumns.MINLON + " INTEGER, "
|
|
||||||
+ TracksColumns.MAXLON + " INTEGER, "
|
|
||||||
+ TracksColumns.AVGSPEED + " FLOAT, "
|
|
||||||
+ TracksColumns.AVGMOVINGSPEED + " FLOAT, "
|
|
||||||
+ TracksColumns.MAXSPEED + " FLOAT, "
|
|
||||||
+ TracksColumns.MINELEVATION + " FLOAT, "
|
|
||||||
+ TracksColumns.MAXELEVATION + " FLOAT, "
|
|
||||||
+ TracksColumns.ELEVATIONGAIN + " FLOAT, "
|
|
||||||
+ TracksColumns.MINGRADE + " FLOAT, "
|
|
||||||
+ TracksColumns.MAXGRADE + " FLOAT, "
|
|
||||||
+ TracksColumns.MAPID + " STRING, "
|
|
||||||
+ TracksColumns.TABLEID + " STRING);");
|
|
||||||
db.execSQL("CREATE TABLE " + WAYPOINTS_TABLE + " ("
|
db.execSQL("CREATE TABLE " + WAYPOINTS_TABLE + " ("
|
||||||
+ WaypointsColumns._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
|
+ WaypointsColumns._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
|
||||||
+ WaypointsColumns.NAME + " STRING, "
|
+ WaypointsColumns.NAME + " STRING, "
|
||||||
@@ -140,30 +114,34 @@ public class MyTracksProvider extends ContentProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||||
|
Log.w(TAG, "Upgrading database from version " + oldVersion + " to " + newVersion);
|
||||||
if (oldVersion < 17) {
|
if (oldVersion < 17) {
|
||||||
// Wipe the old data.
|
// Delete the old data
|
||||||
Log.w(TAG, "Upgrading database from version " + oldVersion + " to "
|
Log.w(TAG, "Delete all old data");
|
||||||
+ newVersion + ", which will destroy all old data");
|
|
||||||
db.execSQL("DROP TABLE IF EXISTS " + TRACKPOINTS_TABLE);
|
db.execSQL("DROP TABLE IF EXISTS " + TRACKPOINTS_TABLE);
|
||||||
db.execSQL("DROP TABLE IF EXISTS " + TRACKS_TABLE);
|
db.execSQL("DROP TABLE IF EXISTS " + TracksColumns.TABLE_NAME);
|
||||||
db.execSQL("DROP TABLE IF EXISTS " + WAYPOINTS_TABLE);
|
db.execSQL("DROP TABLE IF EXISTS " + WAYPOINTS_TABLE);
|
||||||
onCreate(db);
|
onCreate(db);
|
||||||
} else {
|
} else {
|
||||||
// Incremental updates go here.
|
// Incremental updates go here. For each DB version, add a corresponding if clause.
|
||||||
// Each time you increase the DB version, add a corresponding if clause.
|
|
||||||
Log.w(TAG, "Upgrading database from version " + oldVersion + " to "
|
|
||||||
+ newVersion);
|
|
||||||
|
|
||||||
// Sensor data.
|
// 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("ALTER TABLE " + TRACKPOINTS_TABLE
|
db.execSQL(
|
||||||
+ " ADD " + TrackPointsColumns.SENSOR + " BLOB");
|
"ALTER TABLE " + TRACKPOINTS_TABLE + " ADD " + TrackPointsColumns.SENSOR + " BLOB");
|
||||||
}
|
}
|
||||||
|
// Tracks table id column
|
||||||
if (oldVersion <= 18) {
|
if (oldVersion <= 18) {
|
||||||
Log.w(TAG, "Upgrade DB: Adding tableid column.");
|
Log.w(TAG, "Upgrade DB: Adding tableid column.");
|
||||||
db.execSQL("ALTER TABLE " + TRACKS_TABLE
|
db.execSQL("ALTER TABLE " + TracksColumns.TABLE_NAME + " ADD " + TracksColumns.TABLEID
|
||||||
+ " ADD " + TracksColumns.TABLEID + " STRING");
|
+ " STRING");
|
||||||
|
}
|
||||||
|
// Tracks table icon column
|
||||||
|
if (oldVersion <= 19) {
|
||||||
|
Log.w(TAG, "Upgrade DB: Adding icon column.");
|
||||||
|
db.execSQL(
|
||||||
|
"ALTER TABLE " + TracksColumns.TABLE_NAME + " ADD " + TracksColumns.ICON + " STRING");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -221,7 +199,7 @@ public class MyTracksProvider extends ContentProvider {
|
|||||||
table = TRACKPOINTS_TABLE;
|
table = TRACKPOINTS_TABLE;
|
||||||
break;
|
break;
|
||||||
case TRACKS:
|
case TRACKS:
|
||||||
table = TRACKS_TABLE;
|
table = TracksColumns.TABLE_NAME;
|
||||||
shouldVacuum = true;
|
shouldVacuum = true;
|
||||||
break;
|
break;
|
||||||
case WAYPOINTS:
|
case WAYPOINTS:
|
||||||
@@ -350,7 +328,7 @@ public class MyTracksProvider extends ContentProvider {
|
|||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Both start time and start id values are required.");
|
"Both start time and start id values are required.");
|
||||||
}
|
}
|
||||||
long rowId = db.insert(TRACKS_TABLE, TracksColumns._ID, values);
|
long rowId = db.insert(TracksColumns.TABLE_NAME, TracksColumns._ID, values);
|
||||||
if (rowId > 0) {
|
if (rowId > 0) {
|
||||||
Uri uri = ContentUris.appendId(
|
Uri uri = ContentUris.appendId(
|
||||||
TracksColumns.CONTENT_URI.buildUpon(), rowId).build();
|
TracksColumns.CONTENT_URI.buildUpon(), rowId).build();
|
||||||
@@ -392,14 +370,14 @@ public class MyTracksProvider extends ContentProvider {
|
|||||||
qb.setTables(TRACKPOINTS_TABLE);
|
qb.setTables(TRACKPOINTS_TABLE);
|
||||||
qb.appendWhere("_id=" + url.getPathSegments().get(1));
|
qb.appendWhere("_id=" + url.getPathSegments().get(1));
|
||||||
} else if (match == TRACKS) {
|
} else if (match == TRACKS) {
|
||||||
qb.setTables(TRACKS_TABLE);
|
qb.setTables(TracksColumns.TABLE_NAME);
|
||||||
if (sort != null) {
|
if (sort != null) {
|
||||||
sortOrder = sort;
|
sortOrder = sort;
|
||||||
} else {
|
} else {
|
||||||
sortOrder = TracksColumns.DEFAULT_SORT_ORDER;
|
sortOrder = TracksColumns.DEFAULT_SORT_ORDER;
|
||||||
}
|
}
|
||||||
} else if (match == TRACKS_ID) {
|
} else if (match == TRACKS_ID) {
|
||||||
qb.setTables(TRACKS_TABLE);
|
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(WAYPOINTS_TABLE);
|
||||||
@@ -441,10 +419,10 @@ public class MyTracksProvider extends ContentProvider {
|
|||||||
: ""),
|
: ""),
|
||||||
selectionArgs);
|
selectionArgs);
|
||||||
} else if (match == TRACKS) {
|
} else if (match == TRACKS) {
|
||||||
count = db.update(TRACKS_TABLE, values, where, selectionArgs);
|
count = db.update(TracksColumns.TABLE_NAME, values, where, selectionArgs);
|
||||||
} else if (match == TRACKS_ID) {
|
} else if (match == TRACKS_ID) {
|
||||||
String segment = url.getPathSegments().get(1);
|
String segment = url.getPathSegments().get(1);
|
||||||
count = db.update(TRACKS_TABLE, values, "_id=" + segment
|
count = db.update(TracksColumns.TABLE_NAME, values, "_id=" + segment
|
||||||
+ (!TextUtils.isEmpty(where)
|
+ (!TextUtils.isEmpty(where)
|
||||||
? " AND (" + where + ')'
|
? " AND (" + where + ')'
|
||||||
: ""),
|
: ""),
|
||||||
|
|||||||
@@ -15,9 +15,13 @@
|
|||||||
*/
|
*/
|
||||||
package com.google.android.apps.mytracks.io.backup;
|
package com.google.android.apps.mytracks.io.backup;
|
||||||
|
|
||||||
import static com.google.android.apps.mytracks.content.ContentTypeIds.*;
|
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.TrackPointsColumns;
|
||||||
import com.google.android.apps.mytracks.content.TracksColumns;
|
|
||||||
import com.google.android.apps.mytracks.content.WaypointsColumns;
|
import com.google.android.apps.mytracks.content.WaypointsColumns;
|
||||||
|
|
||||||
public class BackupColumns {
|
public class BackupColumns {
|
||||||
@@ -31,23 +35,6 @@ public class BackupColumns {
|
|||||||
{ LONG_TYPE_ID, LONG_TYPE_ID, INT_TYPE_ID, INT_TYPE_ID, FLOAT_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, BLOB_TYPE_ID };
|
FLOAT_TYPE_ID, LONG_TYPE_ID, FLOAT_TYPE_ID, FLOAT_TYPE_ID, BLOB_TYPE_ID };
|
||||||
|
|
||||||
public static final String[] TRACKS_BACKUP_COLUMNS = {
|
|
||||||
TracksColumns._ID, TracksColumns.NAME, TracksColumns.DESCRIPTION, TracksColumns.CATEGORY,
|
|
||||||
TracksColumns.STARTID, TracksColumns.STOPID, TracksColumns.STARTTIME, TracksColumns.STOPTIME,
|
|
||||||
TracksColumns.NUMPOINTS, TracksColumns.TOTALDISTANCE, TracksColumns.TOTALTIME,
|
|
||||||
TracksColumns.MOVINGTIME, TracksColumns.AVGSPEED, TracksColumns.AVGMOVINGSPEED,
|
|
||||||
TracksColumns.MAXSPEED, TracksColumns.MINELEVATION, TracksColumns.MAXELEVATION,
|
|
||||||
TracksColumns.ELEVATIONGAIN, TracksColumns.MINGRADE, TracksColumns.MAXGRADE,
|
|
||||||
TracksColumns.MINLAT, TracksColumns.MAXLAT, TracksColumns.MINLON, TracksColumns.MAXLON,
|
|
||||||
TracksColumns.MAPID, TracksColumns.TABLEID};
|
|
||||||
public static final byte[] TRACKS_BACKUP_COLUMN_TYPES = {
|
|
||||||
LONG_TYPE_ID, STRING_TYPE_ID, STRING_TYPE_ID, STRING_TYPE_ID,
|
|
||||||
LONG_TYPE_ID, LONG_TYPE_ID, LONG_TYPE_ID, LONG_TYPE_ID, INT_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, INT_TYPE_ID, INT_TYPE_ID, INT_TYPE_ID, INT_TYPE_ID, STRING_TYPE_ID,
|
|
||||||
STRING_TYPE_ID};
|
|
||||||
|
|
||||||
public static final String[] WAYPOINTS_BACKUP_COLUMNS = {
|
public static final String[] WAYPOINTS_BACKUP_COLUMNS = {
|
||||||
WaypointsColumns._ID, WaypointsColumns.TRACKID, WaypointsColumns.NAME,
|
WaypointsColumns._ID, WaypointsColumns.TRACKID, WaypointsColumns.NAME,
|
||||||
WaypointsColumns.DESCRIPTION, WaypointsColumns.CATEGORY, WaypointsColumns.ICON,
|
WaypointsColumns.DESCRIPTION, WaypointsColumns.CATEGORY, WaypointsColumns.ICON,
|
||||||
|
|||||||
@@ -152,8 +152,8 @@ class ExternalFileBackup {
|
|||||||
// Create all the auxiliary classes that will do the writing
|
// Create all the auxiliary classes that will do the writing
|
||||||
PreferenceBackupHelper preferencesHelper = new PreferenceBackupHelper();
|
PreferenceBackupHelper preferencesHelper = new PreferenceBackupHelper();
|
||||||
DatabaseDumper trackDumper = new DatabaseDumper(
|
DatabaseDumper trackDumper = new DatabaseDumper(
|
||||||
BackupColumns.TRACKS_BACKUP_COLUMNS,
|
TracksColumns.COLUMNS,
|
||||||
BackupColumns.TRACKS_BACKUP_COLUMN_TYPES,
|
TracksColumns.COLUMN_TYPES,
|
||||||
false);
|
false);
|
||||||
DatabaseDumper waypointDumper = new DatabaseDumper(
|
DatabaseDumper waypointDumper = new DatabaseDumper(
|
||||||
BackupColumns.WAYPOINTS_BACKUP_COLUMNS,
|
BackupColumns.WAYPOINTS_BACKUP_COLUMNS,
|
||||||
|
|||||||
+52
-53
@@ -100,21 +100,19 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
|
|||||||
}
|
}
|
||||||
values.put(TracksColumns.NAME, track.getName());
|
values.put(TracksColumns.NAME, track.getName());
|
||||||
values.put(TracksColumns.DESCRIPTION, track.getDescription());
|
values.put(TracksColumns.DESCRIPTION, track.getDescription());
|
||||||
values.put(TracksColumns.MAPID, track.getMapId());
|
|
||||||
values.put(TracksColumns.TABLEID, track.getTableId());
|
|
||||||
values.put(TracksColumns.CATEGORY, track.getCategory());
|
values.put(TracksColumns.CATEGORY, track.getCategory());
|
||||||
values.put(TracksColumns.NUMPOINTS, track.getNumberOfPoints());
|
|
||||||
values.put(TracksColumns.STARTID, track.getStartId());
|
values.put(TracksColumns.STARTID, track.getStartId());
|
||||||
|
values.put(TracksColumns.STOPID, track.getStopId());
|
||||||
values.put(TracksColumns.STARTTIME, stats.getStartTime());
|
values.put(TracksColumns.STARTTIME, stats.getStartTime());
|
||||||
values.put(TracksColumns.STOPTIME, stats.getStopTime());
|
values.put(TracksColumns.STOPTIME, stats.getStopTime());
|
||||||
values.put(TracksColumns.STOPID, track.getStopId());
|
values.put(TracksColumns.NUMPOINTS, track.getNumberOfPoints());
|
||||||
values.put(TracksColumns.TOTALDISTANCE, stats.getTotalDistance());
|
values.put(TracksColumns.TOTALDISTANCE, stats.getTotalDistance());
|
||||||
values.put(TracksColumns.TOTALTIME, stats.getTotalTime());
|
values.put(TracksColumns.TOTALTIME, stats.getTotalTime());
|
||||||
values.put(TracksColumns.MOVINGTIME, stats.getMovingTime());
|
values.put(TracksColumns.MOVINGTIME, stats.getMovingTime());
|
||||||
values.put(TracksColumns.MAXLAT, stats.getTop());
|
|
||||||
values.put(TracksColumns.MINLAT, stats.getBottom());
|
values.put(TracksColumns.MINLAT, stats.getBottom());
|
||||||
values.put(TracksColumns.MAXLON, stats.getRight());
|
values.put(TracksColumns.MAXLAT, stats.getTop());
|
||||||
values.put(TracksColumns.MINLON, stats.getLeft());
|
values.put(TracksColumns.MINLON, stats.getLeft());
|
||||||
|
values.put(TracksColumns.MAXLON, stats.getRight());
|
||||||
values.put(TracksColumns.AVGSPEED, stats.getAverageSpeed());
|
values.put(TracksColumns.AVGSPEED, stats.getAverageSpeed());
|
||||||
values.put(TracksColumns.AVGMOVINGSPEED, stats.getAverageMovingSpeed());
|
values.put(TracksColumns.AVGMOVINGSPEED, stats.getAverageMovingSpeed());
|
||||||
values.put(TracksColumns.MAXSPEED, stats.getMaxSpeed());
|
values.put(TracksColumns.MAXSPEED, stats.getMaxSpeed());
|
||||||
@@ -123,6 +121,9 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
|
|||||||
values.put(TracksColumns.ELEVATIONGAIN, stats.getTotalElevationGain());
|
values.put(TracksColumns.ELEVATIONGAIN, stats.getTotalElevationGain());
|
||||||
values.put(TracksColumns.MINGRADE, stats.getMinGrade());
|
values.put(TracksColumns.MINGRADE, stats.getMinGrade());
|
||||||
values.put(TracksColumns.MAXGRADE, stats.getMaxGrade());
|
values.put(TracksColumns.MAXGRADE, stats.getMaxGrade());
|
||||||
|
values.put(TracksColumns.MAPID, track.getMapId());
|
||||||
|
values.put(TracksColumns.TABLEID, track.getTableId());
|
||||||
|
values.put(TracksColumns.ICON, track.getIcon());
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,37 +268,32 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
|
|||||||
public Track createTrack(Cursor cursor) {
|
public Track createTrack(Cursor cursor) {
|
||||||
int idxId = cursor.getColumnIndexOrThrow(TracksColumns._ID);
|
int idxId = cursor.getColumnIndexOrThrow(TracksColumns._ID);
|
||||||
int idxName = cursor.getColumnIndexOrThrow(TracksColumns.NAME);
|
int idxName = cursor.getColumnIndexOrThrow(TracksColumns.NAME);
|
||||||
int idxDescription =
|
int idxDescription = cursor.getColumnIndexOrThrow(TracksColumns.DESCRIPTION);
|
||||||
cursor.getColumnIndexOrThrow(TracksColumns.DESCRIPTION);
|
|
||||||
int idxMapId = cursor.getColumnIndexOrThrow(TracksColumns.MAPID);
|
|
||||||
int idxTableId = cursor.getColumnIndexOrThrow(TracksColumns.TABLEID);
|
|
||||||
int idxCategory = cursor.getColumnIndexOrThrow(TracksColumns.CATEGORY);
|
int idxCategory = cursor.getColumnIndexOrThrow(TracksColumns.CATEGORY);
|
||||||
int idxStartId = cursor.getColumnIndexOrThrow(TracksColumns.STARTID);
|
int idxStartId = cursor.getColumnIndexOrThrow(TracksColumns.STARTID);
|
||||||
|
int idxStopId = cursor.getColumnIndexOrThrow(TracksColumns.STOPID);
|
||||||
int idxStartTime = cursor.getColumnIndexOrThrow(TracksColumns.STARTTIME);
|
int idxStartTime = cursor.getColumnIndexOrThrow(TracksColumns.STARTTIME);
|
||||||
int idxStopTime = cursor.getColumnIndexOrThrow(TracksColumns.STOPTIME);
|
int idxStopTime = cursor.getColumnIndexOrThrow(TracksColumns.STOPTIME);
|
||||||
int idxStopId = cursor.getColumnIndexOrThrow(TracksColumns.STOPID);
|
|
||||||
int idxNumPoints = cursor.getColumnIndexOrThrow(TracksColumns.NUMPOINTS);
|
int idxNumPoints = cursor.getColumnIndexOrThrow(TracksColumns.NUMPOINTS);
|
||||||
int idxMaxlat = cursor.getColumnIndexOrThrow(TracksColumns.MAXLAT);
|
int idxTotalDistance = cursor.getColumnIndexOrThrow(TracksColumns.TOTALDISTANCE);
|
||||||
int idxMinlat = cursor.getColumnIndexOrThrow(TracksColumns.MINLAT);
|
|
||||||
int idxMaxlon = cursor.getColumnIndexOrThrow(TracksColumns.MAXLON);
|
|
||||||
int idxMinlon = cursor.getColumnIndexOrThrow(TracksColumns.MINLON);
|
|
||||||
|
|
||||||
int idxTotalDistance =
|
|
||||||
cursor.getColumnIndexOrThrow(TracksColumns.TOTALDISTANCE);
|
|
||||||
int idxTotalTime = cursor.getColumnIndexOrThrow(TracksColumns.TOTALTIME);
|
int idxTotalTime = cursor.getColumnIndexOrThrow(TracksColumns.TOTALTIME);
|
||||||
int idxMovingTime = cursor.getColumnIndexOrThrow(TracksColumns.MOVINGTIME);
|
int idxMovingTime = cursor.getColumnIndexOrThrow(TracksColumns.MOVINGTIME);
|
||||||
|
int idxMinlat = cursor.getColumnIndexOrThrow(TracksColumns.MINLAT);
|
||||||
|
int idxMaxlat = cursor.getColumnIndexOrThrow(TracksColumns.MAXLAT);
|
||||||
|
int idxMinlon = cursor.getColumnIndexOrThrow(TracksColumns.MINLON);
|
||||||
|
int idxMaxlon = cursor.getColumnIndexOrThrow(TracksColumns.MAXLON);
|
||||||
int idxMaxSpeed = cursor.getColumnIndexOrThrow(TracksColumns.MAXSPEED);
|
int idxMaxSpeed = cursor.getColumnIndexOrThrow(TracksColumns.MAXSPEED);
|
||||||
int idxMinElevation =
|
int idxMinElevation = cursor.getColumnIndexOrThrow(TracksColumns.MINELEVATION);
|
||||||
cursor.getColumnIndexOrThrow(TracksColumns.MINELEVATION);
|
int idxMaxElevation = cursor.getColumnIndexOrThrow(TracksColumns.MAXELEVATION);
|
||||||
int idxMaxElevation =
|
int idxElevationGain = cursor.getColumnIndexOrThrow(TracksColumns.ELEVATIONGAIN);
|
||||||
cursor.getColumnIndexOrThrow(TracksColumns.MAXELEVATION);
|
|
||||||
int idxElevationGain =
|
|
||||||
cursor.getColumnIndexOrThrow(TracksColumns.ELEVATIONGAIN);
|
|
||||||
int idxMinGrade = cursor.getColumnIndexOrThrow(TracksColumns.MINGRADE);
|
int idxMinGrade = cursor.getColumnIndexOrThrow(TracksColumns.MINGRADE);
|
||||||
int idxMaxGrade = cursor.getColumnIndexOrThrow(TracksColumns.MAXGRADE);
|
int idxMaxGrade = cursor.getColumnIndexOrThrow(TracksColumns.MAXGRADE);
|
||||||
|
int idxMapId = cursor.getColumnIndexOrThrow(TracksColumns.MAPID);
|
||||||
|
int idxTableId = cursor.getColumnIndexOrThrow(TracksColumns.TABLEID);
|
||||||
|
int idxIcon = cursor.getColumnIndexOrThrow(TracksColumns.ICON);
|
||||||
|
|
||||||
Track track = new Track();
|
Track track = new Track();
|
||||||
TripStatistics stats = track.getTripStatistics();
|
TripStatistics tripStatistics = track.getTripStatistics();
|
||||||
if (!cursor.isNull(idxId)) {
|
if (!cursor.isNull(idxId)) {
|
||||||
track.setId(cursor.getLong(idxId));
|
track.setId(cursor.getLong(idxId));
|
||||||
}
|
}
|
||||||
@@ -307,66 +303,69 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
|
|||||||
if (!cursor.isNull(idxDescription)) {
|
if (!cursor.isNull(idxDescription)) {
|
||||||
track.setDescription(cursor.getString(idxDescription));
|
track.setDescription(cursor.getString(idxDescription));
|
||||||
}
|
}
|
||||||
if (!cursor.isNull(idxMapId)) {
|
|
||||||
track.setMapId(cursor.getString(idxMapId));
|
|
||||||
}
|
|
||||||
if (!cursor.isNull(idxTableId)) {
|
|
||||||
track.setTableId(cursor.getString(idxTableId));
|
|
||||||
}
|
|
||||||
if (!cursor.isNull(idxCategory)) {
|
if (!cursor.isNull(idxCategory)) {
|
||||||
track.setCategory(cursor.getString(idxCategory));
|
track.setCategory(cursor.getString(idxCategory));
|
||||||
}
|
}
|
||||||
if (!cursor.isNull(idxStartId)) {
|
if (!cursor.isNull(idxStartId)) {
|
||||||
track.setStartId(cursor.getInt(idxStartId));
|
track.setStartId(cursor.getInt(idxStartId));
|
||||||
}
|
}
|
||||||
if (!cursor.isNull(idxStartTime)) {
|
|
||||||
stats.setStartTime(cursor.getLong(idxStartTime));
|
|
||||||
}
|
|
||||||
if (!cursor.isNull(idxStopTime)) {
|
|
||||||
stats.setStopTime(cursor.getLong(idxStopTime));
|
|
||||||
}
|
|
||||||
if (!cursor.isNull(idxStopId)) {
|
if (!cursor.isNull(idxStopId)) {
|
||||||
track.setStopId(cursor.getInt(idxStopId));
|
track.setStopId(cursor.getInt(idxStopId));
|
||||||
}
|
}
|
||||||
|
if (!cursor.isNull(idxStartTime)) {
|
||||||
|
tripStatistics.setStartTime(cursor.getLong(idxStartTime));
|
||||||
|
}
|
||||||
|
if (!cursor.isNull(idxStopTime)) {
|
||||||
|
tripStatistics.setStopTime(cursor.getLong(idxStopTime));
|
||||||
|
}
|
||||||
if (!cursor.isNull(idxNumPoints)) {
|
if (!cursor.isNull(idxNumPoints)) {
|
||||||
track.setNumberOfPoints(cursor.getInt(idxNumPoints));
|
track.setNumberOfPoints(cursor.getInt(idxNumPoints));
|
||||||
}
|
}
|
||||||
if (!cursor.isNull(idxTotalDistance)) {
|
if (!cursor.isNull(idxTotalDistance)) {
|
||||||
stats.setTotalDistance(cursor.getFloat(idxTotalDistance));
|
tripStatistics.setTotalDistance(cursor.getFloat(idxTotalDistance));
|
||||||
}
|
}
|
||||||
if (!cursor.isNull(idxTotalTime)) {
|
if (!cursor.isNull(idxTotalTime)) {
|
||||||
stats.setTotalTime(cursor.getLong(idxTotalTime));
|
tripStatistics.setTotalTime(cursor.getLong(idxTotalTime));
|
||||||
}
|
}
|
||||||
if (!cursor.isNull(idxMovingTime)) {
|
if (!cursor.isNull(idxMovingTime)) {
|
||||||
stats.setMovingTime(cursor.getLong(idxMovingTime));
|
tripStatistics.setMovingTime(cursor.getLong(idxMovingTime));
|
||||||
}
|
}
|
||||||
if (!cursor.isNull(idxMaxlat)
|
if (!cursor.isNull(idxMinlat)
|
||||||
&& !cursor.isNull(idxMinlat)
|
&& !cursor.isNull(idxMaxlat)
|
||||||
&& !cursor.isNull(idxMaxlon)
|
&& !cursor.isNull(idxMinlon)
|
||||||
&& !cursor.isNull(idxMinlon)) {
|
&& !cursor.isNull(idxMaxlon)) {
|
||||||
int top = cursor.getInt(idxMaxlat);
|
|
||||||
int bottom = cursor.getInt(idxMinlat);
|
int bottom = cursor.getInt(idxMinlat);
|
||||||
int right = cursor.getInt(idxMaxlon);
|
int top = cursor.getInt(idxMaxlat);
|
||||||
int left = cursor.getInt(idxMinlon);
|
int left = cursor.getInt(idxMinlon);
|
||||||
stats.setBounds(left, top, right, bottom);
|
int right = cursor.getInt(idxMaxlon);
|
||||||
|
tripStatistics.setBounds(left, top, right, bottom);
|
||||||
}
|
}
|
||||||
if (!cursor.isNull(idxMaxSpeed)) {
|
if (!cursor.isNull(idxMaxSpeed)) {
|
||||||
stats.setMaxSpeed(cursor.getFloat(idxMaxSpeed));
|
tripStatistics.setMaxSpeed(cursor.getFloat(idxMaxSpeed));
|
||||||
}
|
}
|
||||||
if (!cursor.isNull(idxMinElevation)) {
|
if (!cursor.isNull(idxMinElevation)) {
|
||||||
stats.setMinElevation(cursor.getFloat(idxMinElevation));
|
tripStatistics.setMinElevation(cursor.getFloat(idxMinElevation));
|
||||||
}
|
}
|
||||||
if (!cursor.isNull(idxMaxElevation)) {
|
if (!cursor.isNull(idxMaxElevation)) {
|
||||||
stats.setMaxElevation(cursor.getFloat(idxMaxElevation));
|
tripStatistics.setMaxElevation(cursor.getFloat(idxMaxElevation));
|
||||||
}
|
}
|
||||||
if (!cursor.isNull(idxElevationGain)) {
|
if (!cursor.isNull(idxElevationGain)) {
|
||||||
stats.setTotalElevationGain(cursor.getFloat(idxElevationGain));
|
tripStatistics.setTotalElevationGain(cursor.getFloat(idxElevationGain));
|
||||||
}
|
}
|
||||||
if (!cursor.isNull(idxMinGrade)) {
|
if (!cursor.isNull(idxMinGrade)) {
|
||||||
stats.setMinGrade(cursor.getFloat(idxMinGrade));
|
tripStatistics.setMinGrade(cursor.getFloat(idxMinGrade));
|
||||||
}
|
}
|
||||||
if (!cursor.isNull(idxMaxGrade)) {
|
if (!cursor.isNull(idxMaxGrade)) {
|
||||||
stats.setMaxGrade(cursor.getFloat(idxMaxGrade));
|
tripStatistics.setMaxGrade(cursor.getFloat(idxMaxGrade));
|
||||||
|
}
|
||||||
|
if (!cursor.isNull(idxMapId)) {
|
||||||
|
track.setMapId(cursor.getString(idxMapId));
|
||||||
|
}
|
||||||
|
if (!cursor.isNull(idxTableId)) {
|
||||||
|
track.setTableId(cursor.getString(idxTableId));
|
||||||
|
}
|
||||||
|
if (!cursor.isNull(idxIcon)) {
|
||||||
|
track.setIcon(cursor.getString(idxIcon));
|
||||||
}
|
}
|
||||||
return track;
|
return track;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ public class Track implements Parcelable {
|
|||||||
private String name = "";
|
private String name = "";
|
||||||
private String description = "";
|
private String description = "";
|
||||||
private String category = "";
|
private String category = "";
|
||||||
private String categoryIcon = "";
|
|
||||||
private long startId = -1;
|
private long startId = -1;
|
||||||
private long stopId = -1;
|
private long stopId = -1;
|
||||||
|
|
||||||
@@ -45,6 +44,7 @@ public class Track implements Parcelable {
|
|||||||
private int numberOfPoints = 0;
|
private int numberOfPoints = 0;
|
||||||
private String mapId = "";
|
private String mapId = "";
|
||||||
private String tableId = "";
|
private String tableId = "";
|
||||||
|
private String icon = "";
|
||||||
|
|
||||||
private TripStatistics tripStatistics = new TripStatistics();
|
private TripStatistics tripStatistics = new TripStatistics();
|
||||||
|
|
||||||
@@ -58,20 +58,20 @@ public class Track implements Parcelable {
|
|||||||
name = in.readString();
|
name = in.readString();
|
||||||
description = in.readString();
|
description = in.readString();
|
||||||
category = in.readString();
|
category = in.readString();
|
||||||
categoryIcon = in.readString();
|
|
||||||
startId = in.readLong();
|
startId = in.readLong();
|
||||||
stopId = in.readLong();
|
stopId = in.readLong();
|
||||||
numberOfPoints = in.readInt();
|
numberOfPoints = in.readInt();
|
||||||
mapId = in.readString();
|
mapId = in.readString();
|
||||||
tableId = in.readString();
|
tableId = in.readString();
|
||||||
|
icon = in.readString();
|
||||||
|
|
||||||
ClassLoader classLoader = getClass().getClassLoader();
|
ClassLoader classLoader = getClass().getClassLoader();
|
||||||
|
tripStatistics = in.readParcelable(classLoader);
|
||||||
|
|
||||||
for (int i = 0; i < numberOfPoints; ++i) {
|
for (int i = 0; i < numberOfPoints; ++i) {
|
||||||
Location loc = in.readParcelable(classLoader);
|
Location loc = in.readParcelable(classLoader);
|
||||||
locations.add(loc);
|
locations.add(loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
tripStatistics = in.readParcelable(classLoader);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -85,25 +85,25 @@ public class Track implements Parcelable {
|
|||||||
dest.writeString(name);
|
dest.writeString(name);
|
||||||
dest.writeString(description);
|
dest.writeString(description);
|
||||||
dest.writeString(category);
|
dest.writeString(category);
|
||||||
dest.writeString(categoryIcon);
|
|
||||||
dest.writeLong(startId);
|
dest.writeLong(startId);
|
||||||
dest.writeLong(stopId);
|
dest.writeLong(stopId);
|
||||||
dest.writeInt(numberOfPoints);
|
dest.writeInt(numberOfPoints);
|
||||||
dest.writeString(mapId);
|
dest.writeString(mapId);
|
||||||
dest.writeString(tableId);
|
dest.writeString(tableId);
|
||||||
|
dest.writeString(icon);
|
||||||
|
dest.writeParcelable(tripStatistics, 0);
|
||||||
for (int i = 0; i < numberOfPoints; ++i) {
|
for (int i = 0; i < numberOfPoints; ++i) {
|
||||||
dest.writeParcelable(locations.get(i), 0);
|
dest.writeParcelable(locations.get(i), 0);
|
||||||
}
|
}
|
||||||
dest.writeParcelable(tripStatistics, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Parcelable.Creator<Track> CREATOR = new Parcelable.Creator<Track>() {
|
public static final Parcelable.Creator<Track> CREATOR = new Parcelable.Creator<Track>() {
|
||||||
@Override
|
@Override
|
||||||
public Track createFromParcel(Parcel in) {
|
public Track createFromParcel(Parcel in) {
|
||||||
return new Track(in);
|
return new Track(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Track[] newArray(int size) {
|
public Track[] newArray(int size) {
|
||||||
return new Track[size];
|
return new Track[size];
|
||||||
}
|
}
|
||||||
@@ -141,14 +141,6 @@ public class Track implements Parcelable {
|
|||||||
this.category = category;
|
this.category = category;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCategoryIcon() {
|
|
||||||
return categoryIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCategoryIcon(String categoryIcon) {
|
|
||||||
this.categoryIcon = categoryIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getStartId() {
|
public long getStartId() {
|
||||||
return startId;
|
return startId;
|
||||||
}
|
}
|
||||||
@@ -189,6 +181,22 @@ public class Track implements Parcelable {
|
|||||||
this.tableId = tableId;
|
this.tableId = tableId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getIcon() {
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIcon(String icon) {
|
||||||
|
this.icon = icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TripStatistics getTripStatistics() {
|
||||||
|
return tripStatistics;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTripStatistics(TripStatistics tripStatistics) {
|
||||||
|
this.tripStatistics = tripStatistics;
|
||||||
|
}
|
||||||
|
|
||||||
public void addLocation(Location l) {
|
public void addLocation(Location l) {
|
||||||
locations.add(l);
|
locations.add(l);
|
||||||
}
|
}
|
||||||
@@ -200,12 +208,4 @@ public class Track implements Parcelable {
|
|||||||
public void setLocations(ArrayList<Location> locations) {
|
public void setLocations(ArrayList<Location> locations) {
|
||||||
this.locations = locations;
|
this.locations = locations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TripStatistics getTripStatistics() {
|
|
||||||
return tripStatistics;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTripStatistics(TripStatistics tripStatistics) {
|
|
||||||
this.tripStatistics = tripStatistics;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,12 +20,14 @@ import android.net.Uri;
|
|||||||
import android.provider.BaseColumns;
|
import android.provider.BaseColumns;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants for track table.
|
* Constants for the tracks table.
|
||||||
*
|
*
|
||||||
* @author Leif Hendrik Wilden
|
* @author Leif Hendrik Wilden
|
||||||
*/
|
*/
|
||||||
public interface TracksColumns extends BaseColumns {
|
public interface TracksColumns extends BaseColumns {
|
||||||
|
|
||||||
|
public static final String TABLE_NAME = "tracks";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tracks provider uri.
|
* Tracks provider uri.
|
||||||
*/
|
*/
|
||||||
@@ -47,11 +49,10 @@ public interface TracksColumns extends BaseColumns {
|
|||||||
*/
|
*/
|
||||||
public static final String DEFAULT_SORT_ORDER = "_id";
|
public static final String DEFAULT_SORT_ORDER = "_id";
|
||||||
|
|
||||||
// Tracks table columns
|
// Columns
|
||||||
public static final String NAME = "name"; // track name
|
public static final String NAME = "name"; // track name
|
||||||
public static final String DESCRIPTION = "description"; // track description
|
public static final String DESCRIPTION = "description"; // track description
|
||||||
public static final String CATEGORY = "category"; // track activity type
|
public static final String CATEGORY = "category"; // track activity type
|
||||||
public static final String CATEGORY_ICON = "categoryicon"; // track activity type icon
|
|
||||||
public static final String STARTID = "startid"; // first track point id
|
public static final String STARTID = "startid"; // first track point id
|
||||||
public static final String STOPID = "stopid"; // last track point id
|
public static final String STOPID = "stopid"; // last track point id
|
||||||
public static final String STARTTIME = "starttime"; // track start time
|
public static final String STARTTIME = "starttime"; // track start time
|
||||||
@@ -60,19 +61,109 @@ public interface TracksColumns extends BaseColumns {
|
|||||||
public static final String TOTALDISTANCE = "totaldistance"; // total distance
|
public static final String TOTALDISTANCE = "totaldistance"; // total distance
|
||||||
public static final String TOTALTIME = "totaltime"; // total time
|
public static final String TOTALTIME = "totaltime"; // total time
|
||||||
public static final String MOVINGTIME = "movingtime"; // moving time
|
public static final String MOVINGTIME = "movingtime"; // moving time
|
||||||
|
public static final String MINLAT = "minlat"; // minimum latitude
|
||||||
|
public static final String MAXLAT = "maxlat"; // maximum latitude
|
||||||
|
public static final String MINLON = "minlon"; // minimum longitude
|
||||||
|
public static final String MAXLON = "maxlon"; // maximum longitude
|
||||||
public static final String AVGSPEED = "avgspeed"; // average speed
|
public static final String AVGSPEED = "avgspeed"; // average speed
|
||||||
public static final String AVGMOVINGSPEED = "avgmovingspeed"; // average
|
public static final String AVGMOVINGSPEED = "avgmovingspeed"; // average moving speed
|
||||||
// moving speed
|
|
||||||
public static final String MAXSPEED = "maxspeed"; // maximum speed
|
public static final String MAXSPEED = "maxspeed"; // maximum speed
|
||||||
public static final String MINELEVATION = "minelevation"; // minimum elevation
|
public static final String MINELEVATION = "minelevation"; // minimum elevation
|
||||||
public static final String MAXELEVATION = "maxelevation"; // maximum elevation
|
public static final String MAXELEVATION = "maxelevation"; // maximum elevation
|
||||||
public static final String ELEVATIONGAIN = "elevationgain"; // elevation gain
|
public static final String ELEVATIONGAIN = "elevationgain"; // elevation gain
|
||||||
public static final String MINGRADE = "mingrade"; // minimum grade
|
public static final String MINGRADE = "mingrade"; // minimum grade
|
||||||
public static final String MAXGRADE = "maxgrade"; // maximum grade
|
public static final String MAXGRADE = "maxgrade"; // maximum grade
|
||||||
public static final String MINLAT = "minlat"; // minimum latitude
|
|
||||||
public static final String MAXLAT = "maxlat"; // maximum latitude
|
|
||||||
public static final String MINLON = "minlon"; // minimum longitude
|
|
||||||
public static final String MAXLON = "maxlon"; // maximum longitude
|
|
||||||
public static final String MAPID = "mapid"; // Google Maps id
|
public static final String MAPID = "mapid"; // Google Maps id
|
||||||
public static final String TABLEID = "tableid"; // Google Fusion Tables id
|
public static final String TABLEID = "tableid"; // Google Fusion Tables id
|
||||||
|
public static final String ICON = "icon"; // track activity type icon
|
||||||
|
|
||||||
|
public static final String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + " ("
|
||||||
|
+ _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
|
||||||
|
+ NAME + " STRING, "
|
||||||
|
+ DESCRIPTION + " STRING, "
|
||||||
|
+ CATEGORY + " STRING, "
|
||||||
|
+ STARTID + " INTEGER, "
|
||||||
|
+ STOPID + " INTEGER, "
|
||||||
|
+ STARTTIME + " INTEGER, "
|
||||||
|
+ STOPTIME + " INTEGER, "
|
||||||
|
+ NUMPOINTS + " INTEGER, "
|
||||||
|
+ TOTALDISTANCE + " FLOAT, "
|
||||||
|
+ TOTALTIME + " INTEGER, "
|
||||||
|
+ MOVINGTIME + " INTEGER, "
|
||||||
|
+ MINLAT + " INTEGER, "
|
||||||
|
+ MAXLAT + " INTEGER, "
|
||||||
|
+ MINLON + " INTEGER, "
|
||||||
|
+ MAXLON + " INTEGER, "
|
||||||
|
+ AVGSPEED + " FLOAT, "
|
||||||
|
+ AVGMOVINGSPEED + " FLOAT, "
|
||||||
|
+ MAXSPEED + " FLOAT, "
|
||||||
|
+ MINELEVATION + " FLOAT, "
|
||||||
|
+ MAXELEVATION + " FLOAT, "
|
||||||
|
+ ELEVATIONGAIN + " FLOAT, "
|
||||||
|
+ MINGRADE + " FLOAT, "
|
||||||
|
+ MAXGRADE + " FLOAT, "
|
||||||
|
+ MAPID + " STRING, "
|
||||||
|
+ TABLEID + " STRING, "
|
||||||
|
+ ICON + " STRING"
|
||||||
|
+ ");";
|
||||||
|
|
||||||
|
public static final String[] COLUMNS = {
|
||||||
|
_ID,
|
||||||
|
NAME,
|
||||||
|
DESCRIPTION,
|
||||||
|
CATEGORY,
|
||||||
|
STARTID,
|
||||||
|
STOPID,
|
||||||
|
STARTTIME,
|
||||||
|
STOPTIME,
|
||||||
|
NUMPOINTS,
|
||||||
|
TOTALDISTANCE,
|
||||||
|
TOTALTIME,
|
||||||
|
MOVINGTIME,
|
||||||
|
MINLAT,
|
||||||
|
MAXLAT,
|
||||||
|
MINLON,
|
||||||
|
MAXLON,
|
||||||
|
AVGSPEED,
|
||||||
|
AVGMOVINGSPEED,
|
||||||
|
MAXSPEED,
|
||||||
|
MINELEVATION,
|
||||||
|
MAXELEVATION,
|
||||||
|
ELEVATIONGAIN,
|
||||||
|
MINGRADE,
|
||||||
|
MAXGRADE,
|
||||||
|
MAPID,
|
||||||
|
TABLEID,
|
||||||
|
ICON
|
||||||
|
};
|
||||||
|
|
||||||
|
public static final byte[] COLUMN_TYPES = {
|
||||||
|
ContentTypeIds.LONG_TYPE_ID, // id
|
||||||
|
ContentTypeIds.STRING_TYPE_ID, // name
|
||||||
|
ContentTypeIds.STRING_TYPE_ID, // description
|
||||||
|
ContentTypeIds.STRING_TYPE_ID, // category
|
||||||
|
ContentTypeIds.LONG_TYPE_ID, // start id
|
||||||
|
ContentTypeIds.LONG_TYPE_ID, // stop id
|
||||||
|
ContentTypeIds.LONG_TYPE_ID, // start time
|
||||||
|
ContentTypeIds.LONG_TYPE_ID, // stop time
|
||||||
|
ContentTypeIds.INT_TYPE_ID, // num points
|
||||||
|
ContentTypeIds.FLOAT_TYPE_ID, // total distance
|
||||||
|
ContentTypeIds.LONG_TYPE_ID, // total time
|
||||||
|
ContentTypeIds.LONG_TYPE_ID, // moving time
|
||||||
|
ContentTypeIds.INT_TYPE_ID, // min latitude
|
||||||
|
ContentTypeIds.INT_TYPE_ID, // max latitude
|
||||||
|
ContentTypeIds.INT_TYPE_ID, // min longitude
|
||||||
|
ContentTypeIds.INT_TYPE_ID, // max longitude
|
||||||
|
ContentTypeIds.FLOAT_TYPE_ID, // average speed
|
||||||
|
ContentTypeIds.FLOAT_TYPE_ID, // average moving speed
|
||||||
|
ContentTypeIds.FLOAT_TYPE_ID, // max speed
|
||||||
|
ContentTypeIds.FLOAT_TYPE_ID, // min elevation
|
||||||
|
ContentTypeIds.FLOAT_TYPE_ID, // max elevation
|
||||||
|
ContentTypeIds.FLOAT_TYPE_ID, // elevation gain
|
||||||
|
ContentTypeIds.FLOAT_TYPE_ID, // min grade
|
||||||
|
ContentTypeIds.FLOAT_TYPE_ID, // max grade
|
||||||
|
ContentTypeIds.STRING_TYPE_ID, // map id
|
||||||
|
ContentTypeIds.STRING_TYPE_ID, // table id
|
||||||
|
ContentTypeIds.STRING_TYPE_ID // icon
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user