Update download items

This commit is contained in:
vshcherb 2014-04-15 01:26:40 +02:00
parent 9ffb4490d7
commit a7a5639969
3 changed files with 40 additions and 8 deletions

View file

@ -17,9 +17,6 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import net.osmand.Collator;
import net.osmand.CollatorStringMatcher;
import net.osmand.OsmAndCollator;
import net.osmand.ResultMatcher;
import net.osmand.binary.BinaryMapDataObject;
import net.osmand.binary.BinaryMapIndexReader;
@ -244,11 +241,9 @@ public class OsmandRegions {
@Override
public boolean publish(BinaryMapDataObject object) {
if (object.getPointsLength() < 1) {
return false;
}
initTypes(object);
String downloadName = object.getNameByType(downloadNameType).toLowerCase();
String prefix = object.getNameByType(prefixType);
String locName = getLocaleName(object);
if(locName != null && locName.length() > 0){
downloadNamesToLocaleNames.put(downloadName, locName);
@ -257,6 +252,8 @@ public class OsmandRegions {
TIntObjectIterator<String> it = object.getObjectNames().iterator();
StringBuilder ind = new StringBuilder();
String pr = getDownloadNameIndexLowercase(prefix);
ind.append(pr == null ? prefix.toLowerCase() : pr.toLowerCase()).append(" ");
while(it.hasNext()) {
it.advance();
TagValuePair tp = mi.decodeType(it.key());

View file

@ -9,6 +9,13 @@
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="index_item_nation_addresses">addresses nationwide</string>
<string name="index_item_world_altitude_correction">World altitude correcion</string>
<string name="index_item_world_seamarks">World seamarks</string>
<string name="index_item_world_bitcoin_payments">World bitcoin payments</string>
<string name="index_item_world_basemap">World overview map</string>
<string name="index_item_world_ski">World ski map</string>
<string name="lang_hr">Croatian</string>
<string name="lang_zh">Chinese</string>
<string name="lang_pt_br">Portuguese (Brazil)</string>
<string name="lang_en">English</string>

View file

@ -66,7 +66,7 @@ public class IndexItem implements Comparable<IndexItem> {
public String getVoiceName(Context ctx) {
try {
String nm = getBasename().replace('-', '_').replace(' ', '_');
if (nm.endsWith("-tts")) {
if (nm.endsWith("_tts")) {
nm = nm.substring(0, nm.length() - 4);
}
Field f = R.string.class.getField("lang_"+nm);
@ -86,7 +86,35 @@ public class IndexItem implements Comparable<IndexItem> {
} else if (fileName.endsWith(IndexConstants.TTSVOICE_INDEX_EXT_ZIP)) {
return ctx.getString(R.string.ttsvoice) + "\n" + getVoiceName(ctx);
}
return osmandRegions.getLocaleName(getBasename());
final String bn = getBasename();
final String lc = bn.toLowerCase();
String std = 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());
return osmandRegions.getLocaleName(downloadName) +
" "+ ctx.getString(R.string.index_item_nation_addresses);
}
return osmandRegions.getLocaleName(lc);
}
private String getStandardMapName(Context ctx, String basename) {
if(basename.equals("world-ski")) {
return ctx.getString(R.string.index_item_world_ski);
} else if(basename.equals("world_altitude_correction_ww15mgh")) {
return ctx.getString(R.string.index_item_world_altitude_correction);
} else if(basename.equals("world_basemap")) {
return ctx.getString(R.string.index_item_world_basemap);
} else if(basename.equals("world_bitcoin_payments")) {
return ctx.getString(R.string.index_item_world_bitcoin_payments);
} else if(basename.equals("world_seamarks")) {
return ctx.getString(R.string.index_item_world_seamarks);
}
return null;
}
public boolean isVoiceItem() {