Update context menu

This commit is contained in:
Victor Shcherb 2015-04-23 11:25:52 +02:00
parent 14f4eef242
commit 5b3c3cc8b0
8 changed files with 2 additions and 10 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 984 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -103,10 +103,6 @@ public class ContextMenuLayer extends OsmandMapLayer {
BASE_TEXT_SIZE = (int) (BASE_TEXT_SIZE * scaleCoefficient); BASE_TEXT_SIZE = (int) (BASE_TEXT_SIZE * scaleCoefficient);
SHADOW_OF_LEG = (int) (SHADOW_OF_LEG * scaleCoefficient); SHADOW_OF_LEG = (int) (SHADOW_OF_LEG * scaleCoefficient);
CLOSE_BTN = (int) (CLOSE_BTN * scaleCoefficient); CLOSE_BTN = (int) (CLOSE_BTN * scaleCoefficient);
boxLeg = view.getResources().getDrawable(R.drawable.box_leg);
boxLeg.setBounds(0, 0, boxLeg.getMinimumWidth(), boxLeg.getMinimumHeight());
textView = new TextView(view.getContext()); textView = new TextView(view.getContext());
LayoutParams lp = new LayoutParams(BASE_TEXT_SIZE, LayoutParams.WRAP_CONTENT); LayoutParams lp = new LayoutParams(BASE_TEXT_SIZE, LayoutParams.WRAP_CONTENT);
textView.setLayoutParams(lp); textView.setLayoutParams(lp);
@ -120,6 +116,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
textView.setBackgroundDrawable(view.getResources().getDrawable(R.drawable.box_free)); textView.setBackgroundDrawable(view.getResources().getDrawable(R.drawable.box_free));
textPadding = new Rect(); textPadding = new Rect();
textView.setTextColor(Color.WHITE);
textView.getBackground().getPadding(textPadding); textView.getBackground().getPadding(textPadding);
// textView.setPadding(0, 0, CLOSE_BTN + 3, 0); // textView.setPadding(0, 0, CLOSE_BTN + 3, 0);
@ -144,13 +141,8 @@ public class ContextMenuLayer extends OsmandMapLayer {
if(latLon != null){ if(latLon != null){
int x = (int) box.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude()); int x = (int) box.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude());
int y = (int) box.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude()); int y = (int) box.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude());
textView.setTextColor(nightMode != null && nightMode.isNightMode() ? Color.GRAY : Color.WHITE);
int tx = x - boxLeg.getMinimumWidth() / 2;
int ty = y - boxLeg.getMinimumHeight() + SHADOW_OF_LEG; int ty = y - boxLeg.getMinimumHeight() + SHADOW_OF_LEG;
canvas.translate(tx, ty);
boxLeg.draw(canvas);
canvas.translate(-tx, -ty);
if (textView.getText().length() > 0) { if (textView.getText().length() > 0) {
canvas.translate(x - textView.getWidth() / 2, ty - textView.getBottom() + textPadding.bottom - textPadding.top); canvas.translate(x - textView.getWidth() / 2, ty - textView.getBottom() + textPadding.bottom - textPadding.top);
int c = textView.getLineCount(); int c = textView.getLineCount();