Fix issues
This commit is contained in:
parent
cd6675b64f
commit
9d7236139b
4 changed files with 34 additions and 20 deletions
|
@ -52,7 +52,7 @@ public class OsmandRegions {
|
|||
private String locale = "en";
|
||||
private static final org.apache.commons.logging.Log LOG = PlatformUtil.getLog(OsmandRegions.class);
|
||||
|
||||
WorldRegion worldRegion = new WorldRegion(WorldRegion.WORLD, WorldRegion.WORLD);
|
||||
WorldRegion worldRegion = new WorldRegion(WorldRegion.WORLD);
|
||||
Map<String, WorldRegion> fullNamesToRegionData = new HashMap<String, WorldRegion>();
|
||||
Map<String, String> downloadNamesToFullNames = new HashMap<String, String>();
|
||||
Map<String, LinkedList<BinaryMapDataObject>> countriesByDownloadName = new HashMap<String, LinkedList<BinaryMapDataObject>>();
|
||||
|
@ -133,12 +133,6 @@ public class OsmandRegions {
|
|||
if(parent != null && rd != null) {
|
||||
parent.addSubregion(rd);
|
||||
}
|
||||
if(rd != null) {
|
||||
rd.superregion = parent;
|
||||
}
|
||||
if(parent != null) {
|
||||
parent.subregions.add(rd);
|
||||
}
|
||||
}
|
||||
structureWorldRegions(new ArrayList<WorldRegion>(fullNamesToRegionData.values()));
|
||||
}
|
||||
|
@ -162,8 +156,20 @@ public class OsmandRegions {
|
|||
if(rd == null) {
|
||||
return fullName.replace('_', ' ');
|
||||
}
|
||||
if (includingParent && rd.superregion != null) {
|
||||
return rd.superregion.getLocaleName() + " " + rd.getLocaleName();
|
||||
if (includingParent && rd.getSuperregion() != null && rd.getSuperregion().getSuperregion() != null) {
|
||||
WorldRegion parentParent = rd.getSuperregion().getSuperregion();
|
||||
WorldRegion parent = rd.getSuperregion();
|
||||
if(parentParent.getRegionId().equals(WorldRegion.WORLD) &&
|
||||
!parent.getRegionId().equals(WorldRegion.RUSSIA_REGION_ID)) {
|
||||
return rd.getLocaleName();
|
||||
}
|
||||
if(parentParent.getRegionId().equals(WorldRegion.RUSSIA_REGION_ID)) {
|
||||
return parentParent.getRegionId() + " " + rd.getLocaleName();
|
||||
}
|
||||
if(parentParent.getRegionId().equals(WorldRegion.JAPAN_REGION_ID)) {
|
||||
return parentParent.getRegionId() + " " + rd.getLocaleName();
|
||||
}
|
||||
return parent.getLocaleName() + " " + rd.getLocaleName();
|
||||
} else {
|
||||
return rd.getLocaleName();
|
||||
}
|
||||
|
@ -589,20 +595,25 @@ public class OsmandRegions {
|
|||
initWorldRegion(world, WorldRegion.NORTH_AMERICA_REGION_ID);
|
||||
initWorldRegion(world, WorldRegion.RUSSIA_REGION_ID);
|
||||
initWorldRegion(world, WorldRegion.SOUTH_AMERICA_REGION_ID);
|
||||
initWorldRegion(world, WorldRegion.AUSTRALIA_AND_OCEANIA_REGION_ID);
|
||||
Iterator<WorldRegion> it = loadedItems.iterator();
|
||||
while(it.hasNext()) {
|
||||
WorldRegion region = it.next();
|
||||
if(region.superregion == null) {
|
||||
boolean found = false;
|
||||
for(WorldRegion worldSubregion : world.subregions) {
|
||||
if(worldSubregion.getRegionId().equalsIgnoreCase(region.regionParentFullName)) {
|
||||
worldSubregion.subregions.add(region);
|
||||
if(worldSubregion.getRegionId().equalsIgnoreCase(region.regionFullName)) {
|
||||
for(WorldRegion rg : region.subregions) {
|
||||
worldSubregion.addSubregion(rg);
|
||||
}
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(found) {
|
||||
it.remove();
|
||||
} else if(region.getRegionId().contains("basemap")) {
|
||||
it.remove();
|
||||
}
|
||||
} else {
|
||||
it.remove();
|
||||
|
|
|
@ -16,6 +16,7 @@ public class WorldRegion {
|
|||
public static final String EUROPE_REGION_ID = "europe";
|
||||
public static final String NORTH_AMERICA_REGION_ID = "northamerica";
|
||||
public static final String RUSSIA_REGION_ID = "russia";
|
||||
public static final String JAPAN_REGION_ID = "japan_asia";
|
||||
public static final String SOUTH_AMERICA_REGION_ID = "southamerica";
|
||||
protected static final String WORLD = "world";
|
||||
|
||||
|
|
|
@ -331,6 +331,8 @@ public class AppInitializer implements IProgress {
|
|||
public String getTranslation(String id) {
|
||||
if(WorldRegion.AFRICA_REGION_ID.equals(id)){
|
||||
return app.getString(R.string.index_name_africa);
|
||||
} else if(WorldRegion.AUSTRALIA_AND_OCEANIA_REGION_ID.equals(id)){
|
||||
return app.getString(R.string.index_name_oceania);
|
||||
} else if(WorldRegion.ASIA_REGION_ID.equals(id)){
|
||||
return app.getString(R.string.index_name_asia);
|
||||
} else if(WorldRegion.CENTRAL_AMERICA_REGION_ID.equals(id)){
|
||||
|
|
|
@ -266,26 +266,26 @@ public class DownloadActivityType {
|
|||
}
|
||||
return getBasename(indexItem);
|
||||
}
|
||||
final String bn = getBasename(indexItem);
|
||||
if (bn.endsWith(FileNameTranslationHelper.WIKI_NAME)){
|
||||
return FileNameTranslationHelper.getWikiName(ctx,bn);
|
||||
final String basename = getBasename(indexItem);
|
||||
if (basename.endsWith(FileNameTranslationHelper.WIKI_NAME)){
|
||||
return FileNameTranslationHelper.getWikiName(ctx,basename);
|
||||
}
|
||||
// if (this == HILLSHADE_FILE){
|
||||
// return FileNameTranslationHelper.getHillShadeName(ctx, osmandRegions, bn);
|
||||
// }
|
||||
final String lc = bn.toLowerCase();
|
||||
final String lc = basename.toLowerCase();
|
||||
String std = FileNameTranslationHelper.getStandardMapName(ctx, lc);
|
||||
if (std != null) {
|
||||
return std;
|
||||
}
|
||||
if (bn.contains("addresses-nationwide")) {
|
||||
final int ind = bn.indexOf("addresses-nationwide");
|
||||
String downloadName = bn.substring(0, ind - 1) + bn.substring(ind + "addresses-nationwide".length());
|
||||
if (basename.contains("addresses-nationwide")) {
|
||||
final int ind = basename.indexOf("addresses-nationwide");
|
||||
String downloadName = basename.substring(0, ind - 1) + basename.substring(ind + "addresses-nationwide".length());
|
||||
return osmandRegions.getLocaleName(downloadName, includingParent) +
|
||||
" "+ ctx.getString(R.string.index_item_nation_addresses);
|
||||
}
|
||||
|
||||
return osmandRegions.getLocaleName(bn, includingParent);
|
||||
return osmandRegions.getLocaleName(basename, includingParent);
|
||||
}
|
||||
|
||||
public String getTargetFileName(IndexItem item) {
|
||||
|
|
Loading…
Reference in a new issue