diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml index 1092beadc0..fa6e47e2b0 100644 --- a/OsmAnd/AndroidManifest.xml +++ b/OsmAnd/AndroidManifest.xml @@ -62,11 +62,14 @@ + + @@ -76,15 +79,6 @@ - - - - - - - - diff --git a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java index 298ea99e58..b27f731b54 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java @@ -10,6 +10,7 @@ import net.osmand.plus.activities.ApplicationMode; import net.osmand.plus.activities.MapActivity; import android.content.Context; import android.graphics.Canvas; +import android.graphics.Color; import android.graphics.PointF; import android.graphics.Rect; import android.graphics.RectF; @@ -42,6 +43,7 @@ public class MapControlsLayer extends OsmandMapLayer { private Handler showUIHandler; private boolean showZoomLevel = false; + private int shadowColor = Color.WHITE; private Button zoomInButton; @@ -203,7 +205,7 @@ public class MapControlsLayer extends OsmandMapLayer { zoomShadow.draw(canvas); ShadowText.draw(zoomText, canvas, zoomInButton.getLeft() + (zoomInButton.getWidth() - length - 2) / 2, - zoomInButton.getTop() + 4 * scaleCoefficient, zoomTextPaint); + zoomInButton.getTop() + 4 * scaleCoefficient, zoomTextPaint, shadowColor); } private void hideZoomLevelInTime(){ @@ -436,7 +438,7 @@ public class MapControlsLayer extends OsmandMapLayer { rulerDrawable.draw(canvas); Rect bounds = rulerDrawable.getBounds(); cacheRulerText.draw(canvas, bounds.left + (bounds.width() - cacheRulerTextLen) / 2, bounds.bottom - 8 * scaleCoefficient, - rulerTextPaint); + rulerTextPaint, shadowColor); } } diff --git a/OsmAnd/src/net/osmand/plus/views/MapInfoControl.java b/OsmAnd/src/net/osmand/plus/views/MapInfoControl.java index 95ec0a40d7..0c6cbb794c 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapInfoControl.java +++ b/OsmAnd/src/net/osmand/plus/views/MapInfoControl.java @@ -2,6 +2,7 @@ package net.osmand.plus.views; import android.content.Context; import android.graphics.Canvas; +import android.graphics.Color; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.drawable.Drawable; @@ -11,6 +12,7 @@ public abstract class MapInfoControl extends View implements MapControlUpdateabl int width = 0; int height = 0; Rect padding = new Rect(); + int shadowColor = Color.WHITE; public MapInfoControl(Context ctx) { super(ctx); @@ -46,7 +48,15 @@ public abstract class MapInfoControl extends View implements MapControlUpdateabl } protected void drawShadowText(Canvas cv, String text, float centerX, float centerY, Paint textPaint) { - ShadowText.draw(text, cv, centerX, centerY, textPaint); + ShadowText.draw(text, cv, centerX, centerY, textPaint, shadowColor); + } + + public void setShadowColor(int shadowColor) { + this.shadowColor = shadowColor; + } + + public int getShadowColor() { + return shadowColor; } @Override diff --git a/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java b/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java index acff306205..46cdf07d55 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapInfoLayer.java @@ -602,6 +602,7 @@ public class MapInfoLayer extends OsmandMapLayer { public void onDraw(Canvas canvas, RectF latlonBounds, RectF tilesRect, DrawSettings nightMode) { boolean bold = routeLayer.getHelper().isFollowingMode(); int color = !nightMode.isNightMode() ? Color.BLACK : Color.BLACK; + int shadowColor = nightMode.isNightMode() ? Color.TRANSPARENT : Color.WHITE; if(paintText.getColor() != color) { paintText.setColor(color); topText.setTextColor(color); @@ -616,9 +617,12 @@ public class MapInfoLayer extends OsmandMapLayer { paintSmallText.setFakeBoldText(bold); paintSmallSubText.setFakeBoldText(bold); } + if(topText.getShadowColor() != shadowColor) { + topText.setShadowColor(shadowColor); + } // update data on draw - rightStack.updateInfo(); - leftStack.updateInfo(); + rightStack.updateInfo(shadowColor); + leftStack.updateInfo(shadowColor); lanesControl.updateInfo(); alarmControl.updateInfo(); for (int i = 0; i < statusBar.getChildCount(); i++) { @@ -742,6 +746,7 @@ public class MapInfoLayer extends OsmandMapLayer { private static class TopTextView extends TextView implements MapControlUpdateable { private final RoutingHelper routingHelper; private final MapActivity map; + private int shadowColor = Color.WHITE; public TopTextView(RoutingHelper routingHelper, MapActivity map) { super(map); @@ -754,7 +759,15 @@ public class MapInfoLayer extends OsmandMapLayer { @Override protected void onDraw(Canvas canvas) { ShadowText.draw(getText().toString(), canvas, getWidth() / 2, getHeight() - 4 * scaleCoefficient, - getPaint()); + getPaint(), shadowColor); + } + + public void setShadowColor(int shadowColor) { + this.shadowColor = shadowColor; + } + + public int getShadowColor() { + return shadowColor; } @Override diff --git a/OsmAnd/src/net/osmand/plus/views/MapStackControl.java b/OsmAnd/src/net/osmand/plus/views/MapStackControl.java index 5387bd5aaf..736c87c865 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapStackControl.java +++ b/OsmAnd/src/net/osmand/plus/views/MapStackControl.java @@ -72,13 +72,19 @@ public class MapStackControl extends ViewGroup { this.cacheStackDrawables.clear(); } - public void updateInfo() { + public void updateInfo(int shadowColor) { for (MapInfoControl v : stackViews) { v.updateInfo(); + if(v.getShadowColor() != shadowColor) { + v.setShadowColor(shadowColor); + } } // update even if collapsed to know if view becomes visible for (MapInfoControl v : collapsedViews) { v.updateInfo(); + if(v.getShadowColor() != shadowColor) { + v.setShadowColor(shadowColor); + } } } diff --git a/OsmAnd/src/net/osmand/plus/views/ShadowText.java b/OsmAnd/src/net/osmand/plus/views/ShadowText.java index dc18a6fd19..07b18355cc 100644 --- a/OsmAnd/src/net/osmand/plus/views/ShadowText.java +++ b/OsmAnd/src/net/osmand/plus/views/ShadowText.java @@ -17,13 +17,13 @@ public class ShadowText { - public void draw(Canvas cv, float centerX, float centerY, Paint textPaint) { - draw(text, cv, centerX, centerY, textPaint); + public void draw(Canvas cv, float centerX, float centerY, Paint textPaint, int shadowColor) { + draw(text, cv, centerX, centerY, textPaint, shadowColor); } - public static void draw(String text, Canvas cv, float centerX, float centerY, Paint textPaint) { + public static void draw(String text, Canvas cv, float centerX, float centerY, Paint textPaint, int shadowColor) { int c = textPaint.getColor(); textPaint.setStyle(Style.STROKE); - textPaint.setColor(Color.WHITE); + textPaint.setColor(shadowColor); textPaint.setStrokeWidth(4); cv.drawText(text, centerX, centerY, textPaint); // reset