From d7c69997d65b77b8d7a0a1ec3fcc7dbcdf0dcf75 Mon Sep 17 00:00:00 2001 From: vshcherb Date: Thu, 24 Oct 2013 00:27:24 +0200 Subject: [PATCH] Redownload basemap --- .../plus/download/DownloadIndexesThread.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java index 6b60a1d688..4d2c627865 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java @@ -375,12 +375,17 @@ public class DownloadIndexesThread { if (indexFiles != null && uiActivity != null) { boolean basemapExists = uiActivity.getMyApplication().getResourceManager().containsBasemap(); IndexItem basemap = indexFiles.getBasemap(); - if (!basemapExists && basemap != null) { - List downloadEntry = basemap.createDownloadEntry(uiActivity.getClientContext(), - uiActivity.getType(), new ArrayList()); - uiActivity.getEntriesToDownload().put(basemap, downloadEntry); - AccessibleToast.makeText(uiActivity, R.string.basemap_was_selected_to_download, Toast.LENGTH_LONG).show(); - uiActivity.findViewById(R.id.DownloadButton).setVisibility(View.VISIBLE); + if (basemap != null ) { + String dt = uiActivity.getMyApplication().getResourceManager().getIndexFileNames().get(basemap.getTargetFileName()); + if (!basemapExists || !Algorithms.objectEquals(dt, basemap.getDate())) { + List downloadEntry = basemap + .createDownloadEntry(uiActivity.getClientContext(), uiActivity.getType(), + new ArrayList()); + uiActivity.getEntriesToDownload().put(basemap, downloadEntry); + AccessibleToast.makeText(uiActivity, R.string.basemap_was_selected_to_download, + Toast.LENGTH_LONG).show(); + uiActivity.findViewById(R.id.DownloadButton).setVisibility(View.VISIBLE); + } } if (indexFiles.isIncreasedMapVersion()) { showWarnDialog();