diff --git a/OsmAnd/res/values-large/sizes.xml b/OsmAnd/res/values-large/sizes.xml index a2af789a5e..00e5606654 100644 --- a/OsmAnd/res/values-large/sizes.xml +++ b/OsmAnd/res/values-large/sizes.xml @@ -1,6 +1,6 @@ - 120dp + 120dp 35sp 33sp 23sp @@ -29,7 +29,7 @@ 140dp 81dp - + 36dp 48dp 120dp @@ -120,13 +120,14 @@ 20dp 23dp - 180dp - 24dp - 60dp + 180dp + 24dp + 60dp 450dp 54dp - 64dp + 64dp + 24dp \ No newline at end of file diff --git a/OsmAnd/res/values/sizes.xml b/OsmAnd/res/values/sizes.xml index e3181e5c0b..6383e285c7 100644 --- a/OsmAnd/res/values/sizes.xml +++ b/OsmAnd/res/values/sizes.xml @@ -90,6 +90,7 @@ 16dp 34dp 24dp + 16dp 3dp 14dp 6dp diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java index 49a03a8cf2..627450665e 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java @@ -203,7 +203,7 @@ public class AudioNotesLayer extends OsmandMapLayer implements public void getRecordingsFromPoint(PointF point, RotatedTileBox tileBox, List am) { int ex = (int) point.x; int ey = (int) point.y; - int compare = getRadiusPoi(tileBox); + int compare = getScaledTouchRadius(activity.getMyApplication(), getRadiusPoi(tileBox)); int radius = compare * 3 / 2; for (Recording n : plugin.getAllRecordings()) { int x = (int) tileBox.getPixXFromLatLon(n.getLatitude(), n.getLongitude()); diff --git a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java index 366da4afd5..18ccf6117b 100644 --- a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java @@ -21,7 +21,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.RequiresPermission; import androidx.appcompat.content.res.AppCompatResources; -import androidx.core.content.ContextCompat; import net.osmand.AndroidUtils; import net.osmand.CallbackWithObject; @@ -223,15 +222,21 @@ public class ContextMenuLayer extends OsmandMapLayer { } } } + float scale = 1f; + if (!pressedLatLonSmall.isEmpty() || !pressedLatLonFull.isEmpty()) { + scale = activity.getMyApplication().getSettings().TEXT_SCALE.get(); + } for (LatLon latLon : pressedLatLonSmall) { int x = (int) box.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude()); int y = (int) box.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude()); - canvas.drawBitmap(pressedBitmapSmall, x - pressedBitmapSmall.getWidth() / 2, y - pressedBitmapSmall.getHeight() / 2, paint); + Rect destRect = getIconDestinationRect(x, y, pressedBitmapSmall.getWidth(), pressedBitmapSmall.getHeight(), scale); + canvas.drawBitmap(pressedBitmapSmall, null, destRect, paint); } for (LatLon latLon : pressedLatLonFull) { int x = (int) box.getPixXFromLatLon(latLon.getLatitude(), latLon.getLongitude()); int y = (int) box.getPixYFromLatLon(latLon.getLatitude(), latLon.getLongitude()); - canvas.drawBitmap(pressedBitmap, x - pressedBitmap.getWidth() / 2, y - pressedBitmap.getHeight() / 2, paint); + Rect destRect = getIconDestinationRect(x, y, pressedBitmap.getWidth(), pressedBitmap.getHeight(), scale); + canvas.drawBitmap(pressedBitmap, null, destRect, paint); } if (mapQuickActionLayer != null && mapQuickActionLayer.isInMovingMarkerMode()) diff --git a/OsmAnd/src/net/osmand/plus/views/FavouritesLayer.java b/OsmAnd/src/net/osmand/plus/views/FavouritesLayer.java index a29b8bff72..1a59ddebf0 100644 --- a/OsmAnd/src/net/osmand/plus/views/FavouritesLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/FavouritesLayer.java @@ -216,7 +216,7 @@ public class FavouritesLayer extends OsmandMapLayer implements ContextMenuLayer. } private void getFavoriteFromPoint(RotatedTileBox tb, PointF point, List res) { - int r = getDefaultRadiusPoi(tb); + int r = getScaledTouchRadius(view.getApplication(), getDefaultRadiusPoi(tb)); int ex = (int) point.x; int ey = (int) point.y; for (FavouritePoint n : favorites.getFavouritePoints()) { diff --git a/OsmAnd/src/net/osmand/plus/views/GPXLayer.java b/OsmAnd/src/net/osmand/plus/views/GPXLayer.java index bc169bde73..6e1f63c3c0 100644 --- a/OsmAnd/src/net/osmand/plus/views/GPXLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/GPXLayer.java @@ -580,7 +580,7 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex } public void getWptFromPoint(RotatedTileBox tb, PointF point, List res) { - int r = getDefaultRadiusPoi(tb); + int r = getScaledTouchRadius(view.getApplication(), getDefaultRadiusPoi(tb)); int ex = (int) point.x; int ey = (int) point.y; List selectedGpxFiles = new ArrayList<>(selectedGpxHelper.getSelectedGPXFiles()); diff --git a/OsmAnd/src/net/osmand/plus/views/OsmandMapLayer.java b/OsmAnd/src/net/osmand/plus/views/OsmandMapLayer.java index 2afe6868d2..0e154d098f 100644 --- a/OsmAnd/src/net/osmand/plus/views/OsmandMapLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/OsmandMapLayer.java @@ -637,6 +637,14 @@ public abstract class OsmandMapLayer { return rect; } + public int getScaledTouchRadius(OsmandApplication app, int radiusPoi) { + float textScale = app.getSettings().TEXT_SCALE.get(); + if (textScale < 1.0f) { + textScale = 1.0f; + } + return (int) textScale * radiusPoi; + } + public abstract class MapLayerData { public int ZOOM_THRESHOLD = 1; public RotatedTileBox queriedBox; diff --git a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java index f1f2e1153a..411eaf3d6c 100644 --- a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java @@ -153,9 +153,8 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon if (objects != null) { int ex = (int) point.x; int ey = (int) point.y; - final int rp = getRadiusPoi(tb); - int compare = rp; - int radius = rp * 3 / 2; + int compare = getScaledTouchRadius(view.getApplication(), getRadiusPoi(tb)); + int radius = compare * 3 / 2; try { for (int i = 0; i < objects.size(); i++) { Amenity n = objects.get(i); @@ -176,8 +175,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon @Override public void initLayer(OsmandMapTileView view) { this.view = view; - - poiSize = dpToPx(view.getContext(), 16f); + poiSize = app.getResources().getDimensionPixelSize(R.dimen.poi_icon_size); poiColorFilter = new PorterDuffColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN); paintIconBackground = new Paint(); poiBackground = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_white_orange_poi_shield); diff --git a/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java b/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java index 9067054f85..db1eae9605 100644 --- a/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java @@ -144,7 +144,7 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa List objects) { int ex = (int) point.x; int ey = (int) point.y; - final int rp = getRadiusPoi(tb); + final int rp = getScaledTouchRadius(mapActivity.getMyApplication(), getRadiusPoi(tb)); int radius = rp * 3 / 2; try { TreeSet ms = new TreeSet<>();