From 24830e7b609d6dbd7aab9313e89fe825554eb9bc Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Fri, 18 Nov 2016 15:43:00 +0300 Subject: [PATCH] Fix crash while map downloading --- .../src/net/osmand/plus/activities/LocalIndexInfo.java | 3 +-- .../osmand/plus/download/ui/LocalIndexesFragment.java | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/LocalIndexInfo.java b/OsmAnd/src/net/osmand/plus/activities/LocalIndexInfo.java index 8c4a64bfdf..2d722d0691 100644 --- a/OsmAnd/src/net/osmand/plus/activities/LocalIndexInfo.java +++ b/OsmAnd/src/net/osmand/plus/activities/LocalIndexInfo.java @@ -60,8 +60,7 @@ public class LocalIndexInfo { } // Special domain object represents category - public LocalIndexInfo(@NonNull LocalIndexType type, boolean backup, @NonNull String subfolder, - @NonNull OsmandApplication app) { + public LocalIndexInfo(@NonNull LocalIndexType type, boolean backup, @NonNull String subfolder) { this.type = type; backupedData = backup; this.subfolder = subfolder; diff --git a/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java index dea2ebc2d7..e759bfad4f 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/LocalIndexesFragment.java @@ -342,7 +342,9 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement @Override public void loadFile(LocalIndexInfo... loaded) { - publishProgress(loaded); + if (!isCancelled()) { + publishProgress(loaded); + } } @Override @@ -853,8 +855,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement return i; } } - LocalIndexInfo newCat = new LocalIndexInfo(val.getType(), backuped, val.getSubfolder(), - getMyApplication()); + LocalIndexInfo newCat = new LocalIndexInfo(val.getType(), backuped, val.getSubfolder()); category.add(newCat); data.put(newCat, new ArrayList()); return newCat; @@ -931,8 +932,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement } if (found == -1) { found = category.size(); - category.add(new LocalIndexInfo(info.getType(), info.isBackupedData(), - info.getSubfolder(), getMyApplication())); + category.add(new LocalIndexInfo(info.getType(), info.isBackupedData(), info.getSubfolder())); } if (!data.containsKey(category.get(found))) { data.put(category.get(found), new ArrayList());