Fix defaultColor

This commit is contained in:
Alexey Kulish 2017-07-19 15:27:26 +03:00
parent e726a0cc99
commit a61a7e2d03
2 changed files with 11 additions and 6 deletions

View file

@ -1091,12 +1091,15 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
if (mapView.getMapRenderer() != null) { if (mapView.getMapRenderer() != null) {
NativeCoreContext.getMapRendererContext().updateMapSettings(); NativeCoreContext.getMapRendererContext().updateMapSettings();
} }
mapView.resetDefaultColor();
if (registry.getCurrentSelectedRenderer() != newRenderer) { if (registry.getCurrentSelectedRenderer() != newRenderer) {
registry.setCurrentSelectedRender(newRenderer); registry.setCurrentSelectedRender(newRenderer);
app.getResourceManager().getRenderer().clearCache(); app.getResourceManager().getRenderer().clearCache();
mapView.resetDefaultColor();
mapView.refreshMap(true); mapView.refreshMap(true);
} else {
mapView.resetDefaultColor();
} }
return null; return null;
} }

View file

@ -615,11 +615,13 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
private int updateDefaultColor(boolean nightMode) { private int updateDefaultColor(boolean nightMode) {
int color = MAP_DEFAULT_COLOR; int color = MAP_DEFAULT_COLOR;
RenderingRulesStorage rrs = application.getRendererRegistry().getCurrentSelectedRenderer(); RenderingRulesStorage rrs = application.getRendererRegistry().getCurrentSelectedRenderer();
RenderingRuleSearchRequest req = new RenderingRuleSearchRequest(rrs); if (rrs != null) {
req.setBooleanFilter(rrs.PROPS.R_NIGHT_MODE, nightMode); RenderingRuleSearchRequest req = new RenderingRuleSearchRequest(rrs);
if (req.searchRenderingAttribute(RenderingRuleStorageProperties.A_DEFAULT_COLOR)) { req.setBooleanFilter(rrs.PROPS.R_NIGHT_MODE, nightMode);
color = req.getIntPropertyValue(req.ALL.R_ATTR_COLOR_VALUE); if (req.searchRenderingAttribute(RenderingRuleStorageProperties.A_DEFAULT_COLOR)) {
defaultColor = color; color = req.getIntPropertyValue(req.ALL.R_ATTR_COLOR_VALUE);
defaultColor = color;
}
} }
return color; return color;
} }