Merge branch 'sasha_pasha_branch' of ssh://github.com/osmandapp/Osmand into sasha_pasha_branch

This commit is contained in:
PavelRatushny 2017-09-22 18:42:33 +03:00
commit 6a30233464
2 changed files with 16 additions and 7 deletions

View file

@ -41,7 +41,7 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
IContextMenuProviderSelection, ContextMenuLayer.IMoveObjectProvider { IContextMenuProviderSelection, ContextMenuLayer.IMoveObjectProvider {
protected static final int DIST_TO_SHOW = 80; 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 static final int VERTICAL_OFFSET = 10;
private final MapActivity map; private final MapActivity map;

View file

@ -32,10 +32,11 @@ import gnu.trove.list.array.TIntArrayList;
public class RulerControlLayer extends OsmandMapLayer { 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 DRAW_TIME = 2000;
private static final long DELAY_BEFORE_DRAW = 500; private static final long DELAY_BEFORE_DRAW = 500;
private static final int TEXT_SIZE = 14; private static final int TEXT_SIZE = 14;
private static final int DISTANCE_TEXT_SIZE = 16;
private final MapActivity mapActivity; private final MapActivity mapActivity;
private OsmandApplication app; private OsmandApplication app;
@ -77,6 +78,8 @@ public class RulerControlLayer extends OsmandMapLayer {
private RenderingLineAttributes lineAttrs; private RenderingLineAttributes lineAttrs;
private RenderingLineAttributes circleAttrs; private RenderingLineAttributes circleAttrs;
private RenderingLineAttributes circleAttrsAlt; private RenderingLineAttributes circleAttrsAlt;
private float circleTextSize;
private float lineTextSize;
private Handler handler; private Handler handler;
@ -119,15 +122,16 @@ public class RulerControlLayer extends OsmandMapLayer {
lineAttrs = new RenderingLineAttributes("rulerLine"); 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 = new RenderingLineAttributes("rulerCircle");
circleAttrs.paint2.setTextSize(textSize); circleAttrs.paint2.setTextSize(circleTextSize);
circleAttrs.paint3.setTextSize(textSize); circleAttrs.paint3.setTextSize(circleTextSize);
circleAttrsAlt = new RenderingLineAttributes("rulerCircleAlt"); circleAttrsAlt = new RenderingLineAttributes("rulerCircleAlt");
circleAttrsAlt.paint2.setTextSize(textSize); circleAttrsAlt.paint2.setTextSize(circleTextSize);
circleAttrsAlt.paint3.setTextSize(textSize); circleAttrsAlt.paint3.setTextSize(circleTextSize);
handler = new Handler() { handler = new Handler() {
@Override @Override
@ -219,6 +223,8 @@ public class RulerControlLayer extends OsmandMapLayer {
updateData(tb, center); updateData(tb, center);
RenderingLineAttributes attrs; RenderingLineAttributes attrs;
if (mode == RulerMode.FIRST) { if (mode == RulerMode.FIRST) {
circleAttrs.paint2.setTextSize(circleTextSize);
circleAttrs.paint3.setTextSize(circleTextSize);
attrs = circleAttrs; attrs = circleAttrs;
} else { } else {
attrs = circleAttrsAlt; attrs = circleAttrsAlt;
@ -263,6 +269,9 @@ public class RulerControlLayer extends OsmandMapLayer {
circleAttrs.paint2.getTextBounds(text, 0, text.length(), bounds); circleAttrs.paint2.getTextBounds(text, 0, text.length(), bounds);
float hOffset = pm.getLength() / 2 - bounds.width() / 2; float hOffset = pm.getLength() / 2 - bounds.width() / 2;
circleAttrs.paint2.setTextSize(lineTextSize);
circleAttrs.paint3.setTextSize(lineTextSize);
if (x1 >= x2) { if (x1 >= x2) {
float[] pos = new float[2]; float[] pos = new float[2];
pm.getPosTan(pm.getLength() / 2, pos, null); pm.getPosTan(pm.getLength() / 2, pos, null);