Remove not used countries info

This commit is contained in:
vshcherb 2013-11-11 01:46:47 +01:00
parent 047a42cf42
commit 18a023c1f3
5 changed files with 7 additions and 40 deletions

View file

@ -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 {

View file

@ -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;
}
}

View file

@ -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);

View file

@ -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<SrtmIndexItem> cachedSRTMFiles;
private Map<IndexItem, List<DownloadEntry>> entriesToDownload = new ConcurrentHashMap<IndexItem, List<DownloadEntry>>();
private Set<DownloadEntry> currentDownloads = new HashSet<DownloadEntry>();
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<IndexItem> getFilteredByType() {
final List<IndexItem> filtered = new ArrayList<IndexItem>();
if (type == DownloadActivityType.SRTM_FILE) {
Map<String, String> indexFileNames = app.getResourceManager().getIndexFileNames();
if (cachedSRTMFiles == null) {
cachedSRTMFiles = new ArrayList<SrtmIndexItem>();
synchronized (cachedSRTMFiles) {
List<RegionCountry> 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<IndexItem> 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);

View file

@ -52,7 +52,7 @@ public class IndexItem implements Comparable<IndexItem> {
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);