Wikivoyage show in downloads Android
This commit is contained in:
parent
c949f98329
commit
094b8e04e0
5 changed files with 35 additions and 10 deletions
|
@ -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_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_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 = ".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_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$
|
public static final String BINARY_ROAD_MAP_INDEX_EXT = ".road.obf"; //$NON-NLS-1$
|
||||||
|
|
|
@ -316,7 +316,8 @@ public class LocalIndexHelper {
|
||||||
private void loadTravelData(File mapPath, List<LocalIndexInfo> result, AbstractLoadLocalIndexTask loadTask) {
|
private void loadTravelData(File mapPath, List<LocalIndexInfo> result, AbstractLoadLocalIndexTask loadTask) {
|
||||||
if (mapPath.canRead()) {
|
if (mapPath.canRead()) {
|
||||||
for (File mapFile : listFilesSorted(mapPath)) {
|
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);
|
LocalIndexInfo info = new LocalIndexInfo(LocalIndexType.TRAVEL_DATA, mapFile, false, app);
|
||||||
updateDescription(info);
|
updateDescription(info);
|
||||||
result.add(info);
|
result.add(info);
|
||||||
|
|
|
@ -49,6 +49,8 @@ public class DownloadActivityType {
|
||||||
new DownloadActivityType(R.string.download_wikipedia_maps, R.drawable.ic_plugin_wikipedia, "wikimap", 60);
|
new DownloadActivityType(R.string.download_wikipedia_maps, R.drawable.ic_plugin_wikipedia, "wikimap", 60);
|
||||||
public static final DownloadActivityType WIKIVOYAGE_FILE =
|
public static final DownloadActivityType WIKIVOYAGE_FILE =
|
||||||
new DownloadActivityType(R.string.shared_string_wikivoyage, R.drawable.ic_plugin_wikipedia, "wikivoyage", 65);
|
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 =
|
public static final DownloadActivityType LIVE_UPDATES_FILE =
|
||||||
new DownloadActivityType(R.string.download_live_updates, "live_updates", 70);
|
new DownloadActivityType(R.string.download_live_updates, "live_updates", 70);
|
||||||
public static final DownloadActivityType GPX_FILE =
|
public static final DownloadActivityType GPX_FILE =
|
||||||
|
@ -132,6 +134,9 @@ public class DownloadActivityType {
|
||||||
IndexConstants.BINARY_MAP_VERSION));
|
IndexConstants.BINARY_MAP_VERSION));
|
||||||
} else if (WIKIVOYAGE_FILE == this) {
|
} 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) {
|
} else if (SRTM_COUNTRY_FILE == this) {
|
||||||
return fileName.endsWith(addVersionToExt(IndexConstants.BINARY_SRTM_MAP_INDEX_EXT_ZIP,
|
return fileName.endsWith(addVersionToExt(IndexConstants.BINARY_SRTM_MAP_INDEX_EXT_ZIP,
|
||||||
IndexConstants.BINARY_MAP_VERSION));
|
IndexConstants.BINARY_MAP_VERSION));
|
||||||
|
@ -165,7 +170,7 @@ public class DownloadActivityType {
|
||||||
return ctx.getAppPath(IndexConstants.SRTM_INDEX_DIR);
|
return ctx.getAppPath(IndexConstants.SRTM_INDEX_DIR);
|
||||||
} else if (WIKIPEDIA_FILE == this) {
|
} else if (WIKIPEDIA_FILE == this) {
|
||||||
return ctx.getAppPath(IndexConstants.WIKI_INDEX_DIR);
|
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);
|
return ctx.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR);
|
||||||
} else if (LIVE_UPDATES_FILE == this) {
|
} else if (LIVE_UPDATES_FILE == this) {
|
||||||
return ctx.getAppPath(IndexConstants.LIVE_INDEX_DIR);
|
return ctx.getAppPath(IndexConstants.LIVE_INDEX_DIR);
|
||||||
|
@ -220,6 +225,8 @@ public class DownloadActivityType {
|
||||||
return IndexConstants.BINARY_WIKI_MAP_INDEX_EXT;
|
return IndexConstants.BINARY_WIKI_MAP_INDEX_EXT;
|
||||||
} else if (WIKIVOYAGE_FILE == this) {
|
} else if (WIKIVOYAGE_FILE == this) {
|
||||||
return IndexConstants.BINARY_WIKIVOYAGE_MAP_INDEX_EXT;
|
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) {
|
} else if (LIVE_UPDATES_FILE == this) {
|
||||||
return BINARY_MAP_INDEX_EXT;
|
return BINARY_MAP_INDEX_EXT;
|
||||||
} else if (HILLSHADE_FILE == this) {
|
} else if (HILLSHADE_FILE == this) {
|
||||||
|
@ -247,6 +254,8 @@ public class DownloadActivityType {
|
||||||
return "&wiki=yes";
|
return "&wiki=yes";
|
||||||
} else if (this == WIKIVOYAGE_FILE) {
|
} else if (this == WIKIVOYAGE_FILE) {
|
||||||
return "&wikivoyage=yes";
|
return "&wikivoyage=yes";
|
||||||
|
} else if (this == TRAVEL_FILE) {
|
||||||
|
return "&wikivoyage=yes";
|
||||||
} else if (this == HILLSHADE_FILE) {
|
} else if (this == HILLSHADE_FILE) {
|
||||||
return "&hillshade=yes";
|
return "&hillshade=yes";
|
||||||
} else if (this == SLOPE_FILE) {
|
} else if (this == SLOPE_FILE) {
|
||||||
|
@ -415,7 +424,9 @@ public class DownloadActivityType {
|
||||||
if (this == WIKIVOYAGE_FILE) {
|
if (this == WIKIVOYAGE_FILE) {
|
||||||
return baseNameWithoutVersion + IndexConstants.BINARY_WIKIVOYAGE_MAP_INDEX_EXT;
|
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) {
|
if (this == ROADS_FILE) {
|
||||||
return baseNameWithoutVersion + IndexConstants.BINARY_ROAD_MAP_INDEX_EXT;
|
return baseNameWithoutVersion + IndexConstants.BINARY_ROAD_MAP_INDEX_EXT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,14 +130,18 @@ public class DownloadResources extends DownloadResourceGroup {
|
||||||
java.text.DateFormat dateFormat = app.getResourceManager().getDateFormat();
|
java.text.DateFormat dateFormat = app.getResourceManager().getDateFormat();
|
||||||
Map<String, String> indexActivatedFileNames = app.getResourceManager().getIndexFileNames();
|
Map<String, String> indexActivatedFileNames = app.getResourceManager().getIndexFileNames();
|
||||||
listWithAlternatives(dateFormat, app.getAppPath(""), IndexConstants.EXTRA_EXT, indexActivatedFileNames);
|
listWithAlternatives(dateFormat, app.getAppPath(""), IndexConstants.EXTRA_EXT, indexActivatedFileNames);
|
||||||
listWithAlternatives(dateFormat, app.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR), IndexConstants.BINARY_WIKIVOYAGE_MAP_INDEX_EXT,
|
listWithAlternatives(dateFormat, app.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR),
|
||||||
indexActivatedFileNames);
|
IndexConstants.BINARY_WIKIVOYAGE_MAP_INDEX_EXT, indexActivatedFileNames);
|
||||||
|
listWithAlternatives(dateFormat, app.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR),
|
||||||
|
IndexConstants.BINARY_TRAVEL_GUIDE_MAP_INDEX_EXT, indexActivatedFileNames);
|
||||||
Map<String, String> indexFileNames = app.getResourceManager().getIndexFileNames();
|
Map<String, String> indexFileNames = app.getResourceManager().getIndexFileNames();
|
||||||
listWithAlternatives(dateFormat, app.getAppPath(""), IndexConstants.EXTRA_EXT, indexFileNames);
|
listWithAlternatives(dateFormat, app.getAppPath(""), IndexConstants.EXTRA_EXT, indexFileNames);
|
||||||
listWithAlternatives(dateFormat, app.getAppPath(IndexConstants.TILES_INDEX_DIR), IndexConstants.SQLITE_EXT,
|
listWithAlternatives(dateFormat, app.getAppPath(IndexConstants.TILES_INDEX_DIR), IndexConstants.SQLITE_EXT,
|
||||||
indexFileNames);
|
indexFileNames);
|
||||||
listWithAlternatives(dateFormat, app.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR), IndexConstants.BINARY_WIKIVOYAGE_MAP_INDEX_EXT,
|
listWithAlternatives(dateFormat, app.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR),
|
||||||
indexFileNames);
|
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);
|
app.getResourceManager().getBackupIndexes(indexFileNames);
|
||||||
this.indexFileNames = indexFileNames;
|
this.indexFileNames = indexFileNames;
|
||||||
this.indexActivatedFileNames = indexActivatedFileNames;
|
this.indexActivatedFileNames = indexActivatedFileNames;
|
||||||
|
@ -179,7 +183,8 @@ public class DownloadResources extends DownloadResourceGroup {
|
||||||
|| item.getType() == DownloadActivityType.DEPTH_CONTOUR_FILE
|
|| item.getType() == DownloadActivityType.DEPTH_CONTOUR_FILE
|
||||||
|| item.getType() == DownloadActivityType.SRTM_COUNTRY_FILE) {
|
|| item.getType() == DownloadActivityType.SRTM_COUNTRY_FILE) {
|
||||||
outdated = true;
|
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 itemSize = item.getContentSize();
|
||||||
long oldItemSize = app.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR +
|
long oldItemSize = app.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR +
|
||||||
item.getTargetFileName()).length();
|
item.getTargetFileName()).length();
|
||||||
|
@ -347,6 +352,10 @@ public class DownloadResources extends DownloadResourceGroup {
|
||||||
wikivoyageMaps.addItem(ii);
|
wikivoyageMaps.addItem(ii);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (ii.getType() == DownloadActivityType.TRAVEL_FILE) {
|
||||||
|
wikivoyageMaps.addItem(ii);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
String basename = ii.getBasename().toLowerCase();
|
String basename = ii.getBasename().toLowerCase();
|
||||||
WorldRegion wg = regs.getRegionDataByDownloadName(basename);
|
WorldRegion wg = regs.getRegionDataByDownloadName(basename);
|
||||||
if (wg != null) {
|
if (wg != null) {
|
||||||
|
|
|
@ -415,6 +415,8 @@ public class ItemViewHolder {
|
||||||
tp = LocalIndexType.MAP_DATA;
|
tp = LocalIndexType.MAP_DATA;
|
||||||
} else if (indexItem.getType() == DownloadActivityType.WIKIVOYAGE_FILE) {
|
} else if (indexItem.getType() == DownloadActivityType.WIKIVOYAGE_FILE) {
|
||||||
tp = LocalIndexType.MAP_DATA;
|
tp = LocalIndexType.MAP_DATA;
|
||||||
|
} else if (indexItem.getType() == DownloadActivityType.TRAVEL_FILE) {
|
||||||
|
tp = LocalIndexType.MAP_DATA;
|
||||||
} else if (indexItem.getType() == DownloadActivityType.FONT_FILE) {
|
} else if (indexItem.getType() == DownloadActivityType.FONT_FILE) {
|
||||||
tp = LocalIndexType.FONT_DATA;
|
tp = LocalIndexType.FONT_DATA;
|
||||||
} else if (indexItem.getType() == DownloadActivityType.VOICE_FILE) {
|
} else if (indexItem.getType() == DownloadActivityType.VOICE_FILE) {
|
||||||
|
|
Loading…
Reference in a new issue