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