Skip to content

Commit

Permalink
Update to v2.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Graziano Capelli authored and Graziano Capelli committed Mar 10, 2017
1 parent 612cd6b commit b5a66d7
Show file tree
Hide file tree
Showing 56 changed files with 462 additions and 320 deletions.
Binary file added apk/GPSLogger-2.1.4.apk
Binary file not shown.
Binary file modified apk/GPSLogger-latest.apk
Binary file not shown.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "eu.basicairdata.graziano.gpslogger"
minSdkVersion 8
targetSdkVersion 23
versionCode 14
versionName '2.1.3'
versionCode 15
versionName '2.1.4'
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,10 @@ public void addLocationToTrack(LocationExtended location, Track track) {
locvalues.put(KEY_LOCATION_NUMBER, track.getNumberOfLocations());
locvalues.put(KEY_LOCATION_LATITUDE, loc.getLatitude());
locvalues.put(KEY_LOCATION_LONGITUDE, loc.getLongitude());
locvalues.put(KEY_LOCATION_ALTITUDE, loc.getAltitude());
locvalues.put(KEY_LOCATION_SPEED, loc.getSpeed());
locvalues.put(KEY_LOCATION_ACCURACY, loc.getAccuracy());
locvalues.put(KEY_LOCATION_BEARING, loc.getBearing());
locvalues.put(KEY_LOCATION_ALTITUDE, loc.hasAltitude() ? loc.getAltitude() : NOT_AVAILABLE);
locvalues.put(KEY_LOCATION_SPEED, loc.hasSpeed() ? loc.getSpeed() : NOT_AVAILABLE);
locvalues.put(KEY_LOCATION_ACCURACY, loc.hasAccuracy() ? loc.getAccuracy() : NOT_AVAILABLE);
locvalues.put(KEY_LOCATION_BEARING, loc.hasBearing() ? loc.getBearing() : NOT_AVAILABLE);
locvalues.put(KEY_LOCATION_TIME, loc.getTime());
locvalues.put(KEY_LOCATION_NUMBEROFSATELLITES, location.getNumberOfSatellites());
locvalues.put(KEY_LOCATION_TYPE, LOCATION_TYPE_LOCATION);
Expand Down Expand Up @@ -330,6 +330,7 @@ public void addLocationToTrack(LocationExtended location, Track track) {
new String[] { String.valueOf(track.getId()) }); // Update the corresponding Track
db.setTransactionSuccessful();
db.endTransaction();

//Log.w("myApp", "[#] DatabaseHandler.java - addLocation: Location " + track.getNumberOfLocations() + " added into track " + track.getID());
}

Expand All @@ -345,10 +346,10 @@ public void addPlacemarkToTrack(LocationExtended placemark, Track track) {
locvalues.put(KEY_LOCATION_NUMBER, track.getNumberOfPlacemarks());
locvalues.put(KEY_LOCATION_LATITUDE, loc.getLatitude());
locvalues.put(KEY_LOCATION_LONGITUDE, loc.getLongitude());
locvalues.put(KEY_LOCATION_ALTITUDE, loc.getAltitude());
locvalues.put(KEY_LOCATION_SPEED, loc.getSpeed());
locvalues.put(KEY_LOCATION_ACCURACY, loc.getAccuracy());
locvalues.put(KEY_LOCATION_BEARING, loc.getBearing());
locvalues.put(KEY_LOCATION_ALTITUDE, loc.hasAltitude() ? loc.getAltitude() : NOT_AVAILABLE);
locvalues.put(KEY_LOCATION_SPEED, loc.hasSpeed() ? loc.getSpeed() : NOT_AVAILABLE);
locvalues.put(KEY_LOCATION_ACCURACY, loc.hasAccuracy() ? loc.getAccuracy() : NOT_AVAILABLE);
locvalues.put(KEY_LOCATION_BEARING, loc.hasBearing() ? loc.getBearing() : NOT_AVAILABLE);
locvalues.put(KEY_LOCATION_TIME, loc.getTime());
locvalues.put(KEY_LOCATION_NUMBEROFSATELLITES, placemark.getNumberOfSatellites());
locvalues.put(KEY_LOCATION_TYPE, LOCATION_TYPE_PLACEMARK);
Expand Down Expand Up @@ -416,6 +417,7 @@ public void addPlacemarkToTrack(LocationExtended placemark, Track track) {
new String[] { String.valueOf(track.getId()) }); // Update the corresponding Track
db.setTransactionSuccessful();
db.endTransaction();

//Log.w("myApp", "[#] DatabaseHandler.java - addLocation: Location " + track.getNumberOfLocations() + " added into track " + track.getID());
}

