Fix kmz file import
This commit is contained in:
parent
9fd029b089
commit
48dbb64d09
1 changed files with 24 additions and 14 deletions
|
@ -71,6 +71,7 @@ import java.util.ArrayList;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
|
@ -314,7 +315,9 @@ public class ImportHelper {
|
|||
} else if (fileName != null && fileName.endsWith(KMZ_SUFFIX)) {
|
||||
try {
|
||||
zis = new ZipInputStream(is);
|
||||
zis.getNextEntry();
|
||||
ZipEntry entry;
|
||||
while ((entry = zis.getNextEntry()) != null) {
|
||||
if (entry.getName().endsWith(KML_SUFFIX)) {
|
||||
final String result = Kml2Gpx.toGpx(zis);
|
||||
if (result != null) {
|
||||
try {
|
||||
|
@ -323,6 +326,8 @@ public class ImportHelper {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
@ -418,7 +423,10 @@ public class ImportHelper {
|
|||
is = app.getContentResolver().openInputStream(kmzFile);
|
||||
if (is != null) {
|
||||
zis = new ZipInputStream(is);
|
||||
zis.getNextEntry();
|
||||
|
||||
ZipEntry entry;
|
||||
while ((entry = zis.getNextEntry()) != null) {
|
||||
if (entry.getName().endsWith(KML_SUFFIX)) {
|
||||
final String result = Kml2Gpx.toGpx(zis);
|
||||
if (result != null) {
|
||||
try {
|
||||
|
@ -428,6 +436,8 @@ public class ImportHelper {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
} finally {
|
||||
|
|
Loading…
Reference in a new issue