Download maps

This commit is contained in:
Alexey Kulish 2015-10-02 12:13:02 +03:00
parent f5d8b8cda2
commit 7c421fc5f1
2 changed files with 20 additions and 9 deletions

View file

@ -9,6 +9,7 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). 3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
--> -->
<string name="srtm_plugin_disabled">Contour lines disabled</string>
<string name="favorite_category_add_new">Add new</string> <string name="favorite_category_add_new">Add new</string>
<string name="favorite_category_select">Select category</string> <string name="favorite_category_select">Select category</string>
<string name="default_speed_system_descr">Define speed measurement system</string> <string name="default_speed_system_descr">Define speed measurement system</string>

View file

@ -5,10 +5,13 @@ import android.content.Context;
import net.osmand.PlatformUtil; import net.osmand.PlatformUtil;
import net.osmand.map.OsmandRegions; import net.osmand.map.OsmandRegions;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.WorldRegion; import net.osmand.plus.WorldRegion;
import net.osmand.plus.download.DownloadActivity; import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.download.DownloadActivityType; import net.osmand.plus.download.DownloadActivityType;
import net.osmand.plus.download.IndexItem; import net.osmand.plus.download.IndexItem;
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
import net.osmand.plus.srtmplugin.SRTMPlugin;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import java.util.Collections; import java.util.Collections;
@ -24,6 +27,9 @@ import java.util.concurrent.locks.ReentrantLock;
public class ItemsListBuilder { public class ItemsListBuilder {
public static final String WORLD_BASEMAP_KEY = "world_basemap.obf.zip";
public static final String WORLD_SEAMARKS_KEY = "world_seamarks_basemap.obf.zip";
public class ResourceItem { public class ResourceItem {
private String resourceId; private String resourceId;
@ -273,7 +279,7 @@ public class ItemsListBuilder {
} }
private void collectSubregionsDataAndItems() { private void collectSubregionsDataAndItems() {
srtmDisabled = false; //todo: check if srtm plugin disabled srtmDisabled = OsmandPlugin.getEnabledPlugin(SRTMPlugin.class) == null;
hasSrtm = false; hasSrtm = false;
// Collect all regions (and their parents) that have at least one // Collect all regions (and their parents) that have at least one
@ -356,15 +362,19 @@ public class ItemsListBuilder {
Collections.sort(allResourceItems, new ResourceItemComparator()); Collections.sort(allResourceItems, new ResourceItemComparator());
Collections.sort(regionMapItems, new ResourceItemComparator()); Collections.sort(regionMapItems, new ResourceItemComparator());
/* boolean nauticalPluginDisabled = OsmandPlugin.getEnabledPlugin(NauticalMapsPlugin.class) == null;
* todo: remove seamarks if plugin is off
if (![[OAIAPHelper sharedInstance] productPurchased:kInAppId_Addon_Nautical]) { if (nauticalPluginDisabled) {
for (ResourceItem *item in _regionMapItems) ResourceItem seamarksMapItem = null;
if (item.resourceId.compare(QString(kWorldSeamarksKey)) == 0) { for (ResourceItem item : regionMapItems) {
[_regionMapItems removeObject:item]; if (item.getResourceId().equals(WORLD_SEAMARKS_KEY)) {
seamarksMapItem = item;
break; break;
} }
} }
*/ if (seamarksMapItem != null) {
regionMapItems.remove(seamarksMapItem);
}
}
} }
} }