Squash: load TrackPoint elevationGain.

This commit is contained in:
Román
2020-09-03 14:55:12 +02:00
committed by Dennis Guse
parent 577b9b4635
commit fe3bf61acb
3 changed files with 8 additions and 0 deletions
@@ -19,6 +19,7 @@ class CachedTrackPointsIndexes {
final int sensorHeartRateIndex; final int sensorHeartRateIndex;
final int sensorCadenceIndex; final int sensorCadenceIndex;
final int sensorPowerIndex; final int sensorPowerIndex;
final int elevationGainIndex;
CachedTrackPointsIndexes(Cursor cursor) { CachedTrackPointsIndexes(Cursor cursor) {
idIndex = cursor.getColumnIndex(TrackPointsColumns._ID); idIndex = cursor.getColumnIndex(TrackPointsColumns._ID);
@@ -32,5 +33,6 @@ class CachedTrackPointsIndexes {
sensorHeartRateIndex = cursor.getColumnIndexOrThrow(TrackPointsColumns.SENSOR_HEARTRATE); sensorHeartRateIndex = cursor.getColumnIndexOrThrow(TrackPointsColumns.SENSOR_HEARTRATE);
sensorCadenceIndex = cursor.getColumnIndexOrThrow(TrackPointsColumns.SENSOR_CADENCE); sensorCadenceIndex = cursor.getColumnIndexOrThrow(TrackPointsColumns.SENSOR_CADENCE);
sensorPowerIndex = cursor.getColumnIndexOrThrow(TrackPointsColumns.SENSOR_POWER); sensorPowerIndex = cursor.getColumnIndexOrThrow(TrackPointsColumns.SENSOR_POWER);
elevationGainIndex = cursor.getColumnIndexOrThrow(TrackPointsColumns.ELEVATION_GAIN);
} }
} }
@@ -648,6 +648,10 @@ public class ContentProviderUtils {
trackPoint.setPower(cursor.getFloat(indexes.sensorPowerIndex)); trackPoint.setPower(cursor.getFloat(indexes.sensorPowerIndex));
} }
if (!cursor.isNull(indexes.elevationGainIndex)) {
trackPoint.setElevationGain(cursor.getFloat(indexes.elevationGainIndex));
}
return trackPoint; return trackPoint;
} }
@@ -215,6 +215,8 @@ public class CustomSQLiteOpenHelper extends SQLiteOpenHelper {
db.execSQL("INSERT INTO trackpoints SELECT _id, trackid, longitude, latitude, time, elevation, accuracy, speed, bearing, sensor_heartrate, sensor_cadence, sensor_power FROM trackpoints_old"); db.execSQL("INSERT INTO trackpoints SELECT _id, trackid, longitude, latitude, time, elevation, accuracy, speed, bearing, sensor_heartrate, sensor_cadence, sensor_power FROM trackpoints_old");
db.execSQL("DROP TABLE trackpoints_old"); db.execSQL("DROP TABLE trackpoints_old");
db.execSQL("CREATE INDEX trackpoints_trackid_index ON trackpoints(trackid)");
db.setTransactionSuccessful(); db.setTransactionSuccessful();
db.endTransaction(); db.endTransaction();
} }