forked from upstream-mirrors/OpenTracks
KMZ import/export: code improved.
This commit is contained in:
@@ -330,7 +330,7 @@ public class KmlTrackWriter implements TrackWriter {
|
||||
* @param heading the heading.
|
||||
*/
|
||||
private void writePhotoOverlay(Waypoint waypoint, float heading) {
|
||||
if (waypoint.getLocation() != null && exportTrackDetail) {
|
||||
if (exportTrackDetail) {
|
||||
printWriter.println("<PhotoOverlay>");
|
||||
printWriter.println("<name>" + StringUtils.formatCData(waypoint.getName()) + "</name>");
|
||||
printWriter.println("<description>" + StringUtils.formatCData(waypoint.getDescription()) + "</description>");
|
||||
|
||||
@@ -27,6 +27,7 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
@@ -46,12 +47,7 @@ public class KmzTrackImporter implements TrackImporter {
|
||||
|
||||
private static final String TAG = KmzTrackImporter.class.getSimpleName();
|
||||
|
||||
public static final List<String> KMZ_IMAGES_EXT = new ArrayList<>();
|
||||
static {
|
||||
KMZ_IMAGES_EXT.add("jpeg");
|
||||
KMZ_IMAGES_EXT.add("jpg");
|
||||
KMZ_IMAGES_EXT.add("png");
|
||||
}
|
||||
public static final List<String> KMZ_IMAGES_EXT = Arrays.asList("jpeg", "jpg", "png");
|
||||
|
||||
private static final int BUFFER_SIZE = 4096;
|
||||
|
||||
@@ -158,10 +154,8 @@ public class KmzTrackImporter implements TrackImporter {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (String ext : KMZ_IMAGES_EXT) {
|
||||
if (fileExt.equals(ext)) {
|
||||
return true;
|
||||
}
|
||||
if (KMZ_IMAGES_EXT.contains(fileExt)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -95,9 +95,9 @@ public class FileUtils {
|
||||
|
||||
/**
|
||||
* Gets the extension from a file name.
|
||||
* Returns null if there is no extension or fileName is null.
|
||||
*
|
||||
* @param fileName the file name
|
||||
* @return null if there is no extension or fileName is null.
|
||||
*/
|
||||
public static String getExtension(String fileName) {
|
||||
if (fileName == null) {
|
||||
|
||||
Reference in New Issue
Block a user