Expand All @@ -424,6 +426,8 @@ public void addPlacemarkToTrack(LocationExtended placemark, Track track) {
public LocationExtended getLocation(long id) {
SQLiteDatabase db = this.getWritableDatabase();
LocationExtended extdloc = null;
double lcdata_double;
float lcdata_float;

Cursor cursor = db.query(TABLE_LOCATIONS, new String[] {KEY_ID,
KEY_LOCATION_LATITUDE,
Expand All @@ -442,53 +446,35 @@ public LocationExtended getLocation(long id) {
Location lc = new Location("DB");
lc.setLatitude(cursor.getDouble(1));
lc.setLongitude(cursor.getDouble(2));
lc.setAltitude(cursor.getDouble(3));
lc.setSpeed(cursor.getFloat(4));
lc.setAccuracy(cursor.getFloat(5));
lc.setBearing(cursor.getFloat(6));
lc.setTime(cursor.getLong(7));

extdloc = new LocationExtended(lc);
extdloc.setNumberOfSatellites(cursor.getInt(8));
extdloc.setNumberOfSatellitesUsedInFix(cursor.getInt(9));

cursor.close();
}
return extdloc != null ? extdloc : null;
}


// Get single Location: NOT USED, TO BE REVIEWED WHEN USEFUL
/*
public LocationExtended getLocation(long TrackID, long locationNumber) {
SQLiteDatabase db = this.getWritableDatabase();
LocationExtended extdloc = null;
lcdata_double = cursor.getDouble(3);
if (lcdata_double != NOT_AVAILABLE) lc.setAltitude(lcdata_double);
//else lc.removeAltitude();

String selectQuery = "SELECT * FROM " + TABLE_LOCATIONS + " WHERE "
+ KEY_TRACK_ID + " = " + TrackID + " AND "
+ KEY_LOCATION_NUMBER + " = " + locationNumber;
lcdata_float = cursor.getFloat(4);
if (lcdata_float != NOT_AVAILABLE) lc.setSpeed(lcdata_float);
//else lc.removeSpeed();

Cursor cursor = db.rawQuery(selectQuery, null);
lcdata_float = cursor.getFloat(5);
if (lcdata_float != NOT_AVAILABLE) lc.setAccuracy(lcdata_float);
//else lc.removeAccuracy();

if (cursor != null) {
cursor.moveToFirst();
lcdata_float = cursor.getFloat(6);
if (lcdata_float != NOT_AVAILABLE) lc.setBearing(lcdata_float);
//else lc.removeBearing();

Location lc = new Location("DB");
lc.setLatitude(cursor.getDouble(1));
lc.setLongitude(cursor.getDouble(2));
lc.setAltitude(cursor.getDouble(3));
lc.setSpeed(cursor.getFloat(4));
lc.setAccuracy(cursor.getFloat(5));
lc.setBearing(cursor.getFloat(6));
lc.setTime(cursor.getLong(7));


extdloc = new LocationExtended(lc);
extdloc.setNumberOfSatellites(cursor.getInt(8));
extdloc.setNumberOfSatellitesUsedInFix(cursor.getInt(9));

cursor.close();
}
return extdloc != null ? extdloc : null;
} */
}



// Getting a list of Locations associated to a specified track, with number between startNumber and endNumber
Expand All @@ -506,6 +492,8 @@ public List<LocationExtended> getLocationsList(long TrackID, long startNumber, l

SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
double lcdata_double;
float lcdata_float;

if (cursor != null) {
// looping through all rows and adding to list
Expand All @@ -514,10 +502,23 @@ public List<LocationExtended> getLocationsList(long TrackID, long startNumber, l
Location lc = new Location("DB");
lc.setLatitude(cursor.getDouble(3));
lc.setLongitude(cursor.getDouble(4));
lc.setAltitude(cursor.getDouble(5));
lc.setSpeed(cursor.getFloat(6));
lc.setAccuracy(cursor.getFloat(7));
lc.setBearing(cursor.getFloat(8));

lcdata_double = cursor.getDouble(5);
if (lcdata_double != NOT_AVAILABLE) lc.setAltitude(lcdata_double);
//else lc.removeAltitude();

lcdata_float = cursor.getFloat(6);
if (lcdata_float != NOT_AVAILABLE) lc.setSpeed(lcdata_float);
//else lc.removeSpeed();

lcdata_float = cursor.getFloat(7);
if (lcdata_float != NOT_AVAILABLE) lc.setAccuracy(lcdata_float);
//else lc.removeAccuracy();

lcdata_float = cursor.getFloat(8);
if (lcdata_float != NOT_AVAILABLE) lc.setBearing(lcdata_float);
//else lc.removeBearing();

lc.setTime(cursor.getLong(9));

LocationExtended extdloc = new LocationExtended(lc);
Expand Down Expand Up @@ -547,6 +548,8 @@ public List<LocationExtended> getPlacemarksList(long TrackID, long startNumber,

SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
double lcdata_double;
float lcdata_float;

if (cursor != null) {
// looping through all rows and adding to list
Expand All @@ -555,10 +558,23 @@ public List<LocationExtended> getPlacemarksList(long TrackID, long startNumber,
Location lc = new Location("DB");
lc.setLatitude(cursor.getDouble(3));
lc.setLongitude(cursor.getDouble(4));
lc.setAltitude(cursor.getDouble(5));
lc.setSpeed(cursor.getFloat(6));
lc.setAccuracy(cursor.getFloat(7));
lc.setBearing(cursor.getFloat(8));

lcdata_double = cursor.getDouble(5);
if (lcdata_double != NOT_AVAILABLE) lc.setAltitude(lcdata_double);
//else lc.removeAltitude();

lcdata_float = cursor.getFloat(6);
if (lcdata_float != NOT_AVAILABLE) lc.setSpeed(lcdata_float);
//else lc.removeSpeed();

lcdata_float = cursor.getFloat(7);
if (lcdata_float != NOT_AVAILABLE) lc.setAccuracy(lcdata_float);
//else lc.removeAccuracy();

lcdata_float = cursor.getFloat(8);
if (lcdata_float != NOT_AVAILABLE) lc.setBearing(lcdata_float);
//else lc.removeBearing();

lc.setTime(cursor.getLong(9));

LocationExtended extdloc = new LocationExtended(lc);
Expand Down Expand Up @@ -671,7 +687,7 @@ public void DeleteTrack(long TrackID) {
new String[] { String.valueOf(TrackID) }); // Delete track
db.setTransactionSuccessful();
db.endTransaction();
//db.close(); // Closing database connection

//Log.w("myApp", "[#] DatabaseHandler.java - addLocation: Location " + track.getNumberOfLocations() + " added into track " + track.getID());
}

Expand Down Expand Up @@ -739,7 +755,6 @@ public long addTrack(Track track) {
long TrackID;
// Inserting Row
TrackID = (db.insert(TABLE_TRACKS, null, trkvalues));
//db.close(); // Closing database connection

//Log.w("myApp", "[#] DatabaseHandler.java - addTrack " + TrackID);

Expand Down Expand Up @@ -848,6 +863,7 @@ public long getLastTrackID() {
return result;
}


// Get last TrackID
public Track getLastTrack() {
return getTrack(getLastTrackID());
Expand Down
Loading

0 comments on commit b5a66d7

Please sign in to comment.