Update wikivoyage - downloads
This commit is contained in:
parent
258e853594
commit
30adb0c048
8 changed files with 55 additions and 11 deletions
|
@ -10,11 +10,15 @@ public class IndexConstants {
|
|||
public final static int VOICE_VERSION = 0; //supported download versions
|
||||
public final static int TTSVOICE_VERSION = 1; //supported download versions
|
||||
|
||||
public static final String SQLITE_EXT = ".sqlitedb"; //$NON-NLS-1$
|
||||
public static final String TEMP_SOURCE_TO_LOAD = "temp";
|
||||
|
||||
public static final String POI_INDEX_EXT = ".poi.odb"; //$NON-NLS-1$
|
||||
|
||||
public static final String BINARY_MAP_INDEX_EXT = ".obf"; //$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_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$
|
||||
|
@ -62,8 +66,7 @@ public class IndexConstants {
|
|||
public static final String ROUTING_XML_FILE= "routing.xml";
|
||||
|
||||
|
||||
public static final String SQLITE_EXT = ".sqlitedb"; //$NON-NLS-1$
|
||||
public static final String TEMP_SOURCE_TO_LOAD = "temp";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
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
|
||||
-->
|
||||
<string name="download_maps_travel">Travel maps</string>
|
||||
<string name="shared_string_wikivoyage">Wikivoyage</string>
|
||||
<string name="article_removed">Article removed</string>
|
||||
<string name="wikivoyage_search_hint">Search: Country, City, Province</string>
|
||||
<string name="shared_string_read">Read</string>
|
||||
|
|
|
@ -114,9 +114,9 @@ public class PlatformUtil {
|
|||
|
||||
@Override
|
||||
public boolean isDebugEnabled() {
|
||||
// For debur purposes always true
|
||||
return android.util.Log.isLoggable(TAG, android.util.Log.DEBUG);
|
||||
// return true;
|
||||
// For debug purposes always true
|
||||
// return android.util.Log.isLoggable(TAG, android.util.Log.DEBUG);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -45,6 +45,8 @@ public class DownloadActivityType {
|
|||
new DownloadActivityType(R.string.download_hillshade_maps, R.drawable.ic_action_hillshade_dark, "hillshade", 50);
|
||||
public static final DownloadActivityType WIKIPEDIA_FILE =
|
||||
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 LIVE_UPDATES_FILE =
|
||||
new DownloadActivityType(R.string.download_live_updates, "live_updates", 70);
|
||||
private final int stringResource;
|
||||
|
@ -121,6 +123,8 @@ public class DownloadActivityType {
|
|||
} else if (WIKIPEDIA_FILE == this) {
|
||||
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);
|
||||
} else if (SRTM_COUNTRY_FILE == this) {
|
||||
return fileName.endsWith(addVersionToExt(IndexConstants.BINARY_SRTM_MAP_INDEX_EXT_ZIP,
|
||||
IndexConstants.BINARY_MAP_VERSION));
|
||||
|
@ -148,6 +152,8 @@ 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) {
|
||||
return ctx.getAppPath(IndexConstants.WIKIVOYAGE_INDEX_DIR);
|
||||
} else if (LIVE_UPDATES_FILE == this) {
|
||||
return ctx.getAppPath(IndexConstants.LIVE_INDEX_DIR);
|
||||
} else if (HILLSHADE_FILE == this) {
|
||||
|
@ -159,7 +165,7 @@ public class DownloadActivityType {
|
|||
}
|
||||
|
||||
public boolean isZipStream(OsmandApplication ctx, IndexItem indexItem) {
|
||||
return HILLSHADE_FILE != this;
|
||||
return HILLSHADE_FILE != this && WIKIVOYAGE_FILE != this;
|
||||
}
|
||||
|
||||
public boolean isZipFolder(OsmandApplication ctx, IndexItem indexItem) {
|
||||
|
@ -193,6 +199,8 @@ public class DownloadActivityType {
|
|||
return IndexConstants.BINARY_SRTM_MAP_INDEX_EXT;
|
||||
} else if (WIKIPEDIA_FILE == this) {
|
||||
return IndexConstants.BINARY_WIKI_MAP_INDEX_EXT;
|
||||
} else if (WIKIVOYAGE_FILE == this) {
|
||||
return IndexConstants.BINARY_WIKIVOYAGE_MAP_INDEX_EXT;
|
||||
} else if (LIVE_UPDATES_FILE == this) {
|
||||
return BINARY_MAP_INDEX_EXT;
|
||||
} else if (HILLSHADE_FILE == this) {
|
||||
|
@ -212,6 +220,8 @@ public class DownloadActivityType {
|
|||
return "&srtmcountry=yes";
|
||||
} else if (this == WIKIPEDIA_FILE) {
|
||||
return "&wiki=yes";
|
||||
} else if (this == WIKIVOYAGE_FILE) {
|
||||
return "&wikivoyage=yes";
|
||||
} else if (this == HILLSHADE_FILE) {
|
||||
return "&hillshade=yes";
|
||||
} else if (this == FONT_FILE) {
|
||||
|
@ -269,6 +279,8 @@ public class DownloadActivityType {
|
|||
return ctx.getString(R.string.download_srtm_maps);
|
||||
} else if (this == WIKIPEDIA_FILE) {
|
||||
return ctx.getString(R.string.shared_string_wikipedia);
|
||||
} else if (this == WIKIVOYAGE_FILE) {
|
||||
return ctx.getString(R.string.shared_string_wikivoyage);
|
||||
} else if (this == ROADS_FILE) {
|
||||
return ctx.getString(R.string.download_roads_only_item);
|
||||
} else if (this == DEPTH_CONTOUR_FILE) {
|
||||
|
@ -356,6 +368,10 @@ public class DownloadActivityType {
|
|||
if (this == WIKIPEDIA_FILE) {
|
||||
return baseNameWithoutVersion + IndexConstants.BINARY_WIKI_MAP_INDEX_EXT;
|
||||
}
|
||||
if (this == WIKIVOYAGE_FILE) {
|
||||
return baseNameWithoutVersion + IndexConstants.BINARY_WIKIVOYAGE_MAP_INDEX_EXT;
|
||||
}
|
||||
|
||||
if (this == ROADS_FILE) {
|
||||
return baseNameWithoutVersion + IndexConstants.BINARY_ROAD_MAP_INDEX_EXT;
|
||||
}
|
||||
|
|
|
@ -205,7 +205,7 @@ public class DownloadFileHelper {
|
|||
try {
|
||||
final List<InputStream> downloadInputStreams = new ArrayList<InputStream>();
|
||||
URL url = new URL(de.urlToDownload); //$NON-NLS-1$
|
||||
log.debug("Url downloading " + de.urlToDownload);
|
||||
log.info("Url downloading " + de.urlToDownload);
|
||||
downloadInputStreams.add(getInputStreamToDownload(url, forceWifi));
|
||||
de.fileToDownload = de.targetFile;
|
||||
if(!de.unzipFolder) {
|
||||
|
|
|
@ -34,6 +34,8 @@ public class DownloadResourceGroup {
|
|||
SRTM_HEADER(R.string.download_srtm_maps),
|
||||
HILLSHADE_HEADER(R.string.download_hillshade_maps),
|
||||
OTHER_MAPS_HEADER(R.string.download_select_map_types),
|
||||
WIKIVOYAGE_HEADER(R.string.shared_string_wikivoyage),
|
||||
|
||||
NAUTICAL_MAPS_HEADER(R.string.nautical_maps),
|
||||
// headers with voice items
|
||||
VOICE_HEADER_TTS(R.string.index_name_tts_voice),
|
||||
|
@ -42,11 +44,13 @@ public class DownloadResourceGroup {
|
|||
FONTS_HEADER(R.string.fonts_header),
|
||||
// headers with resources
|
||||
NAUTICAL_MAPS_GROUP(R.string.nautical_maps),
|
||||
TRAVEL_GROUP(R.string.download_maps_travel),
|
||||
OTHER_MAPS_GROUP(R.string.download_select_map_types),
|
||||
OTHER_GROUP(R.string.other_menu_group),
|
||||
SUBREGIONS(R.string.regions),
|
||||
// screen items
|
||||
NAUTICAL_MAPS(R.string.nautical_maps),
|
||||
WIKIVOYAGE_MAPS(R.string.download_maps_travel),
|
||||
VOICE_TTS(R.string.index_name_tts_voice),
|
||||
FONTS(R.string.fonts_header),
|
||||
VOICE_REC(R.string.index_name_voice),
|
||||
|
@ -62,7 +66,7 @@ public class DownloadResourceGroup {
|
|||
|
||||
public boolean isScreen() {
|
||||
return this == WORLD || this == REGION || this == VOICE_TTS
|
||||
|| this == VOICE_REC || this == OTHER_MAPS || this == FONTS || this == NAUTICAL_MAPS;
|
||||
|| this == VOICE_REC || this == OTHER_MAPS || this == FONTS || this == NAUTICAL_MAPS || this == WIKIVOYAGE_MAPS;
|
||||
}
|
||||
|
||||
public String getDefaultId() {
|
||||
|
@ -75,15 +79,17 @@ public class DownloadResourceGroup {
|
|||
|
||||
public boolean containsIndexItem() {
|
||||
return isHeader() && this != SUBREGIONS && this != OTHER_GROUP && this != OTHER_MAPS_GROUP
|
||||
&& this != NAUTICAL_MAPS_GROUP;
|
||||
&& this != NAUTICAL_MAPS_GROUP && this != TRAVEL_GROUP;
|
||||
}
|
||||
|
||||
public boolean isHeader() {
|
||||
return this == VOICE_HEADER_REC || this == VOICE_HEADER_TTS || this == SUBREGIONS
|
||||
|| this == WORLD_MAPS || this == REGION_MAPS || this == OTHER_GROUP
|
||||
|| this == WORLD_MAPS || this == REGION_MAPS || this == OTHER_GROUP
|
||||
|| this == HILLSHADE_HEADER || this == SRTM_HEADER
|
||||
|| this == OTHER_MAPS_HEADER || this == OTHER_MAPS_GROUP
|
||||
|| this == FONTS_HEADER || this == NAUTICAL_MAPS_HEADER || this == NAUTICAL_MAPS_GROUP;
|
||||
|| this == FONTS_HEADER
|
||||
|| this == NAUTICAL_MAPS_HEADER || this == NAUTICAL_MAPS_GROUP
|
||||
|| this == WIKIVOYAGE_HEADER || this == TRAVEL_GROUP;
|
||||
}
|
||||
|
||||
public static String getVoiceTTSId() {
|
||||
|
|
|
@ -140,6 +140,7 @@ public class DownloadResources extends DownloadResourceGroup {
|
|||
if ((item.getType() == DownloadActivityType.NORMAL_FILE && !item.extra)
|
||||
|| item.getType() == DownloadActivityType.ROADS_FILE
|
||||
|| item.getType() == DownloadActivityType.WIKIPEDIA_FILE
|
||||
|| item.getType() == DownloadActivityType.WIKIVOYAGE_FILE
|
||||
|| item.getType() == DownloadActivityType.DEPTH_CONTOUR_FILE
|
||||
|| item.getType() == DownloadActivityType.SRTM_COUNTRY_FILE) {
|
||||
outdated = true;
|
||||
|
@ -268,6 +269,10 @@ public class DownloadResources extends DownloadResourceGroup {
|
|||
DownloadResourceGroup nauticalMapsGroup = new DownloadResourceGroup(this, DownloadResourceGroupType.NAUTICAL_MAPS_GROUP);
|
||||
DownloadResourceGroup nauticalMapsScreen = new DownloadResourceGroup(nauticalMapsGroup, DownloadResourceGroupType.NAUTICAL_MAPS);
|
||||
DownloadResourceGroup nauticalMaps = new DownloadResourceGroup(nauticalMapsGroup, DownloadResourceGroupType.NAUTICAL_MAPS_HEADER);
|
||||
|
||||
DownloadResourceGroup wikivoyageMapsGroup = new DownloadResourceGroup(this, DownloadResourceGroupType.TRAVEL_GROUP);
|
||||
DownloadResourceGroup wikivoyageMapsScreen = new DownloadResourceGroup(wikivoyageMapsGroup, DownloadResourceGroupType.WIKIVOYAGE_MAPS);
|
||||
DownloadResourceGroup wikivoyageMaps = new DownloadResourceGroup(wikivoyageMapsGroup, DownloadResourceGroupType.WIKIVOYAGE_HEADER);
|
||||
|
||||
Map<WorldRegion, List<IndexItem> > groupByRegion = new LinkedHashMap<WorldRegion, List<IndexItem>>();
|
||||
OsmandRegions regs = app.getRegions();
|
||||
|
@ -290,6 +295,10 @@ public class DownloadResources extends DownloadResourceGroup {
|
|||
}
|
||||
continue;
|
||||
}
|
||||
if(ii.getType() == DownloadActivityType.WIKIVOYAGE_FILE) {
|
||||
wikivoyageMaps.addItem(ii);
|
||||
continue;
|
||||
}
|
||||
String basename = ii.getBasename().toLowerCase();
|
||||
WorldRegion wg = regs.getRegionDataByDownloadName(basename);
|
||||
if (wg != null) {
|
||||
|
@ -354,6 +363,10 @@ public class DownloadResources extends DownloadResourceGroup {
|
|||
nauticalMapsGroup.addGroup(nauticalMapsScreen);
|
||||
addGroup(nauticalMapsGroup);
|
||||
|
||||
wikivoyageMapsScreen.addGroup(wikivoyageMaps);
|
||||
wikivoyageMapsGroup.addGroup(wikivoyageMapsScreen);
|
||||
addGroup(wikivoyageMapsGroup);
|
||||
|
||||
if (otherMaps.size() > 0) {
|
||||
addGroup(otherMapsGroup);
|
||||
}
|
||||
|
@ -365,6 +378,8 @@ public class DownloadResources extends DownloadResourceGroup {
|
|||
}
|
||||
otherGroup.addGroup(voiceScreenTTS);
|
||||
otherGroup.addGroup(voiceScreenRec);
|
||||
|
||||
|
||||
if (fonts.getIndividualResources() != null) {
|
||||
otherGroup.addGroup(fontScreen);
|
||||
}
|
||||
|
|
|
@ -405,6 +405,8 @@ public class ItemViewHolder {
|
|||
tp = LocalIndexType.SRTM_DATA;
|
||||
} else if (indexItem.getType() == DownloadActivityType.WIKIPEDIA_FILE) {
|
||||
tp = LocalIndexType.MAP_DATA;
|
||||
} else if (indexItem.getType() == DownloadActivityType.WIKIVOYAGE_FILE) {
|
||||
tp = LocalIndexType.MAP_DATA;
|
||||
} else if (indexItem.getType() == DownloadActivityType.FONT_FILE) {
|
||||
tp = LocalIndexType.FONT_DATA;
|
||||
} else if (indexItem.getType() == DownloadActivityType.VOICE_FILE) {
|
||||
|
|
Loading…
Reference in a new issue