From 262855c4b4aa066cbf35eb4f1d13115ac9faefbd Mon Sep 17 00:00:00 2001 From: madwasp79 Date: Thu, 27 Jun 2019 16:43:40 +0300 Subject: [PATCH 1/6] #6948 - Favourive point name is ugly in night mode --- OsmAnd/src/net/osmand/plus/views/MapTextLayer.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/views/MapTextLayer.java b/OsmAnd/src/net/osmand/plus/views/MapTextLayer.java index c1dcf0ea50..f5a4c33e52 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapTextLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapTextLayer.java @@ -106,6 +106,7 @@ public class MapTextLayer extends OsmandMapLayer { } private void drawWrappedText(Canvas cv, String text, float textSize, float x, float y, int lines) { + boolean nightMode = view.getApplication().getDaynightHelper().isNightMode(); if (text.length() > TEXT_WRAP) { int start = 0; int end = text.length(); @@ -123,14 +124,14 @@ public class MapTextLayer extends OsmandMapLayer { pos++; } if (lastSpace == -1 || (pos == end)) { - drawShadowText(cv, text.substring(start, pos), x, y + line * (textSize + 2)); + drawShadowText(cv, text.substring(start, pos), x, y + line * (textSize + 2), nightMode); start = pos; } else { String subtext = text.substring(start, lastSpace); if (line + 1 == lines) { subtext += ".."; } - drawShadowText(cv, subtext, x, y + line * (textSize + 2)); + drawShadowText(cv, subtext, x, y + line * (textSize + 2), nightMode); start = lastSpace + 1; limit += (start - pos) - 1; @@ -139,20 +140,20 @@ public class MapTextLayer extends OsmandMapLayer { line++; } } else { - drawShadowText(cv, text, x, y); + drawShadowText(cv, text, x, y, nightMode); } } - private void drawShadowText(Canvas cv, String text, float centerX, float centerY) { + private void drawShadowText(Canvas cv, String text, float centerX, float centerY, boolean nightMode) { int c = paintTextIcon.getColor(); paintTextIcon.setStyle(Style.STROKE); - paintTextIcon.setColor(Color.WHITE); + paintTextIcon.setColor(nightMode ? Color.WHITE : Color.DKGRAY); paintTextIcon.setStrokeWidth(2); cv.drawText(text, centerX, centerY, paintTextIcon); // reset paintTextIcon.setStrokeWidth(2); paintTextIcon.setStyle(Style.FILL); - paintTextIcon.setColor(c); + paintTextIcon.setColor(nightMode ? c : Color.WHITE); cv.drawText(text, centerX, centerY, paintTextIcon); } From b4c3efd6575dcf52d0389cc56c41a0a93dbf31b4 Mon Sep 17 00:00:00 2001 From: madwasp79 Date: Thu, 27 Jun 2019 17:41:25 +0300 Subject: [PATCH 2/6] #6912 fix - opening hours readability --- .../plus/mapcontextmenu/builders/AmenityMenuBuilder.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java index 25361fe1af..ec4ad4aa82 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java @@ -440,7 +440,8 @@ public class AmenityMenuBuilder extends MenuBuilder { } else if (Amenity.OPENING_HOURS.equals(key) || Amenity.COLLECTION_TIMES.equals(key) || Amenity.SERVICE_TIMES.equals(key)) { iconId = R.drawable.ic_action_time; - collapsableView = getCollapsableTextView(view.getContext(), true, amenity.getAdditionalInfo(key)); + collapsableView = getCollapsableTextView(view.getContext(), true, + amenity.getAdditionalInfo(key).replace("; ", "\n").replace(",", ", ")); collapsable = true; OpeningHoursParser.OpeningHours rs = OpeningHoursParser.parseOpenedHours(amenity.getAdditionalInfo(key)); if (rs != null) { @@ -454,6 +455,7 @@ public class AmenityMenuBuilder extends MenuBuilder { textColor = R.color.color_invalid; } } + vl = vl.replace("; ", "\n"); needLinks = false; } else if (Amenity.PHONE.equals(key)) { From 590e9d4541436491d66e6443666359a82cfd5829 Mon Sep 17 00:00:00 2001 From: madwasp79 Date: Thu, 27 Jun 2019 18:17:10 +0300 Subject: [PATCH 3/6] #6948 color change --- OsmAnd/src/net/osmand/plus/views/MapTextLayer.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/views/MapTextLayer.java b/OsmAnd/src/net/osmand/plus/views/MapTextLayer.java index f5a4c33e52..fc243d51eb 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapTextLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapTextLayer.java @@ -1,5 +1,6 @@ package net.osmand.plus.views; +import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; @@ -17,6 +18,7 @@ import java.util.Map; import java.util.TreeMap; import gnu.trove.set.hash.TIntHashSet; +import net.osmand.plus.R; public class MapTextLayer extends OsmandMapLayer { @@ -145,15 +147,19 @@ public class MapTextLayer extends OsmandMapLayer { } private void drawShadowText(Canvas cv, String text, float centerX, float centerY, boolean nightMode) { - int c = paintTextIcon.getColor(); + Resources r = view.getApplication().getResources(); paintTextIcon.setStyle(Style.STROKE); - paintTextIcon.setColor(nightMode ? Color.WHITE : Color.DKGRAY); + paintTextIcon.setColor(nightMode + ? r.getColor(R.color.widgettext_shadow_night) + : r.getColor(R.color.map_widget_dark_stroke)); paintTextIcon.setStrokeWidth(2); cv.drawText(text, centerX, centerY, paintTextIcon); // reset paintTextIcon.setStrokeWidth(2); paintTextIcon.setStyle(Style.FILL); - paintTextIcon.setColor(nightMode ? c : Color.WHITE); + paintTextIcon.setColor(nightMode + ? r.getColor(R.color.widgettext_night ) + : r.getColor(R.color.color_black)); cv.drawText(text, centerX, centerY, paintTextIcon); } From a3bd05f4573d7a36ffd0b2a40c5925f13b7454e1 Mon Sep 17 00:00:00 2001 From: madwasp79 Date: Thu, 27 Jun 2019 18:38:08 +0300 Subject: [PATCH 4/6] #6948 color change --- OsmAnd/src/net/osmand/plus/views/MapTextLayer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/views/MapTextLayer.java b/OsmAnd/src/net/osmand/plus/views/MapTextLayer.java index fc243d51eb..18c30348d5 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapTextLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapTextLayer.java @@ -159,7 +159,7 @@ public class MapTextLayer extends OsmandMapLayer { paintTextIcon.setStyle(Style.FILL); paintTextIcon.setColor(nightMode ? r.getColor(R.color.widgettext_night ) - : r.getColor(R.color.color_black)); + : r.getColor(R.color.map_widget_dark)); cv.drawText(text, centerX, centerY, paintTextIcon); } From b1d8bb9e19e4443439f1ffee8d506a4283718a21 Mon Sep 17 00:00:00 2001 From: madwasp79 Date: Thu, 27 Jun 2019 18:47:36 +0300 Subject: [PATCH 5/6] #6948 color change --- OsmAnd/src/net/osmand/plus/views/MapTextLayer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/views/MapTextLayer.java b/OsmAnd/src/net/osmand/plus/views/MapTextLayer.java index 18c30348d5..967588389a 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapTextLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapTextLayer.java @@ -151,15 +151,15 @@ public class MapTextLayer extends OsmandMapLayer { paintTextIcon.setStyle(Style.STROKE); paintTextIcon.setColor(nightMode ? r.getColor(R.color.widgettext_shadow_night) - : r.getColor(R.color.map_widget_dark_stroke)); + : Color.WHITE); paintTextIcon.setStrokeWidth(2); cv.drawText(text, centerX, centerY, paintTextIcon); // reset paintTextIcon.setStrokeWidth(2); paintTextIcon.setStyle(Style.FILL); paintTextIcon.setColor(nightMode - ? r.getColor(R.color.widgettext_night ) - : r.getColor(R.color.map_widget_dark)); + ? r.getColor(R.color.widgettext_night) + : Color.BLACK); cv.drawText(text, centerX, centerY, paintTextIcon); } From 9b246894e607ed0b8b0b63334f18d4961160b401 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 27 Jun 2019 17:54:46 +0200 Subject: [PATCH 6/6] update text layer --- OsmAnd/src/net/osmand/plus/views/MapTextLayer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/views/MapTextLayer.java b/OsmAnd/src/net/osmand/plus/views/MapTextLayer.java index 967588389a..ebc424c41e 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapTextLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapTextLayer.java @@ -151,7 +151,7 @@ public class MapTextLayer extends OsmandMapLayer { paintTextIcon.setStyle(Style.STROKE); paintTextIcon.setColor(nightMode ? r.getColor(R.color.widgettext_shadow_night) - : Color.WHITE); + : r.getColor(R.color.widgettext_shadow_day)); paintTextIcon.setStrokeWidth(2); cv.drawText(text, centerX, centerY, paintTextIcon); // reset @@ -159,7 +159,7 @@ public class MapTextLayer extends OsmandMapLayer { paintTextIcon.setStyle(Style.FILL); paintTextIcon.setColor(nightMode ? r.getColor(R.color.widgettext_night) - : Color.BLACK); + : r.getColor(R.color.widgettext_day)); cv.drawText(text, centerX, centerY, paintTextIcon); }