From c329e2bedf4412aec97aec0160856f9c54187b5e Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Mon, 23 Nov 2015 11:05:44 +0300 Subject: [PATCH] Fixes --- .../osmand/plus/download/DownloadIndexesThread.java | 4 ++-- .../net/osmand/plus/download/DownloadResources.java | 1 + .../controllers/MapDataMenuController.java | 11 ++++++----- .../mapcontextmenu/other/MapMultiSelectionMenu.java | 2 ++ 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java index 0036014865..1db4323b75 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java @@ -299,6 +299,7 @@ public class DownloadIndexesThread { currentRunningTask.add(this); super.onPreExecute(); this.message = ctx.getString(R.string.downloading_list_indexes); + indexes.downloadFromInternetFailed = false; } @Override @@ -323,10 +324,9 @@ public class DownloadIndexesThread { protected void onPostExecute(DownloadResources result) { indexes = result; + result.downloadFromInternetFailed = !result.isDownloadedFromInternet; if (result.mapVersionIsIncreased) { showWarnDialog(); - } else if (!result.isDownloadedFromInternet) { - AccessibleToast.makeText(ctx, R.string.list_index_files_was_not_loaded, Toast.LENGTH_LONG).show(); } currentRunningTask.remove(this); newDownloadIndexes(); diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadResources.java b/OsmAnd/src/net/osmand/plus/download/DownloadResources.java index 801317e71d..e0ec27d64a 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadResources.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadResources.java @@ -19,6 +19,7 @@ import java.util.Map; public class DownloadResources extends DownloadResourceGroup { public boolean isDownloadedFromInternet = false; + public boolean downloadFromInternetFailed = false; public boolean mapVersionIsIncreased = false; public OsmandApplication app; private Map indexFileNames = new LinkedHashMap<>(); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java index 94c05d44c9..4a6fd87cc1 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapDataMenuController.java @@ -245,12 +245,10 @@ public class MapDataMenuController extends MenuController { rightTitleButtonController.visible = indexItem != null && indexItem.isDownloaded(); topRightTitleButtonController.visible = otherIndexItems.size() > 0; - boolean hasIndexes = downloadThread.getIndexes().isDownloadedFromInternet; + boolean downloadIndexes = !downloadThread.getIndexes().isDownloadedFromInternet + && !downloadThread.getIndexes().downloadFromInternetFailed; boolean isDownloading = indexItem != null && downloadThread.isDownloading(indexItem); - if (!hasIndexes) { - titleProgressController.setIndexesDownloadMode(); - titleProgressController.visible = true; - } else if (isDownloading) { + if (isDownloading) { titleProgressController.setMapDownloadMode(); if (downloadThread.getCurrentDownloadingItem() == indexItem) { titleProgressController.indeterminate = false; @@ -272,6 +270,9 @@ public class MapDataMenuController extends MenuController { titleProgressController.caption = v; } titleProgressController.visible = true; + } else if (downloadIndexes) { + titleProgressController.setIndexesDownloadMode(); + titleProgressController.visible = true; } else { titleProgressController.visible = false; } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapMultiSelectionMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapMultiSelectionMenu.java index 728c6e331d..9f63193d6c 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapMultiSelectionMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapMultiSelectionMenu.java @@ -156,11 +156,13 @@ public class MapMultiSelectionMenu extends BaseMenuController { hide(); } +/* for (Map.Entry e : selectedObjects.entrySet()) { if (e.getValue() instanceof ContextMenuLayer.IContextMenuProviderSelection) { ((ContextMenuLayer.IContextMenuProviderSelection) e.getValue()).setSelectedObject(e.getKey()); } } +*/ this.latLon = latLon; createCollection(selectedObjects);