diff options
author | Bananeweizen <bananeweizen@gmx.de> | 2011-12-12 21:51:40 +0100 |
---|---|---|
committer | Bananeweizen <bananeweizen@gmx.de> | 2011-12-12 21:51:40 +0100 |
commit | 774b9b157709fc0a3948b2d2677a7d45541db3de (patch) | |
tree | c4af7bd68df87bb40c9d6d280c2bc7fc2c298c25 /main/src/cgeo/geocaching/cgeogpxes.java | |
parent | e7777b9cf8e7970213602c5cda5fdf9c93069c78 (diff) | |
download | cgeo-774b9b157709fc0a3948b2d2677a7d45541db3de.zip cgeo-774b9b157709fc0a3948b2d2677a7d45541db3de.tar.gz cgeo-774b9b157709fc0a3948b2d2677a7d45541db3de.tar.bz2 |
new: accept OpenCaching zipped GPX files in import
Diffstat (limited to 'main/src/cgeo/geocaching/cgeogpxes.java')
-rw-r--r-- | main/src/cgeo/geocaching/cgeogpxes.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/main/src/cgeo/geocaching/cgeogpxes.java b/main/src/cgeo/geocaching/cgeogpxes.java index 7fdc031..8cd9968 100644 --- a/main/src/cgeo/geocaching/cgeogpxes.java +++ b/main/src/cgeo/geocaching/cgeogpxes.java @@ -1,5 +1,7 @@ package cgeo.geocaching; +import cgeo.geocaching.connector.ConnectorFactory; +import cgeo.geocaching.connector.IConnector; import cgeo.geocaching.files.FileList; import cgeo.geocaching.files.GPXImporter; @@ -12,13 +14,10 @@ import android.os.Environment; import java.io.File; import java.util.List; -import java.util.regex.Pattern; public class cgeogpxes extends FileList<cgGPXListAdapter> { private static final String EXTRAS_LIST_ID = "list"; - private static final Pattern gpxZipFilePattern = Pattern.compile("\\d{7,}(_.+)?\\.zip", Pattern.CASE_INSENSITIVE); - public cgeogpxes() { super(new String[] { "gpx", "loc", "zip" }); } @@ -63,7 +62,12 @@ public class cgeogpxes extends FileList<cgGPXListAdapter> { protected boolean filenameBelongsToList(final String filename) { if (super.filenameBelongsToList(filename)) { if (StringUtils.endsWithIgnoreCase(filename, GPXImporter.ZIP_FILE_EXTENSION)) { - return gpxZipFilePattern.matcher(filename).matches(); + for (IConnector connector : ConnectorFactory.getConnectors()) { + if (connector.isZippedGPXFile(filename)) { + return true; + } + } + return false; } // filter out waypoint files return !StringUtils.endsWithIgnoreCase(filename, GPXImporter.WAYPOINTS_FILE_SUFFIX_AND_EXTENSION); |