From a61a7e2d0311639e95a9f6308b2b95605527fd44 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Wed, 19 Jul 2017 15:27:26 +0300 Subject: [PATCH] Fix defaultColor --- .../src/net/osmand/plus/activities/MapActivity.java | 5 ++++- .../src/net/osmand/plus/views/OsmandMapTileView.java | 12 +++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index ae489b9066..c43e653a44 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -1091,12 +1091,15 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven if (mapView.getMapRenderer() != null) { NativeCoreContext.getMapRendererContext().updateMapSettings(); } - mapView.resetDefaultColor(); if (registry.getCurrentSelectedRenderer() != newRenderer) { registry.setCurrentSelectedRender(newRenderer); app.getResourceManager().getRenderer().clearCache(); + mapView.resetDefaultColor(); mapView.refreshMap(true); + } else { + mapView.resetDefaultColor(); } + return null; } diff --git a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java index d47a9a1b8b..b14fd6f510 100644 --- a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java +++ b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java @@ -615,11 +615,13 @@ public class OsmandMapTileView implements IMapDownloaderCallback { private int updateDefaultColor(boolean nightMode) { int color = MAP_DEFAULT_COLOR; RenderingRulesStorage rrs = application.getRendererRegistry().getCurrentSelectedRenderer(); - RenderingRuleSearchRequest req = new RenderingRuleSearchRequest(rrs); - req.setBooleanFilter(rrs.PROPS.R_NIGHT_MODE, nightMode); - if (req.searchRenderingAttribute(RenderingRuleStorageProperties.A_DEFAULT_COLOR)) { - color = req.getIntPropertyValue(req.ALL.R_ATTR_COLOR_VALUE); - defaultColor = color; + if (rrs != null) { + RenderingRuleSearchRequest req = new RenderingRuleSearchRequest(rrs); + req.setBooleanFilter(rrs.PROPS.R_NIGHT_MODE, nightMode); + if (req.searchRenderingAttribute(RenderingRuleStorageProperties.A_DEFAULT_COLOR)) { + color = req.getIntPropertyValue(req.ALL.R_ATTR_COLOR_VALUE); + defaultColor = color; + } } return color; }