forked from upstream-mirrors/OpenTracks
Removed KMZ export without photos.
This commit is contained in:
@@ -41,45 +41,18 @@ public enum TrackFileFormat {
|
||||
}
|
||||
},
|
||||
|
||||
@Deprecated //TODO Check if we really need this
|
||||
KMZ_WITH_TRACKDETAIL_AND_SENSORDATA("KMZ_WITH_TRACKDETAIL_AND_SENSORDATA") {
|
||||
|
||||
private static final boolean exportPhotos = false;
|
||||
|
||||
@Override
|
||||
public TrackExporter createTrackExporter(@NonNull Context context, @NonNull ContentProviderUtils contentProviderUtils) {
|
||||
KMLTrackExporter exporter = new KMLTrackExporter(context, contentProviderUtils, exportPhotos);
|
||||
return new KMZTrackExporter(context, contentProviderUtils, exporter, exportPhotos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMimeType() {
|
||||
return "application/vnd.google-earth.kmz";
|
||||
}
|
||||
|
||||
public String getExtension() {
|
||||
return "kmz";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean includesPhotos() {
|
||||
return exportPhotos;
|
||||
}
|
||||
},
|
||||
|
||||
KMZ_WITH_TRACKDETAIL_AND_SENSORDATA_AND_PICTURES("KMZ_WITH_TRACKDETAIL_AND_SENSORDATA_AND_PICTURES") {
|
||||
|
||||
private static final boolean exportPhotos = true;
|
||||
|
||||
@Override
|
||||
public TrackExporter createTrackExporter(@NonNull Context context, @NonNull ContentProviderUtils contentProviderUtils) {
|
||||
KMLTrackExporter exporter = new KMLTrackExporter(context, contentProviderUtils, exportPhotos);
|
||||
return new KMZTrackExporter(context, contentProviderUtils, exporter, exportPhotos);
|
||||
return new KMZTrackExporter(context, contentProviderUtils, exportPhotos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMimeType() {
|
||||
return KMZ_WITH_TRACKDETAIL_AND_SENSORDATA.getMimeType();
|
||||
return "application/vnd.google-earth.kmz";
|
||||
}
|
||||
|
||||
public String getExtension() {
|
||||
|
||||
@@ -220,6 +220,10 @@ public class KMLTrackExporter implements TrackExporter {
|
||||
printWriter = null;
|
||||
}
|
||||
|
||||
boolean isExportPhotos() {
|
||||
return exportPhotos;
|
||||
}
|
||||
|
||||
private void writeHeader(List<Track> tracks) {
|
||||
printWriter.println(
|
||||
"""
|
||||
|
||||
@@ -54,14 +54,12 @@ public class KMZTrackExporter implements TrackExporter {
|
||||
private final ContentProviderUtils contentProviderUtils;
|
||||
private final KMLTrackExporter fileTrackExporter;
|
||||
|
||||
private final boolean exportPhotos;
|
||||
private final Context context;
|
||||
|
||||
public KMZTrackExporter(Context context, ContentProviderUtils contentProviderUtils, KMLTrackExporter trackExporter, boolean exportPhotos) {
|
||||
public KMZTrackExporter(Context context, ContentProviderUtils contentProviderUtils, boolean exportPhotos) {
|
||||
this.context = context;
|
||||
this.contentProviderUtils = contentProviderUtils;
|
||||
this.fileTrackExporter = trackExporter;
|
||||
this.exportPhotos = exportPhotos;
|
||||
this.fileTrackExporter = new KMLTrackExporter(context, contentProviderUtils, exportPhotos);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -79,7 +77,7 @@ public class KMZTrackExporter implements TrackExporter {
|
||||
}
|
||||
|
||||
// Add photos
|
||||
if (exportPhotos) addImages(context, tracks ,zipOutputStream);
|
||||
if (fileTrackExporter.isExportPhotos()) addImages(context, tracks ,zipOutputStream);
|
||||
return true;
|
||||
} catch (InterruptedException | IOException e) {
|
||||
Log.e(TAG, "Unable to write track", e);
|
||||
|
||||
Reference in New Issue
Block a user