Update context menu
Before Width: | Height: | Size: 984 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
@ -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();
|
||||||
|
|