Update default values
This commit is contained in:
parent
731e4b87c2
commit
eee2db4a38
6 changed files with 41 additions and 36400 deletions
File diff suppressed because it is too large
Load diff
|
@ -30,6 +30,7 @@ public class RenderingRuleProperty {
|
|||
// use for custom rendering rule properties
|
||||
protected String name;
|
||||
protected String description;
|
||||
protected String defaultValueDescription;
|
||||
protected String[] possibleValues;
|
||||
protected String category;
|
||||
|
||||
|
@ -74,6 +75,10 @@ public class RenderingRuleProperty {
|
|||
return description;
|
||||
}
|
||||
|
||||
public String getDefaultValueDescription() {
|
||||
return defaultValueDescription;
|
||||
}
|
||||
|
||||
protected void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
@ -82,6 +87,10 @@ public class RenderingRuleProperty {
|
|||
this.description = description;
|
||||
}
|
||||
|
||||
public void setDefaultValueDescription(String defaultValueDescription) {
|
||||
this.defaultValueDescription = defaultValueDescription;
|
||||
}
|
||||
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
|
|
@ -287,6 +287,7 @@ public class RenderingRulesStorage {
|
|||
prop = RenderingRuleProperty.createInputIntProperty(attr);
|
||||
}
|
||||
prop.setDescription(parser.getAttributeValue("", "description"));
|
||||
prop.setDefaultValueDescription(parser.getAttributeValue("", "defaultValueDescription"));
|
||||
prop.setCategory(parser.getAttributeValue("", "category"));
|
||||
prop.setName(parser.getAttributeValue("", "name"));
|
||||
if(parser.getAttributeValue("", "possibleValues") != null){
|
||||
|
|
|
@ -31,6 +31,7 @@ import net.osmand.core.android.MapRendererContext;
|
|||
import net.osmand.render.RenderingRuleProperty;
|
||||
import net.osmand.render.RenderingRuleStorageProperties;
|
||||
import net.osmand.render.RenderingRulesStorage;
|
||||
import net.osmand.util.Algorithms;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.content.Context;
|
||||
|
@ -552,7 +553,13 @@ public class ConfigureMapMenu {
|
|||
} else {
|
||||
final OsmandSettings.CommonPreference<String> pref = view.getApplication().getSettings()
|
||||
.getCustomRenderProperty(p.getAttrName());
|
||||
String descr = SettingsActivity.getStringPropertyValue(activity, pref.get());
|
||||
String descr;
|
||||
if(Algorithms.isEmpty(pref.get())) {
|
||||
descr = SettingsActivity.getStringPropertyValue(activity, pref.get());
|
||||
} else {
|
||||
descr = SettingsActivity.getStringPropertyValue(view.getContext(),
|
||||
p.getDefaultValueDescription());
|
||||
}
|
||||
adapter.item(propertyName).listen(new OnContextMenuClick() {
|
||||
|
||||
@Override
|
||||
|
@ -562,18 +569,27 @@ public class ConfigureMapMenu {
|
|||
b.setTitle(propertyDescr);
|
||||
|
||||
int i = Arrays.asList(p.getPossibleValues()).indexOf(pref.get());
|
||||
if(Algorithms.isEmpty(pref.get())) {
|
||||
i = 0;
|
||||
}
|
||||
|
||||
String[] possibleValuesString = new String[p.getPossibleValues().length];
|
||||
String[] possibleValuesString = new String[p.getPossibleValues().length + 1];
|
||||
possibleValuesString[0] = SettingsActivity.getStringPropertyValue(view.getContext(),
|
||||
p.getDefaultValueDescription());
|
||||
|
||||
for (int j = 0; j < p.getPossibleValues().length; j++) {
|
||||
possibleValuesString[j] = SettingsActivity.getStringPropertyValue(view.getContext(),
|
||||
possibleValuesString[j + 1] = SettingsActivity.getStringPropertyValue(view.getContext(),
|
||||
p.getPossibleValues()[j]);
|
||||
}
|
||||
|
||||
b.setSingleChoiceItems(possibleValuesString, i, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
pref.set(p.getPossibleValues()[which]);
|
||||
if(which == 0) {
|
||||
pref.set("");
|
||||
} else {
|
||||
pref.set(p.getPossibleValues()[which - 1]);
|
||||
}
|
||||
refreshMapComplete(activity);
|
||||
adapter.setItemDescription(pos, SettingsActivity.getStringPropertyValue(activity, pref.get()));
|
||||
dialog.dismiss();
|
||||
|
|
|
@ -622,8 +622,6 @@ public class MapRenderRepositories {
|
|||
if (!Algorithms.isEmpty(res)) {
|
||||
if (customProp.isString()) {
|
||||
renderingReq.setStringFilter(customProp, res);
|
||||
} else if (customProp.isBoolean()) {
|
||||
renderingReq.setBooleanFilter(customProp, "true".equalsIgnoreCase(res));
|
||||
} else {
|
||||
try {
|
||||
renderingReq.setIntFilter(customProp, Integer.parseInt(res));
|
||||
|
@ -631,6 +629,10 @@ public class MapRenderRepositories {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (customProp.isString()) {
|
||||
renderingReq.setStringFilter(customProp, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import net.osmand.IProgress;
|
|||
import net.osmand.IndexConstants;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.render.DefaultRenderingRulesStorage;
|
||||
import net.osmand.render.RenderingRulesStorage;
|
||||
import net.osmand.render.RenderingRulesStorage.RenderingRulesStorageResolver;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
@ -91,15 +90,15 @@ public class RendererRegistry {
|
|||
return externalRenderers.containsKey(name) || internalRenderers.containsKey(name);
|
||||
}
|
||||
|
||||
private static boolean USE_PRECOMPILED_STYLE = false;
|
||||
// private static boolean USE_PRECOMPILED_STYLE = false;
|
||||
private RenderingRulesStorage loadRenderer(String name, final Map<String, RenderingRulesStorage> loadedRenderers,
|
||||
final Map<String, String> renderingConstants) throws IOException, XmlPullParserException {
|
||||
if ((name.equals(DEFAULT_RENDER) || name.equalsIgnoreCase("default")) && USE_PRECOMPILED_STYLE) {
|
||||
RenderingRulesStorage rrs = new RenderingRulesStorage("", null);
|
||||
new DefaultRenderingRulesStorage().createStyle(rrs);
|
||||
log.info("INIT rendering from class");
|
||||
return rrs;
|
||||
}
|
||||
// if ((name.equals(DEFAULT_RENDER) || name.equalsIgnoreCase("default")) && USE_PRECOMPILED_STYLE) {
|
||||
// RenderingRulesStorage rrs = new RenderingRulesStorage("", null);
|
||||
// new DefaultRenderingRulesStorage().createStyle(rrs);
|
||||
// log.info("INIT rendering from class");
|
||||
// return rrs;
|
||||
// }
|
||||
InputStream is = getInputStream(name);
|
||||
if(is == null) {
|
||||
return null;
|
||||
|
|
Loading…
Reference in a new issue