Merge pull request #8440 from osmandapp/Fix_7694_dismiss_recorded_track
Fix 7694 dismiss recorded track
This commit is contained in:
commit
3913fa345f
3 changed files with 16 additions and 13 deletions
|
@ -11,7 +11,8 @@
|
||||||
Thx - Hardy
|
Thx - Hardy
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<string name="release_3_6">
|
<string name="clear_recorded_data">Clear recorded data</string>
|
||||||
|
<string name="release_3_6">
|
||||||
• Profiles: now you can change order, set icon for map, change all setting for base profiles and restore them back to defaults\n\n
|
• Profiles: now you can change order, set icon for map, change all setting for base profiles and restore them back to defaults\n\n
|
||||||
• Added exit number in the navigation\n\n
|
• Added exit number in the navigation\n\n
|
||||||
• Reworked plugin settings\n\n
|
• Reworked plugin settings\n\n
|
||||||
|
|
|
@ -247,18 +247,18 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
clearRecordedData(warnings.isEmpty());
|
||||||
|
return new SaveGpxResult(warnings, filenames);
|
||||||
|
}
|
||||||
|
|
||||||
if (warnings.isEmpty()) {
|
public void clearRecordedData(boolean isWarningEmpty) {
|
||||||
|
if (isWarningEmpty) {
|
||||||
SQLiteDatabase db = getWritableDatabase();
|
SQLiteDatabase db = getWritableDatabase();
|
||||||
if (db != null) {
|
if (db != null) {
|
||||||
try {
|
try {
|
||||||
if (db.isOpen()) {
|
if (db.isOpen()) {
|
||||||
// remove all from db
|
|
||||||
db.execSQL("DELETE FROM " + TRACK_NAME + " WHERE " + TRACK_COL_DATE + " <= ?", new Object[]{System.currentTimeMillis()}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
db.execSQL("DELETE FROM " + TRACK_NAME + " WHERE " + TRACK_COL_DATE + " <= ?", new Object[]{System.currentTimeMillis()}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
db.execSQL("DELETE FROM " + POINT_NAME + " WHERE " + POINT_COL_DATE + " <= ?", new Object[]{System.currentTimeMillis()}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
db.execSQL("DELETE FROM " + POINT_NAME + " WHERE " + POINT_COL_DATE + " <= ?", new Object[]{System.currentTimeMillis()}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
// delete all
|
|
||||||
// db.execSQL("DELETE FROM " + TRACK_NAME + " WHERE 1 = 1", new Object[] { }); //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
// db.execSQL("DELETE FROM " + POINT_NAME + " WHERE 1 = 1", new Object[] { }); //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
db.close();
|
db.close();
|
||||||
|
@ -274,7 +274,6 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||||
currentTrack.getModifiablePointsToDisplay().clear();
|
currentTrack.getModifiablePointsToDisplay().clear();
|
||||||
currentTrack.getModifiableGpxFile().modifiedTime = System.currentTimeMillis();
|
currentTrack.getModifiableGpxFile().modifiedTime = System.currentTimeMillis();
|
||||||
prepareCurrentTrackForRecording();
|
prepareCurrentTrackForRecording();
|
||||||
return new SaveGpxResult(warnings, filenames);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, GPXFile> collectRecordedData() {
|
public Map<String, GPXFile> collectRecordedData() {
|
||||||
|
|
|
@ -310,6 +310,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
if (app.getSavingTrackHelper().hasDataToSave()) {
|
if (app.getSavingTrackHelper().hasDataToSave()) {
|
||||||
items.add(R.string.save_current_track);
|
items.add(R.string.save_current_track);
|
||||||
|
items.add(R.string.clear_recorded_data);
|
||||||
}
|
}
|
||||||
String[] strings = new String[items.size()];
|
String[] strings = new String[items.size()];
|
||||||
for (int i = 0; i < strings.length; i++) {
|
for (int i = 0; i < strings.length; i++) {
|
||||||
|
@ -326,6 +327,8 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
||||||
if (app.getLocationProvider().checkGPSEnabled(activity)) {
|
if (app.getLocationProvider().checkGPSEnabled(activity)) {
|
||||||
startGPXMonitoring(activity, showTrackSelection);
|
startGPXMonitoring(activity, showTrackSelection);
|
||||||
}
|
}
|
||||||
|
} else if (item == R.string.clear_recorded_data) {
|
||||||
|
app.getSavingTrackHelper().clearRecordedData(true);
|
||||||
} else if(item == R.string.gpx_monitoring_stop) {
|
} else if(item == R.string.gpx_monitoring_stop) {
|
||||||
stopRecording();
|
stopRecording();
|
||||||
} else if(item == R.string.gpx_start_new_segment) {
|
} else if(item == R.string.gpx_start_new_segment) {
|
||||||
|
@ -338,12 +341,12 @@ public class OsmandMonitoringPlugin extends OsmandPlugin {
|
||||||
showIntervalChooseDialog(activity, app.getString(R.string.live_monitoring_interval) + " : %s",
|
showIntervalChooseDialog(activity, app.getString(R.string.live_monitoring_interval) + " : %s",
|
||||||
app.getString(R.string.save_track_to_gpx_globally), SECONDS, MINUTES,
|
app.getString(R.string.save_track_to_gpx_globally), SECONDS, MINUTES,
|
||||||
null, vs, showTrackSelection, new OnClickListener() {
|
null, vs, showTrackSelection, new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
settings.LIVE_MONITORING_INTERVAL.set(vs.value);
|
settings.LIVE_MONITORING_INTERVAL.set(vs.value);
|
||||||
settings.LIVE_MONITORING.set(true);
|
settings.LIVE_MONITORING.set(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (monitoringControl != null) {
|
if (monitoringControl != null) {
|
||||||
monitoringControl.updateInfo(null);
|
monitoringControl.updateInfo(null);
|
||||||
|
|
Loading…
Reference in a new issue