Extract constants to resources

This commit is contained in:
Alexander Sytnyk 2017-11-10 16:57:18 +02:00
parent e0bc10e98b
commit c08ef7a60b
2 changed files with 13 additions and 7 deletions

View file

@ -143,6 +143,9 @@
<dimen name="splash_screen_logo_top">150dp</dimen>
<dimen name="splash_screen_text_bottom">128dp</dimen>
<dimen name="guide_line_text_size">14sp</dimen>
<dimen name="guide_line_vertical_offset">6dp</dimen>
<dimen name="empty_state_image_margin_top">42dp</dimen>
<dimen name="empty_state_image_margin_bottom">30dp</dimen>

View file

@ -50,8 +50,6 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
private static final long USE_FINGER_LOCATION_DELAY = 1000;
private static final int MAP_REFRESH_MESSAGE = OsmAndConstants.UI_HANDLER_MAP_VIEW + 6;
protected static final int DIST_TO_SHOW = 80;
private static final int TEXT_SIZE = 14;
private static final int VERTICAL_OFFSET = 10;
private final MapActivity map;
private OsmandMapTileView view;
@ -84,6 +82,9 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
private final RenderingLineAttributes planRouteAttrs = new RenderingLineAttributes("markerPlanRouteline");
private TrkSegment route;
private float textSize;
private int verticalOffset;
private TIntArrayList tx = new TIntArrayList();
private TIntArrayList ty = new TIntArrayList();
private Path linePath = new Path();
@ -146,6 +147,9 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
widgetsFactory = new MapMarkersWidgetsFactory(map);
contextMenuLayer = view.getLayerByClass(ContextMenuLayer.class);
textSize = map.getResources().getDimensionPixelSize(R.dimen.guide_line_text_size);
verticalOffset = map.getResources().getDimensionPixelSize(R.dimen.guide_line_vertical_offset);
}
private Paint createPaintDest(int colorId) {
@ -239,7 +243,6 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
}
if (map.getMyApplication().getSettings().SHOW_LINES_TO_FIRST_MARKERS.get() && myLoc != null) {
float textSize = TEXT_SIZE * map.getResources().getDisplayMetrics().density * map.getMyApplication().getSettings().TEXT_SCALE.get();
textAttrs.paint.setTextSize(textSize);
textAttrs.paint2.setTextSize(textSize);
@ -292,12 +295,12 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
canvas.drawPath(linePath, lineAttrs.paint);
if (locX >= markerX) {
canvas.rotate(180, pos[0], pos[1]);
canvas.drawTextOnPath(text, linePath, hOffset, bounds.height() + VERTICAL_OFFSET, textAttrs.paint2);
canvas.drawTextOnPath(text, linePath, hOffset, bounds.height() + VERTICAL_OFFSET, textAttrs.paint);
canvas.drawTextOnPath(text, linePath, hOffset, bounds.height() + verticalOffset, textAttrs.paint2);
canvas.drawTextOnPath(text, linePath, hOffset, bounds.height() + verticalOffset, textAttrs.paint);
canvas.rotate(-180, pos[0], pos[1]);
} else {
canvas.drawTextOnPath(text, linePath, hOffset, -VERTICAL_OFFSET, textAttrs.paint2);
canvas.drawTextOnPath(text, linePath, hOffset, -VERTICAL_OFFSET, textAttrs.paint);
canvas.drawTextOnPath(text, linePath, hOffset, -verticalOffset, textAttrs.paint2);
canvas.drawTextOnPath(text, linePath, hOffset, -verticalOffset, textAttrs.paint);
}
canvas.rotate(tileBox.getRotate(), tileBox.getCenterPixelX(), tileBox.getCenterPixelY());
}