From 18a023c1f3b0100e97e1c6b1d2b666736552ebf8 Mon Sep 17 00:00:00 2001 From: vshcherb Date: Mon, 11 Nov 2013 01:46:47 +0100 Subject: [PATCH] Remove not used countries info --- .../activities/DownloadIndexActivity.java | 3 +- .../plus/download/DownloadActivityType.java | 4 +-- .../plus/download/DownloadIndexAdapter.java | 2 +- .../plus/download/DownloadIndexesThread.java | 36 ++----------------- .../net/osmand/plus/download/IndexItem.java | 2 +- 5 files changed, 7 insertions(+), 40 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java b/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java index 000e053531..cdf682e8d9 100644 --- a/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/DownloadIndexActivity.java @@ -367,7 +367,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity { items[i] = getString(R.string.download_regular_maps); } else if (t[i] == DownloadActivityType.ROADS_FILE) { items[i] = getString(R.string.download_roads_only_maps); - } else if (t[i] == DownloadActivityType.SRTM_FILE || t[i] == DownloadActivityType.SRTM_COUNTRY_FILE) { + } else if ( t[i] == DownloadActivityType.SRTM_COUNTRY_FILE) { items[i] = getString(R.string.download_srtm_maps); } else if (t[i] == DownloadActivityType.HILLSHADE_FILE) { items[i] = getString(R.string.download_hillshade_maps); @@ -382,7 +382,6 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity { items = new DownloadActivityType[]{ DownloadActivityType.NORMAL_FILE, DownloadActivityType.ROADS_FILE, - //DownloadActivityType.SRTM_FILE, DownloadActivityType.HILLSHADE_FILE, DownloadActivityType.SRTM_COUNTRY_FILE}; } else { diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java b/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java index 73f178c750..51bf7d267c 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java @@ -1,9 +1,9 @@ package net.osmand.plus.download; public enum DownloadActivityType { - NORMAL_FILE, ROADS_FILE, SRTM_FILE, HILLSHADE_FILE, SRTM_COUNTRY_FILE; + NORMAL_FILE, ROADS_FILE, /*SRTM_FILE, */HILLSHADE_FILE, SRTM_COUNTRY_FILE; public static boolean isCountedInDownloads(DownloadActivityType tp) { - return tp != SRTM_FILE && tp != HILLSHADE_FILE && tp != SRTM_COUNTRY_FILE; + return tp != HILLSHADE_FILE && tp != SRTM_COUNTRY_FILE; } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexAdapter.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexAdapter.java index 0ae9a59b5f..7855aaa51e 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexAdapter.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexAdapter.java @@ -253,7 +253,7 @@ public class DownloadIndexAdapter extends OsmandBaseExpandableListAdapter implem item.setTextColor(defaultColor); item.setTypeface(Typeface.DEFAULT, Typeface.NORMAL); } else { - if(e.getType() == DownloadActivityType.SRTM_FILE || e.getType() == DownloadActivityType.HILLSHADE_FILE + if(e.getType() == DownloadActivityType.HILLSHADE_FILE || e.getType() == DownloadActivityType.SRTM_COUNTRY_FILE){ item.setTextColor(okColor); // GREEN item.setTypeface(Typeface.DEFAULT, Typeface.NORMAL); diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java index 4d2c627865..b262ca3ab6 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexesThread.java @@ -19,7 +19,6 @@ import net.osmand.IndexConstants; import net.osmand.PlatformUtil; import net.osmand.access.AccessibleToast; import net.osmand.map.RegionCountry; -import net.osmand.map.RegionRegistry; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandSettings.OsmandPreference; @@ -51,7 +50,6 @@ import android.widget.Toast; public class DownloadIndexesThread { private DownloadIndexActivity uiActivity = null; private IndexFileList indexFiles = null; - private List cachedSRTMFiles; private Map> entriesToDownload = new ConcurrentHashMap>(); private Set currentDownloads = new HashSet(); private final Context ctx; @@ -285,11 +283,6 @@ public class DownloadIndexesThread { if (vectorMapsToReindex) { warnings = manager.indexingMaps(this); } - if (cachedSRTMFiles != null) { - for (SrtmIndexItem i : cachedSRTMFiles) { - ((SrtmIndexItem) i).updateExistingTiles(app.getResourceManager().getIndexFileNames()); - } - } if (!warnings.isEmpty()) { return warnings.get(0); } @@ -480,32 +473,6 @@ public class DownloadIndexesThread { public List getFilteredByType() { final List filtered = new ArrayList(); - if (type == DownloadActivityType.SRTM_FILE) { - Map indexFileNames = app.getResourceManager().getIndexFileNames(); - if (cachedSRTMFiles == null) { - cachedSRTMFiles = new ArrayList(); - synchronized (cachedSRTMFiles) { - List countries = RegionRegistry.getRegionRegistry().getCountries(); - for (RegionCountry rc : countries) { - if (rc.getTileSize() > 35 && rc.getSubRegions().size() > 0) { - for (RegionCountry ch : rc.getSubRegions()) { - cachedSRTMFiles.add(new SrtmIndexItem(ch, indexFileNames)); - } - } else { - cachedSRTMFiles.add(new SrtmIndexItem(rc, indexFileNames)); - } - } - filtered.addAll(cachedSRTMFiles); - } - } else { - synchronized (cachedSRTMFiles) { - for (SrtmIndexItem s : cachedSRTMFiles) { - s.updateExistingTiles(indexFileNames); - filtered.add(s); - } - } - } - } List cachedIndexFiles = getCachedIndexFiles(); if (cachedIndexFiles != null) { for (IndexItem file : cachedIndexFiles) { @@ -526,7 +493,8 @@ public class DownloadIndexesThread { a.setIndexFiles(filtered, cats); a.notifyDataSetChanged(); a.getFilter().filter(uiActivity.getFilterText()); - if (type == DownloadActivityType.SRTM_FILE && OsmandPlugin.getEnabledPlugin(SRTMPlugin.class) instanceof SRTMPlugin + if ((type == DownloadActivityType.SRTM_COUNTRY_FILE || type == DownloadActivityType.HILLSHADE_FILE) + && OsmandPlugin.getEnabledPlugin(SRTMPlugin.class) instanceof SRTMPlugin && !OsmandPlugin.getEnabledPlugin(SRTMPlugin.class).isPaid()) { Builder msg = new AlertDialog.Builder(uiActivity); msg.setTitle(R.string.srtm_paid_version_title); diff --git a/OsmAnd/src/net/osmand/plus/download/IndexItem.java b/OsmAnd/src/net/osmand/plus/download/IndexItem.java index 9580bcc9b0..6b5011c8ed 100644 --- a/OsmAnd/src/net/osmand/plus/download/IndexItem.java +++ b/OsmAnd/src/net/osmand/plus/download/IndexItem.java @@ -52,7 +52,7 @@ public class IndexItem implements Comparable { public String getVisibleDescription(ClientContext ctx) { String s = ""; //$NON-NLS-1$ - if (type == DownloadActivityType.SRTM_FILE || type == DownloadActivityType.SRTM_COUNTRY_FILE) { + if (type == DownloadActivityType.SRTM_COUNTRY_FILE) { return ctx.getString(R.string.download_srtm_maps); } else if (type == DownloadActivityType.ROADS_FILE) { return ctx.getString(R.string.download_roads_only_item);