Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2018-01-14 21:40:21 +01:00
commit 434ffd3f29
2 changed files with 5 additions and 7 deletions

View file

@ -10,7 +10,7 @@ public class City extends MapObject {
public enum CityType { public enum CityType {
// that's tricky way to play with that numbers (to avoid including suburbs in city & vice verse) // that's tricky way to play with that numbers (to avoid including suburbs in city & vice verse)
// district special type and it is not registered as a city // district special type and it is not registered as a city
CITY(10000), TOWN(5000), VILLAGE(1300), HAMLET(1000), SUBURB(400), DISTRICT(400), NEIGHBOURHOOD(300); CITY(10000), TOWN(4000), VILLAGE(1300), HAMLET(1000), SUBURB(400), DISTRICT(400), NEIGHBOURHOOD(300);
private double radius; private double radius;

View file

@ -200,25 +200,23 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
File fout = new File(dir, f + ".gpx"); //$NON-NLS-1$ File fout = new File(dir, f + ".gpx"); //$NON-NLS-1$
if (!data.get(f).isEmpty()) { if (!data.get(f).isEmpty()) {
WptPt pt = data.get(f).findPointToShow(); WptPt pt = data.get(f).findPointToShow();
File targetDir = dir;
if (ctx.getSettings().STORE_TRACKS_IN_MONTHLY_DIRECTORIES.get()) { if (ctx.getSettings().STORE_TRACKS_IN_MONTHLY_DIRECTORIES.get()) {
SimpleDateFormat dateDirFormat = new SimpleDateFormat("yyyy-MM"); SimpleDateFormat dateDirFormat = new SimpleDateFormat("yyyy-MM");
dateDirFormat.setTimeZone(TimeZone.getTimeZone("UTC")); dateDirFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
String dateDirName = dateDirFormat.format(new Date(pt.time)); String dateDirName = dateDirFormat.format(new Date(pt.time));
File dateDir = new File(dir, dateDirName); File dateDir = new File(dir, dateDirName);
dateDir.mkdirs(); dateDir.mkdirs();
if (dateDir.exists()) { if (dateDir.exists()) {
dir = dateDir; targetDir = dateDir;
} }
} }
String fileName = f + "_" + new SimpleDateFormat("HH-mm_EEE", Locale.US).format(new Date(pt.time)); //$NON-NLS-1$ String fileName = f + "_" + new SimpleDateFormat("HH-mm_EEE", Locale.US).format(new Date(pt.time)); //$NON-NLS-1$
fout = new File(dir, fileName + ".gpx"); //$NON-NLS-1$ fout = new File(targetDir, fileName + ".gpx"); //$NON-NLS-1$
int ind = 1; int ind = 1;
while (fout.exists()) { while (fout.exists()) {
fout = new File(dir, fileName + "_" + (++ind) + ".gpx"); //$NON-NLS-1$ //$NON-NLS-2$ fout = new File(targetDir, fileName + "_" + (++ind) + ".gpx"); //$NON-NLS-1$ //$NON-NLS-2$
} }
} }