Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
e726a0cc99
2 changed files with 29 additions and 4 deletions
|
@ -1091,6 +1091,7 @@ 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();
|
||||
|
|
|
@ -47,6 +47,9 @@ import net.osmand.plus.activities.MapActivity;
|
|||
import net.osmand.plus.helpers.TwoFingerTapDetector;
|
||||
import net.osmand.plus.views.MultiTouchSupport.MultiTouchZoomListener;
|
||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||
import net.osmand.render.RenderingRuleSearchRequest;
|
||||
import net.osmand.render.RenderingRuleStorageProperties;
|
||||
import net.osmand.render.RenderingRulesStorage;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
@ -61,6 +64,7 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
private static final int MAP_FORCE_REFRESH_MESSAGE = OsmAndConstants.UI_HANDLER_MAP_VIEW + 5;
|
||||
private static final int BASE_REFRESH_MESSAGE = OsmAndConstants.UI_HANDLER_MAP_VIEW + 3;
|
||||
protected final static int LOWEST_ZOOM_TO_ROTATE = 9;
|
||||
private static final int MAP_DEFAULT_COLOR = 0xffebe7e4;
|
||||
private boolean MEASURE_FPS = false;
|
||||
private FPSMeasurement main = new FPSMeasurement();
|
||||
private FPSMeasurement additional = new FPSMeasurement();
|
||||
|
@ -68,6 +72,7 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
private Activity activity;
|
||||
private OsmandApplication application;
|
||||
protected OsmandSettings settings = null;
|
||||
private Integer defaultColor = null;
|
||||
|
||||
private class FPSMeasurement {
|
||||
int fpsMeasureCount = 0;
|
||||
|
@ -103,6 +108,10 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
public boolean onPressEvent(PointF point);
|
||||
}
|
||||
|
||||
public int getDefaultColor() {
|
||||
return defaultColor;
|
||||
}
|
||||
|
||||
protected static final Log LOG = PlatformUtil.getLog(OsmandMapTileView.class);
|
||||
|
||||
|
||||
|
@ -592,13 +601,28 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
}
|
||||
|
||||
private void fillCanvas(Canvas canvas, DrawSettings drawSettings) {
|
||||
if (drawSettings.isNightMode()) {
|
||||
canvas.drawARGB(255, 100, 100, 100);
|
||||
} else {
|
||||
canvas.drawARGB(255, 225, 225, 225);
|
||||
Integer color = defaultColor;
|
||||
if (color == null) {
|
||||
color = updateDefaultColor(drawSettings.isNightMode());
|
||||
}
|
||||
canvas.drawColor(color);
|
||||
}
|
||||
|
||||
public void resetDefaultColor() {
|
||||
defaultColor = null;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
public boolean isMeasureFPS() {
|
||||
return MEASURE_FPS;
|
||||
|
|
Loading…
Reference in a new issue