diff --git a/OsmAnd/res/values/attrs.xml b/OsmAnd/res/values/attrs.xml index 9a153cd6504..dee8dedf6b9 100644 --- a/OsmAnd/res/values/attrs.xml +++ b/OsmAnd/res/values/attrs.xml @@ -129,6 +129,7 @@ + diff --git a/OsmAnd/res/values/colors.xml b/OsmAnd/res/values/colors.xml index 147d26a17b7..9958490df5f 100644 --- a/OsmAnd/res/values/colors.xml +++ b/OsmAnd/res/values/colors.xml @@ -274,6 +274,8 @@ #C0C0C0 #FADE23 #2EFF00 + #D9D9D9 + #737373 #FA5050 #A0FF8000 diff --git a/OsmAnd/res/values/osmand_dark_style.xml b/OsmAnd/res/values/osmand_dark_style.xml index 866e781dd35..173a6738882 100644 --- a/OsmAnd/res/values/osmand_dark_style.xml +++ b/OsmAnd/res/values/osmand_dark_style.xml @@ -190,6 +190,7 @@ @drawable/img_button_pro_night @drawable/bg_bottom_bar_shadow_with_line_night + @color/nav_arrow_circle_color_dark @drawable/text_rounded_bg_active_dark @drawable/text_rounded_bg_regular_dark diff --git a/OsmAnd/res/values/osmand_light_style.xml b/OsmAnd/res/values/osmand_light_style.xml index de2a500a2c2..4e4a5f57e56 100644 --- a/OsmAnd/res/values/osmand_light_style.xml +++ b/OsmAnd/res/values/osmand_light_style.xml @@ -223,6 +223,7 @@ @drawable/img_button_pro_day @drawable/bg_bottom_bar_shadow_with_line_day + @color/nav_arrow_circle_color_light @drawable/text_rounded_bg_active_light @drawable/text_rounded_bg_regular_light diff --git a/OsmAnd/src/net/osmand/plus/views/layers/MapInfoLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/MapInfoLayer.java index 7c43cd058de..cc53a8b44a5 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/MapInfoLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/MapInfoLayer.java @@ -394,8 +394,8 @@ private TextState calculateTextState(boolean verticalWidget) { if (verticalWidget) { ts.textColor = ColorUtilities.getPrimaryTextColor(getContext(), nightMode); } else { - ts.textColor = nightMode ? ContextCompat.getColor(getContext(), R.color.widgettext_night) : - ContextCompat.getColor(getContext(), R.color.widgettext_day); + int textColorId = nightMode ? R.color.widgettext_night : R.color.widgettext_day; + ts.textColor = ColorUtilities.getColor(getContext(), textColorId); } ts.secondaryTextColor = ColorUtilities.getSecondaryTextColor(getContext(), nightMode); diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/TurnDrawable.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/TurnDrawable.java index a622acd069b..33e9bfa2d77 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/TurnDrawable.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/TurnDrawable.java @@ -12,6 +12,7 @@ import net.osmand.PlatformUtil; import net.osmand.plus.R; +import net.osmand.plus.utils.AndroidUtils; import net.osmand.plus.views.TurnPathHelper; import net.osmand.router.TurnType; @@ -21,7 +22,8 @@ public class TurnDrawable extends Drawable { protected static final Log log = PlatformUtil.getLog(TurnDrawable.class); - protected Paint paintBlack; + protected Paint paintTurnOutlayStroke; + protected Paint paintTurnOutlayFill; protected Paint paintRouteDirection; protected Path pathForTurn = new Path(); protected Path pathForTurnOutlay = new Path(); @@ -34,17 +36,24 @@ public class TurnDrawable extends Drawable { private final boolean mini; private final PointF centerText; private TextPaint textPaint; + private Boolean nightMode; private int clr; public TurnDrawable(Context ctx, boolean mini) { this.ctx = ctx; this.mini = mini; centerText = new PointF(); - paintBlack = new Paint(); - paintBlack.setStyle(Paint.Style.STROKE); - paintBlack.setColor(Color.BLACK); - paintBlack.setAntiAlias(true); - paintBlack.setStrokeWidth(2.5f); + paintTurnOutlayStroke = new Paint(); + paintTurnOutlayStroke.setStyle(Paint.Style.STROKE); + paintTurnOutlayStroke.setColor(Color.BLACK); + paintTurnOutlayStroke.setAntiAlias(true); + paintTurnOutlayStroke.setStrokeWidth(2.5f); + + int fillColor = AndroidUtils.getColorFromAttr(ctx, R.attr.nav_arrow_circle_color); + paintTurnOutlayFill = new Paint(); + paintTurnOutlayFill.setStyle(Paint.Style.FILL); + paintTurnOutlayFill.setColor(fillColor); + paintTurnOutlayFill.setAntiAlias(true); paintRouteDirection = new Paint(); paintRouteDirection.setStyle(Paint.Style.FILL); @@ -104,9 +113,10 @@ public void setTurnImminent(int turnImminent, boolean deviatedFromRoute) { public void draw(@NonNull Canvas canvas) { /// small indent // canvas.translate(0, 3 * scaleCoefficient); - canvas.drawPath(pathForTurnOutlay, paintBlack); + canvas.drawPath(pathForTurnOutlay, paintTurnOutlayFill); + canvas.drawPath(pathForTurnOutlay, paintTurnOutlayStroke); canvas.drawPath(pathForTurn, paintRouteDirection); - canvas.drawPath(pathForTurn, paintBlack); + canvas.drawPath(pathForTurn, paintTurnOutlayStroke); if (textPaint != null) { if (turnType != null && !mini && turnType.getExitOut() > 0) { canvas.drawText(turnType.getExitOut() + "", centerText.x, @@ -120,6 +130,16 @@ public void setTextPaint(@NonNull TextPaint textPaint) { this.textPaint.setTextAlign(Paint.Align.CENTER); } + public void updateNightMode(boolean nightMode) { + if (this.nightMode == null || this.nightMode != nightMode) { + this.nightMode = nightMode; + int fillColor = ctx.getColor(nightMode + ? R.color.nav_arrow_circle_color_dark + : R.color.nav_arrow_circle_color_light); + paintTurnOutlayFill.setColor(fillColor); + } + } + @Override public void setAlpha(int alpha) { paintRouteDirection.setAlpha(alpha); diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/widgets/NextTurnBaseWidget.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/widgets/NextTurnBaseWidget.java index 522fb8b16c1..492a7eaf30b 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/widgets/NextTurnBaseWidget.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/widgets/NextTurnBaseWidget.java @@ -182,6 +182,7 @@ public void setTurnType(TurnType turnType) { boolean vis = updateVisibility(turnType != null); if (turnDrawable.setTurnType(turnType) || vis) { turnDrawable.setTextPaint(textPaint); + turnDrawable.updateNightMode(isNightMode()); if (horizontalMini) { setImageDrawable(turnDrawable, false); } else { @@ -350,6 +351,7 @@ public void updateColors(@NonNull TextState textState) { textPaint.set(topTextView.getPaint()); textPaint.setColor(textState.textColor); turnDrawable.setTextPaint(textPaint); + turnDrawable.updateNightMode(isNightMode()); turnDrawable.invalidateSelf(); } }