Update margins

This commit is contained in:
Victor Shcherb 2015-04-23 13:33:19 +02:00
parent af3f62271d
commit d68dd04352
33 changed files with 21 additions and 34 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 805 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 848 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 767 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 755 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 629 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 355 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 407 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 350 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 439 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 347 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 805 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 848 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -18,8 +18,6 @@ import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PointF;
import android.text.format.DateFormat;
import android.text.format.Time;
import android.util.DisplayMetrics;
import android.view.WindowManager;
import android.widget.Toast;
@ -34,7 +32,7 @@ public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuL
/**
* magic number so far
*/
private static final int radius = 20;
private static final int radius = 18;
private DisplayMetrics dm;
@ -170,10 +168,11 @@ public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuL
/**
* @param point
* @param parkingPosition is in this case not necessarily has to be a list,
* but it's also used in method <link>collectObjectsFromPoint(PointF point, List<Object> o)</link>
* @param parkingPosition
* is in this case not necessarily has to be a list, but it's also used in method
* <link>collectObjectsFromPoint(PointF point, List<Object> o)</link>
*/
private void getParkingFromPoint(RotatedTileBox tb,PointF point, List<? super LatLon> parkingPosition) {
private void getParkingFromPoint(RotatedTileBox tb, PointF point, List<? super LatLon> parkingPosition) {
LatLon parkingPoint = getParkingPoint();
if (parkingPoint != null && view != null) {
int ex = (int) point.x;
@ -183,12 +182,11 @@ public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuL
int y = (int) tb.getPixYFromLatLon(position.getLatitude(), position.getLongitude());
// the width of an image is 40 px, the height is 60 px -> radius = 20,
// the position of a parking point relatively to the icon is at the center of the bottom line of the image
if (Math.abs(x - ex) <= radius && ((y - ey) <= radius * 2) && ((y - ey) >= -radius)) {
int rad = (int) (radius * tb.getDensity());
if (Math.abs(x - ex) <= rad && (ey - y) <= rad && (y - ey) <= 2.5 * rad) {
parkingPosition.add(parkingPoint);
}
}
}
}

View file

@ -22,7 +22,6 @@ import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.text.Html;
import android.view.Gravity;
@ -65,12 +64,9 @@ public class ContextMenuLayer extends OsmandMapLayer {
private ImageView closeButton;
private OsmandMapTileView view;
private int BASE_TEXT_SIZE = 170;
private int SHADOW_OF_LEG = 5;
private int CLOSE_BTN = 8;
private final MapActivity activity;
private float scaleCoefficient = 1;
private Rect textPadding;
private CallbackWithObject<LatLon> selectOnMap = null;
public ContextMenuLayer(MapActivity activity){
@ -100,8 +96,6 @@ public class ContextMenuLayer extends OsmandMapLayer {
this.view = view;
scaleCoefficient = view.getDensity();
BASE_TEXT_SIZE = (int) (BASE_TEXT_SIZE * scaleCoefficient);
SHADOW_OF_LEG = (int) (SHADOW_OF_LEG * scaleCoefficient);
CLOSE_BTN = (int) (CLOSE_BTN * scaleCoefficient);
textView = new TextView(view.getContext());
LayoutParams lp = new LayoutParams(BASE_TEXT_SIZE, LayoutParams.WRAP_CONTENT);
textView.setLayoutParams(lp);
@ -114,10 +108,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
textView.setClickable(true);
textView.setBackgroundDrawable(view.getResources().getDrawable(R.drawable.box_free));
textPadding = new Rect();
textView.setTextColor(Color.WHITE);
textView.getBackground().getPadding(textPadding);
// textView.setPadding(0, 0, CLOSE_BTN + 3, 0);
closeButton = new ImageView(view.getContext());
lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
@ -141,13 +132,13 @@ public class ContextMenuLayer extends OsmandMapLayer {
int x = (int) box.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude());
int y = (int) box.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude());
textView.setTextColor(nightMode != null && nightMode.isNightMode() ? Color.GRAY : Color.WHITE);
int ty = y;// - boxLeg.getMinimumHeight() + SHADOW_OF_LEG;
if (textView.getText().length() > 0) {
canvas.translate(x - textView.getWidth() / 2, ty - textView.getBottom() + textPadding.bottom - textPadding.top);
canvas.translate(x - textView.getWidth() / 2, y - textView.getHeight());
int c = textView.getLineCount();
textView.draw(canvas);
canvas.translate(textView.getWidth() - closeButton.getWidth(), CLOSE_BTN / 2);
//textView.getHeight() - closeButton.getHeight()
canvas.translate(textView.getWidth() - closeButton.getWidth(), 0);
closeButton.draw(canvas);
if (c == 0) {
// special case relayout after on draw method
@ -178,7 +169,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
int w = BASE_TEXT_SIZE;
int h = (int) ((textView.getPaint().getTextSize() * 1.3f) * textView.getLineCount());
textView.layout(0, -padding.bottom, w, h + padding.top);
textView.layout(0, 0, w, h + padding.top + padding.bottom);
int minw = closeButton.getDrawable().getMinimumWidth();
int minh = closeButton.getDrawable().getMinimumHeight();
closeButton.layout(0, 0, minw, minh);
@ -279,16 +270,15 @@ public class ContextMenuLayer extends OsmandMapLayer {
if (latLon != null) {
Rect bs = textView.getBackground().getBounds();
Rect closes = closeButton.getDrawable().getBounds();
int x = (int) (px - tb.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude()));
int y = (int) (py - tb.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude()));
x += bs.width() / 2;
y += bs.height();
int localSize = CLOSE_BTN * 3 / 2;
int dclosex = x - bs.width() + closes.width();
int dclosey = y - closes.height() / 2;
if(closes.intersects(dclosex - localSize, dclosey - localSize, dclosex + localSize, dclosey + localSize)) {
int dx = (int) (px - tb.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude()));
int dy = (int) (py - tb.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude()));
int bx = dx + bs.width() / 2;
int by = dy + bs.height();
int dclosex = bx - bs.width() ;
int dclosey = by;
if (dclosex >= -closes.width() && dclosey >= 0 && dclosex <= 0 && dclosey <= closes.height()) {
return 2;
} else if (bs.contains(x, y)) {
} else if (bs.contains(bx, by)) {
return 1;
}
}

View file

@ -216,7 +216,6 @@ public class MapInfoLayer extends OsmandMapLayer {
ts.night = nightMode;
ts.textColor = nightMode ? view.getResources().getColor(R.color.widgettext_night) : Color.BLACK;
// Night shadowColor always use widgettext_shadow_night, same as widget background color for non-transparent
// night skin (from box_night_free_simple.9.png)
ts.textShadowColor = nightMode ? view.getResources().getColor(R.color.widgettext_shadow_night) : Color.WHITE;
if (!transparent && !nightMode) {
// ts.textShadowColor = Color.TRANSPARENT;