mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-10 13:13:05 +02:00
extract logic for creating DocumentFile for export to align naming
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package de.dennisguse.opentracks.io.file;
|
||||
|
||||
import androidx.documentfile.provider.DocumentFile;
|
||||
|
||||
import de.dennisguse.opentracks.content.data.Track;
|
||||
|
||||
public class ExportFile {
|
||||
|
||||
public static DocumentFile getExportDocumentFile(Track.Id trackId, String trackFileFormatExtension, DocumentFile directory, String mimeType) {
|
||||
String fileName = getExportFileNameByTrackId(trackId, trackFileFormatExtension);
|
||||
DocumentFile file = directory.findFile(fileName);
|
||||
if (file == null) {
|
||||
file = directory.createFile(mimeType, fileName);
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
private static String getExportFileNameByTrackId(Track.Id trackId, String trackFileFormatExtension) {
|
||||
return trackId.getId() + "." + trackFileFormatExtension;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package de.dennisguse.opentracks.io.file;
|
||||
|
||||
import de.dennisguse.opentracks.content.data.Track;
|
||||
|
||||
public class ExportFileName {
|
||||
|
||||
public static String getExportFileNameByTrackId(Track.Id trackId, String trackFileFormatExtension) {
|
||||
return trackId.getId() + "." + trackFileFormatExtension;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user