aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/export/GpxExport.java
diff options
context:
space:
mode:
authorBananeweizen <Bananeweizen@gmx.de>2013-07-28 17:46:09 +0200
committerBananeweizen <Bananeweizen@gmx.de>2013-07-28 17:49:09 +0200
commit51e61f7b36a731ce7ed4087fbe38642687be0321 (patch)
tree418cc9b91f0b66df0141bd0a68a370afaee03abc /main/src/cgeo/geocaching/export/GpxExport.java
parent77e7e33e8956fa00b6e7f43be6c51177f4b6cf5b (diff)
downloadcgeo-51e61f7b36a731ce7ed4087fbe38642687be0321.zip
cgeo-51e61f7b36a731ce7ed4087fbe38642687be0321.tar.gz
cgeo-51e61f7b36a731ce7ed4087fbe38642687be0321.tar.bz2
change: make gpx export name more readable
* use only date instead of date and time * format date using dashes * append _2, _3, ... with further exports
Diffstat (limited to 'main/src/cgeo/geocaching/export/GpxExport.java')
-rw-r--r--main/src/cgeo/geocaching/export/GpxExport.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/export/GpxExport.java b/main/src/cgeo/geocaching/export/GpxExport.java
index 61be3c5..c31b1ae 100644
--- a/main/src/cgeo/geocaching/export/GpxExport.java
+++ b/main/src/cgeo/geocaching/export/GpxExport.java
@@ -1,11 +1,12 @@
package cgeo.geocaching.export;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.settings.Settings;
import cgeo.geocaching.R;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.activity.ActivityMixin;
+import cgeo.geocaching.settings.Settings;
import cgeo.geocaching.utils.AsyncTaskWithProgress;
+import cgeo.geocaching.utils.FileUtils;
import cgeo.geocaching.utils.Log;
import android.app.Activity;
@@ -106,6 +107,12 @@ class GpxExport extends AbstractExport {
this.activity = activity;
}
+ private File getExportFile() {
+ final SimpleDateFormat fileNameDateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
+ final Date now = new Date();
+ return FileUtils.getUniqueNamedFile(Settings.getGpxExportDir() + File.separatorChar + "export_" + fileNameDateFormat.format(now) + ".gpx");
+ }
+
@Override
protected File doInBackgroundInternal(String[] geocodes) {
// quick check for being able to write the GPX file
@@ -117,8 +124,7 @@ class GpxExport extends AbstractExport {
setMessage(cgeoapplication.getInstance().getResources().getQuantityString(R.plurals.cache_counts, allGeocodes.size(), allGeocodes.size()));
- final SimpleDateFormat fileNameDateFormat = new SimpleDateFormat("yyyyMMddHHmmss", Locale.US);
- final File exportFile = new File(Settings.getGpxExportDir() + File.separatorChar + "export_" + fileNameDateFormat.format(new Date()) + ".gpx");
+ final File exportFile = getExportFile();
BufferedWriter writer = null;
try {
final File exportLocation = new File(Settings.getGpxExportDir());