From b0bc772450dd24ed749a6c7de5149c8ee9c739af Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 22 Sep 2017 18:27:55 +0300 Subject: [PATCH] Change text size and offset --- .../osmand/plus/views/MapMarkersLayer.java | 2 +- .../osmand/plus/views/RulerControlLayer.java | 21 +++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java index af440debc3..0fce81858b 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java @@ -41,7 +41,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi IContextMenuProviderSelection, ContextMenuLayer.IMoveObjectProvider { protected static final int DIST_TO_SHOW = 80; - private static final int TEXT_SIZE = 14; + private static final int TEXT_SIZE = 12; private static final int VERTICAL_OFFSET = 10; private final MapActivity map; diff --git a/OsmAnd/src/net/osmand/plus/views/RulerControlLayer.java b/OsmAnd/src/net/osmand/plus/views/RulerControlLayer.java index df2f82e86d..4e215663ef 100644 --- a/OsmAnd/src/net/osmand/plus/views/RulerControlLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/RulerControlLayer.java @@ -32,10 +32,11 @@ import gnu.trove.list.array.TIntArrayList; public class RulerControlLayer extends OsmandMapLayer { - private static final int VERTICAL_OFFSET = 10; + private static final int VERTICAL_OFFSET = 15; private static final long DRAW_TIME = 2000; private static final long DELAY_BEFORE_DRAW = 500; private static final int TEXT_SIZE = 14; + private static final int DISTANCE_TEXT_SIZE = 16; private final MapActivity mapActivity; private OsmandApplication app; @@ -77,6 +78,8 @@ public class RulerControlLayer extends OsmandMapLayer { private RenderingLineAttributes lineAttrs; private RenderingLineAttributes circleAttrs; private RenderingLineAttributes circleAttrsAlt; + private float circleTextSize; + private float lineTextSize; private Handler handler; @@ -119,15 +122,16 @@ public class RulerControlLayer extends OsmandMapLayer { lineAttrs = new RenderingLineAttributes("rulerLine"); - float textSize = TEXT_SIZE * mapActivity.getResources().getDisplayMetrics().density; + circleTextSize = TEXT_SIZE * mapActivity.getResources().getDisplayMetrics().density; + lineTextSize = DISTANCE_TEXT_SIZE * mapActivity.getResources().getDisplayMetrics().density; circleAttrs = new RenderingLineAttributes("rulerCircle"); - circleAttrs.paint2.setTextSize(textSize); - circleAttrs.paint3.setTextSize(textSize); + circleAttrs.paint2.setTextSize(circleTextSize); + circleAttrs.paint3.setTextSize(circleTextSize); circleAttrsAlt = new RenderingLineAttributes("rulerCircleAlt"); - circleAttrsAlt.paint2.setTextSize(textSize); - circleAttrsAlt.paint3.setTextSize(textSize); + circleAttrsAlt.paint2.setTextSize(circleTextSize); + circleAttrsAlt.paint3.setTextSize(circleTextSize); handler = new Handler() { @Override @@ -219,6 +223,8 @@ public class RulerControlLayer extends OsmandMapLayer { updateData(tb, center); RenderingLineAttributes attrs; if (mode == RulerMode.FIRST) { + circleAttrs.paint2.setTextSize(circleTextSize); + circleAttrs.paint3.setTextSize(circleTextSize); attrs = circleAttrs; } else { attrs = circleAttrsAlt; @@ -263,6 +269,9 @@ public class RulerControlLayer extends OsmandMapLayer { circleAttrs.paint2.getTextBounds(text, 0, text.length(), bounds); float hOffset = pm.getLength() / 2 - bounds.width() / 2; + circleAttrs.paint2.setTextSize(lineTextSize); + circleAttrs.paint3.setTextSize(lineTextSize); + if (x1 >= x2) { float[] pos = new float[2]; pm.getPosTan(pm.getLength() / 2, pos, null);