Fix hillshade. Added Other Maps section to downloads
This commit is contained in:
parent
944d3be400
commit
6361675191
4 changed files with 47 additions and 13 deletions
|
@ -29,14 +29,24 @@ public class DownloadResourceGroup {
|
|||
|
||||
public enum DownloadResourceGroupType {
|
||||
// headers
|
||||
WORLD_MAPS(R.string.world_maps), REGION_MAPS(R.string.region_maps),
|
||||
SRTM_HEADER(R.string.download_srtm_maps), HILLSHADE_HEADER(R.string.download_hillshade_maps),
|
||||
WORLD_MAPS(R.string.world_maps),
|
||||
REGION_MAPS(R.string.region_maps),
|
||||
SRTM_HEADER(R.string.download_srtm_maps),
|
||||
HILLSHADE_HEADER(R.string.download_hillshade_maps),
|
||||
OTHER_MAPS_HEADER(R.string.download_select_map_types),
|
||||
// headers with voice items
|
||||
VOICE_HEADER_REC(R.string.index_name_voice), VOICE_HEADER_TTS(R.string.index_name_tts_voice),
|
||||
VOICE_HEADER_REC(R.string.index_name_voice),
|
||||
VOICE_HEADER_TTS(R.string.index_name_tts_voice),
|
||||
// headers with resources
|
||||
VOICE_GROUP(R.string.voices), SUBREGIONS(R.string.regions),
|
||||
OTHER_MAPS_GROUP(R.string.download_select_map_types),
|
||||
VOICE_GROUP(R.string.voices),
|
||||
SUBREGIONS(R.string.regions),
|
||||
// screen items
|
||||
VOICE_REC(R.string.index_name_voice), VOICE_TTS(R.string.index_name_tts_voice), WORLD(-1), REGION(-1);
|
||||
VOICE_REC(R.string.index_name_voice),
|
||||
VOICE_TTS(R.string.index_name_tts_voice),
|
||||
OTHER_MAPS(R.string.download_select_map_types),
|
||||
WORLD(-1),
|
||||
REGION(-1);
|
||||
|
||||
final int resId;
|
||||
|
||||
|
@ -45,7 +55,8 @@ public class DownloadResourceGroup {
|
|||
}
|
||||
|
||||
public boolean isScreen() {
|
||||
return this == WORLD || this == REGION || this == VOICE_TTS || this == VOICE_REC;
|
||||
return this == WORLD || this == REGION || this == VOICE_TTS
|
||||
|| this == VOICE_REC || this == OTHER_MAPS;
|
||||
}
|
||||
|
||||
public String getDefaultId() {
|
||||
|
@ -57,12 +68,14 @@ public class DownloadResourceGroup {
|
|||
}
|
||||
|
||||
public boolean containsIndexItem() {
|
||||
return isHeader() && this != SUBREGIONS && this != VOICE_GROUP;
|
||||
return isHeader() && this != SUBREGIONS && this != VOICE_GROUP && this != OTHER_MAPS_GROUP;
|
||||
}
|
||||
|
||||
public boolean isHeader() {
|
||||
return this == VOICE_HEADER_REC || this == VOICE_HEADER_TTS || this == SUBREGIONS || this == WORLD_MAPS
|
||||
|| this == REGION_MAPS || this == VOICE_GROUP || this == HILLSHADE_HEADER || this == SRTM_HEADER;
|
||||
return this == VOICE_HEADER_REC || this == VOICE_HEADER_TTS || this == SUBREGIONS
|
||||
|| this == WORLD_MAPS || this == REGION_MAPS || this == VOICE_GROUP
|
||||
|| this == HILLSHADE_HEADER || this == SRTM_HEADER
|
||||
|| this == OTHER_MAPS_HEADER || this == OTHER_MAPS_GROUP;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -190,7 +190,13 @@ public class DownloadResources extends DownloadResourceGroup {
|
|||
|
||||
protected boolean prepareData(List<IndexItem> resources) {
|
||||
this.rawResources = resources;
|
||||
|
||||
|
||||
DownloadResourceGroup otherMapsGroup = new DownloadResourceGroup(this, DownloadResourceGroupType.OTHER_MAPS_GROUP);
|
||||
DownloadResourceGroup otherMapsScreen = new DownloadResourceGroup(otherMapsGroup, DownloadResourceGroupType.OTHER_MAPS);
|
||||
DownloadResourceGroup otherMaps = new DownloadResourceGroup(otherMapsGroup, DownloadResourceGroupType.OTHER_MAPS_HEADER);
|
||||
otherMapsScreen.addGroup(otherMaps);
|
||||
otherMapsGroup.addGroup(otherMapsScreen);
|
||||
|
||||
DownloadResourceGroup voiceGroup = new DownloadResourceGroup(this, DownloadResourceGroupType.VOICE_GROUP);
|
||||
DownloadResourceGroup voiceScreenRec = new DownloadResourceGroup(voiceGroup, DownloadResourceGroupType.VOICE_REC);
|
||||
DownloadResourceGroup voiceScreenTTS = new DownloadResourceGroup(voiceGroup, DownloadResourceGroupType.VOICE_TTS);
|
||||
|
@ -226,7 +232,11 @@ public class DownloadResources extends DownloadResourceGroup {
|
|||
}
|
||||
groupByRegion.get(wg).add(ii);
|
||||
} else {
|
||||
worldMaps.addItem(ii);
|
||||
if (ii.getFileName().startsWith("World_")) {
|
||||
worldMaps.addItem(ii);
|
||||
} else {
|
||||
otherMaps.addItem(ii);
|
||||
}
|
||||
}
|
||||
}
|
||||
LinkedList<WorldRegion> queue = new LinkedList<WorldRegion>();
|
||||
|
@ -266,6 +276,9 @@ public class DownloadResources extends DownloadResourceGroup {
|
|||
// 2. if there is no subregions and there only 1 index item it could be merged to the level up - objection there is no such maps
|
||||
// 3. if hillshade/srtm is disabled, all maps from inner level could be combined into 1
|
||||
addGroup(worldMaps);
|
||||
if (otherMaps.size() > 0) {
|
||||
addGroup(otherMapsGroup);
|
||||
}
|
||||
addGroup(voiceGroup);
|
||||
createHillshadeSRTMGroups();
|
||||
trimEmptyGroups();
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.osmand.PlatformUtil;
|
|||
import net.osmand.map.OsmandRegions;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.helpers.FileNameTranslationHelper;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
|
@ -126,7 +127,13 @@ public class IndexItem implements Comparable<IndexItem> {
|
|||
}
|
||||
|
||||
private File getTargetFile(OsmandApplication ctx) {
|
||||
return new File(type.getDownloadFolder(ctx, this), getBasename() + type.getUnzipExtension(ctx, this));
|
||||
String basename;
|
||||
if (type == DownloadActivityType.HILLSHADE_FILE) {
|
||||
basename = (FileNameTranslationHelper.HILL_SHADE + getBasename()).replace("_", " ");
|
||||
} else {
|
||||
basename = getBasename();
|
||||
}
|
||||
return new File(type.getDownloadFolder(ctx, this), basename + type.getUnzipExtension(ctx, this));
|
||||
}
|
||||
|
||||
public File getBackupFile(OsmandApplication ctx) {
|
||||
|
|
|
@ -138,7 +138,8 @@ public class ItemViewHolder {
|
|||
}
|
||||
int color = textColorSecondary;
|
||||
if(indexItem.isDownloaded() && !isDownloading) {
|
||||
int colorId = indexItem.isOutdated() ? R.color.color_distance : R.color.color_ok;
|
||||
int colorId = indexItem.getType() != DownloadActivityType.HILLSHADE_FILE &&
|
||||
indexItem.isOutdated() ? R.color.color_distance : R.color.color_ok;
|
||||
color = context.getResources().getColor(colorId);
|
||||
}
|
||||
if (indexItem.isDownloaded()) {
|
||||
|
|
Loading…
Reference in a new issue