From 5f00430795937ec7207b9faa1e7f24c8cd82fdf8 Mon Sep 17 00:00:00 2001 From: Jimmy Shih Date: Fri, 4 Oct 2013 15:22:21 -0700 Subject: [PATCH] Code cleanup: cleanup callers of FileUtils.buildUniqueFileName --- MyTracks/res/values/strings.xml | 4 -- .../apps/mytracks/TrackDetailActivity.java | 40 +++++++------------ .../io/file/exporter/SaveAsyncTask.java | 10 +---- 3 files changed, 16 insertions(+), 38 deletions(-) diff --git a/MyTracks/res/values/strings.xml b/MyTracks/res/values/strings.xml index d4533c632..1fe178933 100644 --- a/MyTracks/res/values/strings.xml +++ b/MyTracks/res/values/strings.xml @@ -1008,10 +1008,6 @@ limitations under the License. translation_description="When deleting multiple markers, the confirmation message."> All markers for this track will be permanently deleted from the device. - - Unable to insert a photo marker. Try again. - { if (tracks.length == 0) { return false; } + Track track = tracks[0]; boolean useKmz = trackFileFormat == TrackFileFormat.KML && !playTrack; String extension = useKmz ? KmzTrackExporter.KMZ_EXTENSION : trackFileFormat.getExtension(); - - // Make sure the file doesn't exist yet (possibly by changing the filename) - String fileName = FileUtils.buildUniqueFileName(directory, track.getName(), extension); - if (fileName == null) { - Log.d(TAG, "Unable to get a unique filename for " + track.getName()); - return false; - } - FileTrackExporter fileTrackExporter = new FileTrackExporter(myTracksProviderUtils, tracks, trackFileFormat.newTrackWriter(context, playTrack), new TrackExporterListener() { @@ -212,6 +205,7 @@ public class SaveAsyncTask extends AsyncTask { trackExporter = useKmz ? new KmzTrackExporter(myTracksProviderUtils, fileTrackExporter, tracks) : fileTrackExporter; + String fileName = FileUtils.buildUniqueFileName(directory, track.getName(), extension); File file = new File(directory, fileName); FileOutputStream fileOutputStream = null; try {