diff --git a/OsmAnd/res/values-de/strings.xml b/OsmAnd/res/values-de/strings.xml
index 5c9a04c476..ea5f242010 100644
--- a/OsmAnd/res/values-de/strings.xml
+++ b/OsmAnd/res/values-de/strings.xml
@@ -2460,8 +2460,13 @@ Abgedeckte Fläche: %1$s x %2$s
max/min
Zurücksetzen
Aufstieg/Abstieg
+ Track Speicherort
+ Tracks können im Rec Ordner oder in Monats- bzw. Tagesordnern gespeichert werden.
+ Aufgezeichnete Tracks im Rec Ordner speichern
Aufgezeichnete Tracks in Monatsordnern speichern
Aufgezeichnete Tracks in nach Aufzeichnungsmonat benannten Unterordnern speichern (z. B. 2018-01).
+ Aufgezeichnete Tracks in Tagesordnern speichern
+ Aufgezeichnete Tracks in nach Aufzeichnungstag benannten Unterordnern speichern (z. B. 2018-01).
Zirkel
%1$d von %2$d
Zeit in Bewegung
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 4f72c5958f..e454ece212 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -11,6 +11,12 @@
Thx - Hardy
-->
+
+ Track Storage Directory
+ Tracks can be stored in rec folder or in monthly or daily folders.
+ Store recorded tracks in rec folder
+ Store recorded tracks in daily folders
+ Store recorded tracks in sub-folders per recording day (like 2018-01-01).
Calculate
OsmAnd Usage
Tiles
diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
index 7285d5835a..1aa1b81f81 100644
--- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java
+++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java
@@ -1494,9 +1494,13 @@ public class OsmandSettings {
SAVE_TRACK_TO_GPX.setModeDefaultValue(ApplicationMode.PEDESTRIAN, false);
}
+ public static final Integer REC_DIRECTORY = 0;
+ public static final Integer MONTHLY_DIRECTORY = 1;
+ public static final Integer DAILY_DIRECTORY = 2;
+
public final CommonPreference DISABLE_RECORDING_ONCE_APP_KILLED = new BooleanPreference("disable_recording_once_app_killed", false).makeGlobal();
- public final CommonPreference STORE_TRACKS_IN_MONTHLY_DIRECTORIES = new BooleanPreference("store_tracks_in_monthly_directories", false).makeGlobal();
+ public final CommonPreference TRACK_STORAGE_DIRECTORY = new IntPreference("track_storage_directory", 0).makeGlobal();
// this value string is synchronized with settings_pref.xml preference name
public final OsmandPreference FAST_ROUTE_MODE = new BooleanPreference("fast_route_mode", true).makeProfile();
diff --git a/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java b/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java
index a8cce1df62..90116408f9 100644
--- a/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java
+++ b/OsmAnd/src/net/osmand/plus/activities/SavingTrackHelper.java
@@ -186,7 +186,7 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
return false;
}
-
+
/**
* @return warnings, filenames
*/
@@ -204,23 +204,25 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
File fout = new File(dir, f + ".gpx"); //$NON-NLS-1$
if (!data.get(f).isEmpty()) {
WptPt pt = data.get(f).findPointToShow();
- File targetDir = dir;
- if (ctx.getSettings().STORE_TRACKS_IN_MONTHLY_DIRECTORIES.get()) {
+ String fileName = f + "_" + new SimpleDateFormat("HH-mm_EEE", Locale.US).format(new Date(pt.time)); //$NON-NLS-1$
+ Integer track_storage_directory = ctx.getSettings().TRACK_STORAGE_DIRECTORY.get();
+ if (track_storage_directory != OsmandSettings.REC_DIRECTORY) {
SimpleDateFormat dateDirFormat = new SimpleDateFormat("yyyy-MM");
+ if (track_storage_directory == OsmandSettings.DAILY_DIRECTORY) {
+ dateDirFormat = new SimpleDateFormat("yyyy-MM-dd");
+ }
String dateDirName = dateDirFormat.format(new Date(pt.time));
File dateDir = new File(dir, dateDirName);
dateDir.mkdirs();
if (dateDir.exists()) {
- targetDir = dateDir;
+ fileName = dateDirName + File.separator + fileName;
}
}
-
- String fileName = f + "_" + new SimpleDateFormat("HH-mm_EEE", Locale.US).format(new Date(pt.time)); //$NON-NLS-1$
filenames.add(fileName);
- fout = new File(targetDir, fileName + ".gpx"); //$NON-NLS-1$
+ fout = new File(dir, fileName + ".gpx"); //$NON-NLS-1$
int ind = 1;
while (fout.exists()) {
- fout = new File(targetDir, fileName + "_" + (++ind) + ".gpx"); //$NON-NLS-1$ //$NON-NLS-2$
+ fout = new File(dir, fileName + "_" + (++ind) + ".gpx"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
diff --git a/OsmAnd/src/net/osmand/plus/monitoring/OnSaveCurrentTrackFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/OnSaveCurrentTrackFragment.java
index e7957ddc02..3704a780d8 100644
--- a/OsmAnd/src/net/osmand/plus/monitoring/OnSaveCurrentTrackFragment.java
+++ b/OsmAnd/src/net/osmand/plus/monitoring/OnSaveCurrentTrackFragment.java
@@ -42,7 +42,7 @@ public class OnSaveCurrentTrackFragment extends BottomSheetDialogFragment {
dismiss();
}
- final File f = new File (app.getAppCustomization().getTracksDir() +"/"+ savedGpxName + ".gpx");
+ final File f = new File (app.getAppCustomization().getTracksDir(), savedGpxName + ".gpx");
final boolean nightMode = !app.getSettings().isLightContent();
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
View mainView = View
diff --git a/OsmAnd/src/net/osmand/plus/monitoring/SettingsMonitoringActivity.java b/OsmAnd/src/net/osmand/plus/monitoring/SettingsMonitoringActivity.java
index 5a7cb43cd4..d65e21418e 100644
--- a/OsmAnd/src/net/osmand/plus/monitoring/SettingsMonitoringActivity.java
+++ b/OsmAnd/src/net/osmand/plus/monitoring/SettingsMonitoringActivity.java
@@ -16,17 +16,21 @@ import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen;
import android.view.Window;
+import static net.osmand.plus.OsmandSettings.DAILY_DIRECTORY;
+import static net.osmand.plus.OsmandSettings.MONTHLY_DIRECTORY;
+import static net.osmand.plus.OsmandSettings.REC_DIRECTORY;
+
public class SettingsMonitoringActivity extends SettingsBaseActivity {
private CheckBoxPreference routeServiceEnabled;
private BroadcastReceiver broadcastReceiver;
-
+
public static final int[] BG_SECONDS = new int[]{0, 30, 60, 90};
public static final int[] BG_MINUTES = new int[]{2, 3, 5, 10, 15, 30, 60, 90};
private static final int[] SECONDS = OsmandMonitoringPlugin.SECONDS;
private static final int[] MINUTES = OsmandMonitoringPlugin.MINUTES;
private static final int[] MAX_INTERVAL_TO_SEND_MINUTES = OsmandMonitoringPlugin.MAX_INTERVAL_TO_SEND_MINUTES;
-
+
public SettingsMonitoringActivity() {
super(true);
}
@@ -39,7 +43,7 @@ public class SettingsMonitoringActivity extends SettingsBaseActivity {
setProgressVisibility(false);
getToolbar().setTitle(R.string.monitoring_settings);
PreferenceScreen grp = getPreferenceScreen();
-
+
createLoggingSection(grp);
createLiveSection(grp);
createNotificationSection(grp);
@@ -87,15 +91,15 @@ public class SettingsMonitoringActivity extends SettingsBaseActivity {
R.string.save_track_to_gpx_descrp));
cat.addPreference(createTimeListPreference(settings.SAVE_TRACK_INTERVAL, SECONDS,
MINUTES, 1000, R.string.save_track_interval, R.string.save_track_interval_descr));
- String[] names;
+ String[] names;
Float[] floatValues;
floatValues = new Float[] {0.f, 2.0f, 5.0f, 10.0f, 20.0f, 30.0f, 50.0f};
names = new String[floatValues.length];
names[0] = getString(R.string.shared_string_not_selected);
for(int i = 1; i < floatValues.length; i++) {
- names[i] = floatValues[i].intValue() + " " + getString(R.string.m);
+ names[i] = floatValues[i].intValue() + " " + getString(R.string.m);
}
- cat.addPreference(createListPreference(settings.SAVE_TRACK_MIN_DISTANCE, names, floatValues,
+ cat.addPreference(createListPreference(settings.SAVE_TRACK_MIN_DISTANCE, names, floatValues,
R.string.save_track_min_distance, R.string.save_track_min_distance_descr));
floatValues = new Float[] {0.f, 1.0f, 2.0f, 5.0f, 10.0f, 15.0f, 20.0f, 50.0f, 100.0f};
names = new String[floatValues.length];
@@ -103,7 +107,7 @@ public class SettingsMonitoringActivity extends SettingsBaseActivity {
for(int i = 1; i < floatValues.length; i++) {
names[i] = floatValues[i].intValue() + " " + getString(R.string.m) + " (" + Math.round(floatValues[i]/0.3048f) + " " + getString(R.string.foot) + ")";
}
- cat.addPreference(createListPreference(settings.SAVE_TRACK_PRECISION, names, floatValues,
+ cat.addPreference(createListPreference(settings.SAVE_TRACK_PRECISION, names, floatValues,
R.string.save_track_precision, R.string.save_track_precision_descr));
floatValues = new Float[] {0.f, 0.000001f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f};
names = new String[floatValues.length];
@@ -113,14 +117,20 @@ public class SettingsMonitoringActivity extends SettingsBaseActivity {
names[i] = floatValues[i].intValue() + " " + getString(R.string.km_h);
floatValues[i] = floatValues[i] / 3.6f;
}
- cat.addPreference(createListPreference(settings.SAVE_TRACK_MIN_SPEED, names, floatValues,
+ cat.addPreference(createListPreference(settings.SAVE_TRACK_MIN_SPEED, names, floatValues,
R.string.save_track_min_speed, R.string.save_track_min_speed_descr));
cat.addPreference(createCheckBoxPreference(settings.AUTO_SPLIT_RECORDING, R.string.auto_split_recording_title,
R.string.auto_split_recording_descr));
cat.addPreference(createCheckBoxPreference(settings.DISABLE_RECORDING_ONCE_APP_KILLED, R.string.disable_recording_once_app_killed,
R.string.disable_recording_once_app_killed_descrp));
- cat.addPreference(createCheckBoxPreference(settings.STORE_TRACKS_IN_MONTHLY_DIRECTORIES, R.string.store_tracks_in_monthly_directories,
- R.string.store_tracks_in_monthly_directories_descrp));
+
+ Integer[] intValues = new Integer[]{REC_DIRECTORY, MONTHLY_DIRECTORY, DAILY_DIRECTORY};
+ names = new String[intValues.length];
+ names[0] = getString(R.string.store_tracks_in_rec_directory);
+ names[1] = getString(R.string.store_tracks_in_monthly_directories);
+ names[2] = getString(R.string.store_tracks_in_daily_directories);
+ cat.addPreference(createListPreference(settings.TRACK_STORAGE_DIRECTORY, names, intValues,
+ R.string.track_storage_directory, R.string.track_storage_directory_descrp));
}
@@ -129,7 +139,7 @@ public class SettingsMonitoringActivity extends SettingsBaseActivity {
cat = new PreferenceCategory(this);
cat.setTitle(R.string.live_monitoring_m);
grp.addPreference(cat);
-
+
cat.addPreference(createEditTextPreference(settings.LIVE_MONITORING_URL, R.string.live_monitoring_url,
R.string.live_monitoring_url_descr));
final CheckBoxPreference liveMonitoring = createCheckBoxPreference(settings.LIVE_MONITORING, R.string.live_monitoring_m,
@@ -154,12 +164,12 @@ public class SettingsMonitoringActivity extends SettingsBaseActivity {
public void updateAllSettings() {
super.updateAllSettings();
-
+
if(routeServiceEnabled != null) {
routeServiceEnabled.setChecked(getMyApplication().getNavigationService() != null);
}
}
-
+
private void saveCurrentTracks(final SavingTrackHelper helper) {
setProgressVisibility(true);
getMyApplication().getTaskManager().runInBackground(new OsmAndTaskRunnable() {
@@ -178,7 +188,7 @@ public class SettingsMonitoringActivity extends SettingsBaseActivity {
}, (Void) null);
}
-
+
@Override
protected void onDestroy() {
super.onDestroy();
@@ -187,7 +197,7 @@ public class SettingsMonitoringActivity extends SettingsBaseActivity {
broadcastReceiver = null;
}
}
-
+