diff options
Diffstat (limited to 'main/src/cgeo/geocaching/files/GPXImporter.java')
-rw-r--r-- | main/src/cgeo/geocaching/files/GPXImporter.java | 36 |
1 files changed, 5 insertions, 31 deletions
diff --git a/main/src/cgeo/geocaching/files/GPXImporter.java b/main/src/cgeo/geocaching/files/GPXImporter.java index 1bb3c3f..8369161 100644 --- a/main/src/cgeo/geocaching/files/GPXImporter.java +++ b/main/src/cgeo/geocaching/files/GPXImporter.java @@ -9,7 +9,6 @@ import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.activity.IAbstractActivity;
import cgeo.geocaching.activity.Progress;
import cgeo.geocaching.enumerations.LoadFlags;
-import cgeo.geocaching.enumerations.LoadFlags.SaveFlag;
import cgeo.geocaching.utils.CancellableHandler;
import cgeo.geocaching.utils.Log;
@@ -32,7 +31,6 @@ import java.io.InputStream; import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import java.util.EnumSet;
import java.util.List;
import java.util.concurrent.CancellationException;
import java.util.zip.ZipEntry;
@@ -42,7 +40,6 @@ public class GPXImporter { static final int IMPORT_STEP_START = 0;
static final int IMPORT_STEP_READ_FILE = 1;
static final int IMPORT_STEP_READ_WPT_FILE = 2;
- static final int IMPORT_STEP_STORE_CACHES = 3;
static final int IMPORT_STEP_STORE_STATIC_MAPS = 4;
static final int IMPORT_STEP_FINISHED = 5;
static final int IMPORT_STEP_FINISHED_WITH_ERROR = 6;
@@ -139,11 +136,13 @@ public class GPXImporter { try {
importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_START));
caches = doImport();
-
- importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_STORE_CACHES, R.string.gpx_import_storing, caches.size()));
- SearchResult search = storeParsedCaches(caches);
Log.i("Imported successfully " + caches.size() + " caches.");
+ final SearchResult search = new SearchResult();
+ for (cgCache cache : caches) {
+ search.addCache(cache);
+ }
+
if (Settings.isStoreOfflineMaps() || Settings.isStoreOfflineWpMaps()) {
importStepHandler.sendMessage(importStepHandler.obtainMessage(IMPORT_STEP_STORE_STATIC_MAPS, R.string.gpx_import_store_static_maps, search.getCount()));
boolean finishedWithoutCancel = importStaticMaps(search);
@@ -171,24 +170,6 @@ public class GPXImporter { protected abstract Collection<cgCache> doImport() throws IOException, ParserException;
- private SearchResult storeParsedCaches(Collection<cgCache> caches) {
- final SearchResult search = new SearchResult();
- final cgeoapplication app = cgeoapplication.getInstance();
- int storedCaches = 0;
- for (cgCache cache : caches) {
- search.addCache(cache);
- if (app.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB))) {
- storedCaches++;
- }
-
- if (progressHandler.isCancelled()) {
- throw new CancellationException();
- }
- progressHandler.sendMessage(progressHandler.obtainMessage(0, storedCaches, 0));
- }
- return search;
- }
-
private boolean importStaticMaps(final SearchResult importedCaches) {
final cgeoapplication app = cgeoapplication.getInstance();
int storedCacheMaps = 0;
@@ -398,13 +379,6 @@ public class GPXImporter { progress.setMaxProgressAndReset(msg.arg2);
break;
- case IMPORT_STEP_STORE_CACHES:
- progress.setProgressDivider(1);
- progress.setMessage(res.getString(msg.arg1));
- progress.setMaxProgressAndReset(msg.arg2);
- showProgressAfterCancel = true;
- break;
-
case IMPORT_STEP_STORE_STATIC_MAPS:
progress.dismiss();
Message skipMessage = importStepHandler.obtainMessage(IMPORT_STEP_STATIC_MAPS_SKIPPED, msg.arg2, 0);
|