diff --git a/OsmAnd-java/src/main/java/net/osmand/IndexConstants.java b/OsmAnd-java/src/main/java/net/osmand/IndexConstants.java index 3e4cd5af55..554eb7ced3 100644 --- a/OsmAnd-java/src/main/java/net/osmand/IndexConstants.java +++ b/OsmAnd-java/src/main/java/net/osmand/IndexConstants.java @@ -20,6 +20,8 @@ public class IndexConstants { public static final String BINARY_MAP_INDEX_EXT_ZIP = ".obf.zip"; //$NON-NLS-1$ public static final String BINARY_WIKIVOYAGE_MAP_INDEX_EXT = ".sqlite"; //$NON-NLS-1$ + public static final String BINARY_TRAVEL_GUIDE_MAP_INDEX_EXT = ".travel.obf"; //$NON-NLS-1$ + public static final String BINARY_TRAVEL_GUIDE_MAP_INDEX_EXT_ZIP = ".travel.obf.zip"; //$NON-NLS-1$ public static final String BINARY_WIKI_MAP_INDEX_EXT = ".wiki.obf"; //$NON-NLS-1$ public static final String BINARY_WIKI_MAP_INDEX_EXT_ZIP = ".wiki.obf.zip"; //$NON-NLS-1$ public static final String BINARY_ROAD_MAP_INDEX_EXT = ".road.obf"; //$NON-NLS-1$ diff --git a/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java b/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java index 7c64e3a669..e84ef5bc14 100644 --- a/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java +++ b/OsmAnd/src/net/osmand/plus/activities/LocalIndexHelper.java @@ -316,7 +316,8 @@ public class LocalIndexHelper { private void loadTravelData(File mapPath, List result, AbstractLoadLocalIndexTask loadTask) { if (mapPath.canRead()) { for (File mapFile : listFilesSorted(mapPath)) { - if (mapFile.isFile() && mapFile.getName().endsWith(IndexConstants.BINARY_WIKIVOYAGE_MAP_INDEX_EXT)) { + if (mapFile.isFile() && mapFile.getName().endsWith(IndexConstants.BINARY_WIKIVOYAGE_MAP_INDEX_EXT) || + mapFile.isFile() && mapFile.getName().endsWith(IndexConstants.BINARY_TRAVEL_GUIDE_MAP_INDEX_EXT)) { LocalIndexInfo info = new LocalIndexInfo(LocalIndexType.TRAVEL_DATA, mapFile, false, app); updateDescription(info); result.add(info); diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java b/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java index b516d73d2c..178b2827fe 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadActivityType.java @@ -49,6 +49,8 @@ public class DownloadActivityType { new DownloadActivityType(R.string.download_wikipedia_maps, R.drawable.ic_plugin_wikipedia, "wikimap", 60); public static final DownloadActivityType WIKIVOYAGE_FILE = new DownloadActivityType(R.string.shared_string_wikivoyage, R.drawable.ic_plugin_wikipedia, "wikivoyage", 65); + public static final DownloadActivityType TRAVEL_FILE = + new DownloadActivityType(R.string.shared_string_wikivoyage, R.drawable.ic_plugin_wikipedia, "travel", 66); public static final DownloadActivityType LIVE_UPDATES_FILE = new DownloadActivityType(R.string.download_live_updates, "live_updates", 70); public static final DownloadActivityType GPX_FILE = @@ -131,7 +133,10 @@ public class DownloadActivityType { return fileName.endsWith(addVersionToExt(IndexConstants.BINARY_WIKI_MAP_INDEX_EXT_ZIP, IndexConstants.BINARY_MAP_VERSION)); } else if (WIKIVOYAGE_FILE == this) { - return fileName.endsWith(IndexConstants.BINARY_WIKIVOYAGE_MAP_INDEX_EXT); + return fileName.endsWith(IndexConstants.BINARY_WIKIVOYAGE_MAP_INDEX_EXT); + } else if (TRAVEL_FILE == this) { + return fileName.endsWith(addVersionToExt(IndexConstants.BINARY_TRAVEL_GUIDE_MAP_INDEX_EXT_ZIP, + IndexConstants.BINARY_MAP_VERSION)); } else if (SRTM_COUNTRY_FILE == this) { return fileName.endsWith(addVersionToExt(IndexConstants.BINARY_SRTM_MAP_INDEX_EXT_ZIP, IndexConstants.BINARY_MAP_VERSION)); @@ -165,7 +170,7 @@ public class DownloadActivityType { return ctx.getAppPath(IndexConstants.SRTM_INDEX_DIR); } else if (WIKIPEDIA_FILE == this) { return ctx.getAppPath(IndexConstants.WIKI_INDEX_DIR); - } else if (WIKIVOYAGE_FILE == this) { + } else if (WIKIVOYAGE_FILE == this || TRAVEL_FILE == this) { return ctx.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR); } else if (LIVE_UPDATES_FILE == this) { return ctx.getAppPath(IndexConstants.LIVE_INDEX_DIR); @@ -220,6 +225,8 @@ public class DownloadActivityType { return IndexConstants.BINARY_WIKI_MAP_INDEX_EXT; } else if (WIKIVOYAGE_FILE == this) { return IndexConstants.BINARY_WIKIVOYAGE_MAP_INDEX_EXT; + } else if (TRAVEL_FILE == this) { + return IndexConstants.BINARY_TRAVEL_GUIDE_MAP_INDEX_EXT; } else if (LIVE_UPDATES_FILE == this) { return BINARY_MAP_INDEX_EXT; } else if (HILLSHADE_FILE == this) { @@ -247,6 +254,8 @@ public class DownloadActivityType { return "&wiki=yes"; } else if (this == WIKIVOYAGE_FILE) { return "&wikivoyage=yes"; + } else if (this == TRAVEL_FILE) { + return "&wikivoyage=yes"; } else if (this == HILLSHADE_FILE) { return "&hillshade=yes"; } else if (this == SLOPE_FILE) { @@ -415,7 +424,9 @@ public class DownloadActivityType { if (this == WIKIVOYAGE_FILE) { return baseNameWithoutVersion + IndexConstants.BINARY_WIKIVOYAGE_MAP_INDEX_EXT; } - + if (this == TRAVEL_FILE) { + return baseNameWithoutVersion + IndexConstants.BINARY_TRAVEL_GUIDE_MAP_INDEX_EXT; + } if (this == ROADS_FILE) { return baseNameWithoutVersion + IndexConstants.BINARY_ROAD_MAP_INDEX_EXT; } diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadResources.java b/OsmAnd/src/net/osmand/plus/download/DownloadResources.java index 3d06d4c9e1..2bff73d7b2 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadResources.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadResources.java @@ -130,14 +130,18 @@ public class DownloadResources extends DownloadResourceGroup { java.text.DateFormat dateFormat = app.getResourceManager().getDateFormat(); Map indexActivatedFileNames = app.getResourceManager().getIndexFileNames(); listWithAlternatives(dateFormat, app.getAppPath(""), IndexConstants.EXTRA_EXT, indexActivatedFileNames); - listWithAlternatives(dateFormat, app.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR), IndexConstants.BINARY_WIKIVOYAGE_MAP_INDEX_EXT, - indexActivatedFileNames); + listWithAlternatives(dateFormat, app.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR), + IndexConstants.BINARY_WIKIVOYAGE_MAP_INDEX_EXT, indexActivatedFileNames); + listWithAlternatives(dateFormat, app.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR), + IndexConstants.BINARY_TRAVEL_GUIDE_MAP_INDEX_EXT, indexActivatedFileNames); Map indexFileNames = app.getResourceManager().getIndexFileNames(); listWithAlternatives(dateFormat, app.getAppPath(""), IndexConstants.EXTRA_EXT, indexFileNames); listWithAlternatives(dateFormat, app.getAppPath(IndexConstants.TILES_INDEX_DIR), IndexConstants.SQLITE_EXT, indexFileNames); - listWithAlternatives(dateFormat, app.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR), IndexConstants.BINARY_WIKIVOYAGE_MAP_INDEX_EXT, - indexFileNames); + listWithAlternatives(dateFormat, app.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR), + IndexConstants.BINARY_WIKIVOYAGE_MAP_INDEX_EXT, indexFileNames); + listWithAlternatives(dateFormat, app.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR), + IndexConstants.BINARY_TRAVEL_GUIDE_MAP_INDEX_EXT, indexFileNames); app.getResourceManager().getBackupIndexes(indexFileNames); this.indexFileNames = indexFileNames; this.indexActivatedFileNames = indexActivatedFileNames; @@ -179,7 +183,8 @@ public class DownloadResources extends DownloadResourceGroup { || item.getType() == DownloadActivityType.DEPTH_CONTOUR_FILE || item.getType() == DownloadActivityType.SRTM_COUNTRY_FILE) { outdated = true; - } else if(item.getType() == DownloadActivityType.WIKIVOYAGE_FILE) { + } else if (item.getType() == DownloadActivityType.WIKIVOYAGE_FILE + || item.getType() == DownloadActivityType.TRAVEL_FILE) { long itemSize = item.getContentSize(); long oldItemSize = app.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR + item.getTargetFileName()).length(); @@ -343,7 +348,11 @@ public class DownloadResources extends DownloadResourceGroup { } continue; } - if(ii.getType() == DownloadActivityType.WIKIVOYAGE_FILE) { + if (ii.getType() == DownloadActivityType.WIKIVOYAGE_FILE) { + wikivoyageMaps.addItem(ii); + continue; + } + if (ii.getType() == DownloadActivityType.TRAVEL_FILE) { wikivoyageMaps.addItem(ii); continue; } diff --git a/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java b/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java index e4cdc5ce94..9ad1a0f89e 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java @@ -415,6 +415,8 @@ public class ItemViewHolder { tp = LocalIndexType.MAP_DATA; } else if (indexItem.getType() == DownloadActivityType.WIKIVOYAGE_FILE) { tp = LocalIndexType.MAP_DATA; + } else if (indexItem.getType() == DownloadActivityType.TRAVEL_FILE) { + tp = LocalIndexType.MAP_DATA; } else if (indexItem.getType() == DownloadActivityType.FONT_FILE) { tp = LocalIndexType.FONT_DATA; } else if (indexItem.getType() == DownloadActivityType.VOICE_FILE) {