This commit is contained in:
Victor Shcherb 2015-11-08 00:17:35 +01:00
parent 0b4e03ec7e
commit a7e0d514bc
3 changed files with 5 additions and 4 deletions

View file

@ -1794,9 +1794,9 @@ public class OsmandSettings {
} }
Map<String, CommonPreference<String>> customRoutingProps = new LinkedHashMap<String, OsmandSettings.CommonPreference<String>>(); Map<String, CommonPreference<String>> customRoutingProps = new LinkedHashMap<String, OsmandSettings.CommonPreference<String>>();
public CommonPreference<String> getCustomRoutingProperty(String attrName){ public CommonPreference<String> getCustomRoutingProperty(String attrName, String defValue){
if(!customRoutingProps.containsKey(attrName)){ if(!customRoutingProps.containsKey(attrName)){
customRoutingProps.put(attrName, new StringPreference("prouting_"+attrName, "-").makeProfile()); customRoutingProps.put(attrName, new StringPreference("prouting_"+attrName, defValue).makeProfile());
} }
return customRoutingProps.get(attrName); return customRoutingProps.get(attrName);
} }

View file

@ -271,7 +271,8 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
for(Object o : vls) { for(Object o : vls) {
svlss[i++] = o.toString(); svlss[i++] = o.toString();
} }
basePref = createListPreference(settings.getCustomRoutingProperty(p.getId()), basePref = createListPreference(settings.getCustomRoutingProperty(p.getId(),
p.getType() == RoutingParameterType.NUMERIC ? "0" : "-"),
p.getPossibleValueDescriptions(), svlss, p.getPossibleValueDescriptions(), svlss,
SettingsBaseActivity.getRoutingStringPropertyName(this, p.getId(), p.getName()), SettingsBaseActivity.getRoutingStringPropertyName(this, p.getId(), p.getName()),
SettingsBaseActivity.getRoutingStringPropertyDescription(this, p.getId(), p.getDescription())); SettingsBaseActivity.getRoutingStringPropertyDescription(this, p.getId(), p.getDescription()));

View file

@ -742,7 +742,7 @@ public class RouteProvider {
Boolean bool = pref.getModeValue(params.mode); Boolean bool = pref.getModeValue(params.mode);
vl = bool ? "true" : null; vl = bool ? "true" : null;
} else { } else {
vl = settings.getCustomRoutingProperty(key).getModeValue(params.mode); vl = settings.getCustomRoutingProperty(key, "").getModeValue(params.mode);
} }
if(vl != null && vl.length() > 0) { if(vl != null && vl.length() > 0) {
paramsR.put(key, vl); paramsR.put(key, vl);