diff --git a/OsmAnd/src/net/osmand/access/MapExplorer.java b/OsmAnd/src/net/osmand/access/MapExplorer.java index bf641d50a7..1ec27ff501 100644 --- a/OsmAnd/src/net/osmand/access/MapExplorer.java +++ b/OsmAnd/src/net/osmand/access/MapExplorer.java @@ -134,6 +134,16 @@ public class MapExplorer implements OnGestureListener, IContextMenuProvider { // IContextMenuProvider interface implementation. + @Override + public boolean disableSingleTap() { + return false; + } + + @Override + public boolean disableLongPressOnMap() { + return false; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List objects) { int radius = (int)(VICINITY_RADIUS * tileBox.getDensity()); diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java index cc010a5a55..731f01910e 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java @@ -291,7 +291,7 @@ public class MapActivityLayers { private void addFilterToList(final ContextMenuAdapter adapter, final List list, PoiUIFilter f) { list.add(f); - Item it = adapter.item(f.getName()); + Item it = adapter.item(f.getName()).selected(0); if (RenderingIcons.containsBigIcon(f.getSimplifiedId())) { it.icon(RenderingIcons.getBigIconResourceId(f.getSimplifiedId())); } else { diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java index 657e5b1981..129058c847 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java @@ -180,6 +180,16 @@ public class AudioNotesLayer extends OsmandMapLayer implements IContextMenuProvi return null; } + @Override + public boolean disableSingleTap() { + return false; + } + + @Override + public boolean disableLongPressOnMap() { + return false; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List objects) { getRecordingsFromPoint(point, tileBox, objects); @@ -203,21 +213,6 @@ public class AudioNotesLayer extends OsmandMapLayer implements IContextMenuProvi private boolean calculateBelongs(int ex, int ey, int objx, int objy, int radius) { return Math.abs(objx - ex) <= radius && (ey - objy) <= radius / 2 && (objy - ey) <= 3 * radius ; } - - @Override - public boolean onSingleTap(PointF point, RotatedTileBox tileBox) { - ArrayList o = new ArrayList(); - getRecordingsFromPoint(point, tileBox, o); - if(o.size() > 0){ - StringBuilder b = new StringBuilder(); - for(Recording r : o) { - b.append(getObjectDescription(r)).append('\n'); - } - AccessibleToast.makeText(activity, b.toString().trim(), Toast.LENGTH_LONG).show(); - return true; - } - return false; - } @Override public LatLon getObjectLocation(Object o) { diff --git a/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java b/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java index e233a31d89..0d9a9c5424 100644 --- a/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java +++ b/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java @@ -74,7 +74,7 @@ public class DistanceCalculatorPlugin extends OsmandPlugin { private GPXFile originalGPX; private String distance = null; - private int distanceMeasurementMode = 0; + private int distanceMeasurementMode = 0; public DistanceCalculatorPlugin(OsmandApplication app) { this.app = app; @@ -491,7 +491,11 @@ public class DistanceCalculatorPlugin extends OsmandPlugin { @Override public boolean onLongPressEvent(PointF point, RotatedTileBox tileBox) { - if (distanceMeasurementMode == 1 && measurementPoints.size() > 0) { + + List s = new ArrayList<>(); + collectObjectsFromPoint(point, tileBox, s); + + if (s.size() == 0 && distanceMeasurementMode == 1 && measurementPoints.size() > 0) { LinkedList lt = measurementPoints.get(measurementPoints.size() - 1); if (lt.size() > 0) { lt.removeLast(); @@ -564,6 +568,16 @@ public class DistanceCalculatorPlugin extends OsmandPlugin { return false; } + @Override + public boolean disableSingleTap() { + return distanceMeasurementMode == 1; + } + + @Override + public boolean disableLongPressOnMap() { + return distanceMeasurementMode == 1; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { getMPointsFromPoint(tileBox, point, o); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java index 616a45e6bc..acabaa7ccd 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java @@ -198,25 +198,6 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider } } - @Override - public boolean onSingleTap(PointF point, RotatedTileBox tileBox) { - ArrayList list = new ArrayList(); - getBugFromPoint(tileBox, point, list); - if(!list.isEmpty()){ - StringBuilder res = new StringBuilder(); - int i = 0; - for(OpenStreetNote o : list) { - if (i++ > 0) { - res.append("\n\n"); - } - res.append(activity.getString(R.string.osb_bug_name)+ " : " + o.getCommentDescription()); //$NON-NLS-1$ - } - AccessibleToast.makeText(activity, res.toString(), Toast.LENGTH_LONG).show(); - return true; - } - return false; - } - public void clearCache() { if(data != null) { data.clearCache(); @@ -345,7 +326,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider builder.setNegativeButton(R.string.shared_string_cancel, null); ((EditText)openBug.findViewById(R.id.passwordEditText)).setText(((OsmandApplication) activity.getApplication()).getSettings().USER_PASSWORD.get()); ((EditText)openBug.findViewById(R.id.userNameEditText)).setText(getUserName()); - AndroidUtils.softKeyboardDelayed((EditText)openBug.findViewById(R.id.messageEditText)); + AndroidUtils.softKeyboardDelayed((EditText) openBug.findViewById(R.id.messageEditText)); builder.setPositiveButton(R.string.shared_string_add, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { @@ -554,6 +535,16 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider return null; } + @Override + public boolean disableSingleTap() { + return false; + } + + @Override + public boolean disableLongPressOnMap() { + return false; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List res) { getBugFromPoint(tileBox, point, res); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java index 2bbd9133f8..8aef79f7a9 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java @@ -140,6 +140,16 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC return (int) (r * tb.getDensity()); } + @Override + public boolean disableSingleTap() { + return false; + } + + @Override + public boolean disableLongPressOnMap() { + return false; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { getOsmEditsFromPoint(point, tileBox, o); diff --git a/OsmAnd/src/net/osmand/plus/osmo/OsMoPositionLayer.java b/OsmAnd/src/net/osmand/plus/osmo/OsMoPositionLayer.java index f68df2ad0a..ee35294899 100644 --- a/OsmAnd/src/net/osmand/plus/osmo/OsMoPositionLayer.java +++ b/OsmAnd/src/net/osmand/plus/osmo/OsMoPositionLayer.java @@ -190,21 +190,6 @@ public class OsMoPositionLayer extends OsmandMapLayer implements ContextMenuLaye } } } - - @Override - public boolean onSingleTap(PointF point, RotatedTileBox tileBox) { - List pos = new ArrayList(); - getOsmoFromPoint(tileBox, point, pos); - if (!pos.isEmpty()) { - StringBuilder res = new StringBuilder(); - for (OsMoDevice d : pos) { - res.append(getObjectDescription(d)).append("\n"); - } - AccessibleToast.makeText(view.getContext(), res.toString().trim(), Toast.LENGTH_LONG).show(); - return true; - } - return false; - } @Override public void destroyLayer() { @@ -215,6 +200,16 @@ public class OsMoPositionLayer extends OsmandMapLayer implements ContextMenuLaye return false; } + @Override + public boolean disableSingleTap() { + return false; + } + + @Override + public boolean disableLongPressOnMap() { + return false; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { getOsmoFromPoint(tileBox, point, o); diff --git a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionLayer.java b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionLayer.java index 916abb3974..f6595fd4db 100644 --- a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionLayer.java +++ b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionLayer.java @@ -97,19 +97,6 @@ public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuL } } - @Override - public boolean onSingleTap(PointF point, RotatedTileBox tileBox) { - List parkPos = new ArrayList(); - getParkingFromPoint(tileBox, point, parkPos); - if(!parkPos.isEmpty()){ - StringBuilder res = new StringBuilder(); - res.append(view.getContext().getString(R.string.osmand_parking_position_description)); - AccessibleToast.makeText(view.getContext(), getObjectDescription(getParkingPoint()), Toast.LENGTH_LONG).show(); - return true; - } - return false; - } - @Override public void destroyLayer() { } @@ -119,6 +106,16 @@ public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuL return false; } + @Override + public boolean disableSingleTap() { + return false; + } + + @Override + public boolean disableLongPressOnMap() { + return false; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { getParkingFromPoint(tileBox, point, o); diff --git a/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsLayer.java b/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsLayer.java index 08049bc43c..06b510ff31 100644 --- a/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsLayer.java +++ b/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsLayer.java @@ -30,6 +30,16 @@ public class RoutePointsLayer extends OsmandMapLayer implements ContextMenuLaye this.plugin = plugin; } + @Override + public boolean disableSingleTap() { + return false; + } + + @Override + public boolean disableLongPressOnMap() { + return false; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { diff --git a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java index 16b9306006..f0fe5128b7 100644 --- a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java @@ -33,7 +33,7 @@ import android.widget.TextView; public class ContextMenuLayer extends OsmandMapLayer { public interface IContextMenuProvider { - + public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o); public LatLon getObjectLocation(Object o); @@ -41,8 +41,9 @@ public class ContextMenuLayer extends OsmandMapLayer { public String getObjectDescription(Object o); public PointDescription getObjectName(Object o); - - + + public boolean disableSingleTap(); + public boolean disableLongPressOnMap(); } public interface IContextMenuProviderSelection { @@ -226,16 +227,53 @@ public class ContextMenuLayer extends OsmandMapLayer { view.refreshMap(); return true; } - LatLon latLon = selectObjectsForContextMenu(tileBox, point); - String description = getSelectedObjectDescription(); - setLocation(latLon, description); + + if (disableLongPressOnMap()) { + LatLon latLon = selectObjectsForContextMenu(tileBox, point); + if (latLon != null) { + String description = getSelectedObjectDescription(); + setLocation(latLon, description); + view.refreshMap(); + return true; + } else { + return false; + } + } + + final double lat = tileBox.getLatFromPixel((int) point.x, (int) point.y); + final double lon = tileBox.getLonFromPixel((int) point.x, (int) point.y); + setLocation(new LatLon(lat, lon), null); view.refreshMap(); return true; } + public boolean disableSingleTap() { + boolean res = false; + for(OsmandMapLayer lt : view.getLayers()){ + if(lt instanceof ContextMenuLayer.IContextMenuProvider) { + if (((IContextMenuProvider) lt).disableSingleTap()) { + res = true; + break; + } + } + } + return res; + } + + public boolean disableLongPressOnMap() { + boolean res = false; + for(OsmandMapLayer lt : view.getLayers()){ + if(lt instanceof ContextMenuLayer.IContextMenuProvider) { + if (((IContextMenuProvider) lt).disableLongPressOnMap()) { + res = true; + break; + } + } + } + return res; + } + public LatLon selectObjectsForContextMenu(RotatedTileBox tileBox, PointF point) { - final double lat = tileBox.getLatFromPixel((int) point.x, (int) point.y); - final double lon = tileBox.getLonFromPixel((int) point.x, (int) point.y); clearSelectedObjects(); List s = new ArrayList(); LatLon latLon = null; @@ -250,17 +288,14 @@ public class ContextMenuLayer extends OsmandMapLayer { ((IContextMenuProviderSelection) l).setSelectedObject(o); } if(latLon == null) { - latLon = ((ContextMenuLayer.IContextMenuProvider) l).getObjectLocation(o); + latLon = l.getObjectLocation(o); } } } } - if(latLon == null) { - latLon = new LatLon(lat, lon); - } return latLon; } - + @Override public boolean drawInScreenPixels() { return true; @@ -355,6 +390,14 @@ public class ContextMenuLayer extends OsmandMapLayer { activity.getMapActions().contextMenuPoint(latLon.getLatitude(), latLon.getLongitude()); } return true; + } else if (!disableSingleTap()) { + LatLon latLon = selectObjectsForContextMenu(tileBox, point); + if (latLon != null) { + String description = getSelectedObjectDescription(); + setLocation(latLon, description); + view.refreshMap(); + return true; + } } return false; } diff --git a/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java b/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java index 19725d35bb..a2fe263ddf 100644 --- a/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java @@ -290,11 +290,6 @@ public class DownloadedRegionsLayer extends OsmandMapLayer { return false; } - @Override - public boolean onSingleTap(PointF point, RotatedTileBox tileBox) { - return false; - } - @Override diff --git a/OsmAnd/src/net/osmand/plus/views/FavoritesLayer.java b/OsmAnd/src/net/osmand/plus/views/FavoritesLayer.java index b99a7ed8b7..350022f895 100644 --- a/OsmAnd/src/net/osmand/plus/views/FavoritesLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/FavoritesLayer.java @@ -152,26 +152,6 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer. } } - @Override - public boolean onSingleTap(PointF point, RotatedTileBox tileBox) { - List favs = new ArrayList(); - getFavoriteFromPoint(tileBox, point, favs); - if(!favs.isEmpty() && (tileBox.getZoom() > 14 || favs.size() < 6)){ - StringBuilder res = new StringBuilder(); - int i = 0; - for(LocationPoint fav : favs) { - if (i++ > 0) { - res.append("\n"); - } - res.append(PointDescription.getSimpleName(fav, view.getContext())); //$NON-NLS-1$ - } - AccessibleToast.makeText(view.getContext(), res.toString(), Toast.LENGTH_LONG).show(); - return true; - } - return false; - } - - @Override public String getObjectDescription(Object o) { Class fcl = getFavoriteClass(); @@ -191,6 +171,16 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer. return null; } + @Override + public boolean disableSingleTap() { + return false; + } + + @Override + public boolean disableLongPressOnMap() { + return false; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List res) { getFavoriteFromPoint(tileBox, point, res); diff --git a/OsmAnd/src/net/osmand/plus/views/GPXLayer.java b/OsmAnd/src/net/osmand/plus/views/GPXLayer.java index 2a5324a5e7..55223e7a1d 100644 --- a/OsmAnd/src/net/osmand/plus/views/GPXLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/GPXLayer.java @@ -425,26 +425,6 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex } } - @Override - public boolean onSingleTap(PointF point, RotatedTileBox tileBox) { - List gpxPoints = new ArrayList(); - getWptFromPoint(tileBox, point, gpxPoints); - if(!gpxPoints.isEmpty() && (tileBox.getZoom() > 14 || gpxPoints.size() < 6)){ - StringBuilder res = new StringBuilder(); - int i = 0; - for(WptPt fav : gpxPoints) { - if (i++ > 0) { - res.append("\n\n"); - } - res.append(view.getContext().getString(R.string.gpx_wpt) + " : " + fav.name); //$NON-NLS-1$ - } - AccessibleToast.makeText(view.getContext(), res.toString(), Toast.LENGTH_LONG).show(); - return true; - } - return false; - } - - @Override public String getObjectDescription(Object o) { if(o instanceof WptPt){ @@ -461,6 +441,16 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex return null; } + @Override + public boolean disableSingleTap() { + return false; + } + + @Override + public boolean disableLongPressOnMap() { + return false; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List res) { getWptFromPoint(tileBox, point, res); diff --git a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java index 1c7875dd0d..ccccf33c44 100644 --- a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java @@ -48,7 +48,6 @@ import android.graphics.Paint.Style; import android.graphics.PointF; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; -import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.net.Uri; import android.support.v4.view.MenuItemCompat; @@ -181,25 +180,6 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon } } - @Override - public boolean onSingleTap(PointF point, RotatedTileBox tileBox) { - List am = new ArrayList(); - getAmenityFromPoint(tileBox, point, am); - if (!am.isEmpty()) { - StringBuilder res = new StringBuilder(); - for (int i = 0; i < MAXIMUM_SHOW_AMENITIES && i < am.size(); i++) { - Amenity n = am.get(i); - if (i > 0) { - res.append("\n\n"); - } - buildPoiInformation(res, n); - } - AccessibleToast.makeText(view.getContext(), res.toString(), Toast.LENGTH_SHORT).show(); - return true; - } - return false; - } - private StringBuilder buildPoiInformation(StringBuilder res, Amenity n) { String format = OsmAndFormatter.getPoiStringWithoutType(n, view.getSettings().MAP_PREFERRED_LOCALE.get()); @@ -212,9 +192,10 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon this.view = view; paintIcon = new Paint(); - paintIcon.setStrokeWidth(1); - paintIcon.setStyle(Style.STROKE); - paintIcon.setColor(Color.BLUE); + //paintIcon.setStrokeWidth(1); + //paintIcon.setStyle(Style.STROKE); + //paintIcon.setColor(Color.BLUE); + paintIcon.setColorFilter(new PorterDuffColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN)); paintIconBackground = new Paint(); poiBackground = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_white_orange_poi_shield); poiBackgroundSmall = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_white_orange_poi_shield_small); @@ -241,13 +222,13 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon return (int) (r * tb.getDensity()); } - private RectF calculateRect(int x, int y, int width, int height) { - RectF rf; - float left = x - width / 2; - float top = y - height / 2; - float right = left + width; - float bottom = top + height; - rf = new RectF(left, top, right, bottom); + private QuadRect calculateRect(int x, int y, int width, int height) { + QuadRect rf; + double left = x - width / 2; + double top = y - height / 2; + double right = left + width; + double bottom = top + height; + rf = new QuadRect(left, top, right, bottom); return rf; } @@ -265,17 +246,17 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon } List objects = Collections.emptyList(); + List fullObjects = new ArrayList<>(); if (filter != null) { if (tileBox.getZoom() >= startZoom) { data.queryNewData(tileBox); objects = data.getResults(); if (objects != null) { int iconSize = poiBackground.getWidth() * 3 / 2; - List fullObjects = new ArrayList<>(); QuadRect bounds = new QuadRect(0, 0, tileBox.getPixWidth(), tileBox.getPixHeight()); - //bounds.inset(-bounds.width()/4, -bounds.height()/4); - QuadTree boundIntersections = new QuadTree(bounds, 4, 0.6f); - List result = new ArrayList(); + bounds.inset(-bounds.width()/4, -bounds.height()/4); + QuadTree boundIntersections = new QuadTree<>(bounds, 4, 0.6f); + List result = new ArrayList<>(); for (Amenity o : objects) { int x = (int) tileBox.getPixXFromLatLon(o.getLocation().getLatitude(), o.getLocation() @@ -283,12 +264,12 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon int y = (int) tileBox.getPixYFromLatLon(o.getLocation().getLatitude(), o.getLocation() .getLongitude()); boolean intersects =false; - RectF visibleRect = calculateRect(x, y, iconSize, iconSize); + QuadRect visibleRect = calculateRect(x, y, iconSize, iconSize); //canvas.drawRect(visibleRect, paintIcon); boundIntersections.queryInBox(new QuadRect(visibleRect.left, visibleRect.top, visibleRect.right, visibleRect.bottom), result); - for (RectF r : result) { - if (r.intersects(visibleRect.left, visibleRect.top, visibleRect.right, visibleRect.bottom)) { + for (QuadRect r : result) { + if (QuadRect.intersects(r, visibleRect)) { intersects = true; break; } @@ -320,7 +301,6 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon if (id != null) { Bitmap bmp = RenderingIcons.getIcon(view.getContext(), id, false); if (bmp != null) { - paintIcon.setColorFilter(new PorterDuffColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN)); canvas.drawBitmap(bmp, x - bmp.getWidth() / 2, y - bmp.getHeight() / 2, paintIcon); } } @@ -553,6 +533,16 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon return null; } + @Override + public boolean disableSingleTap() { + return false; + } + + @Override + public boolean disableLongPressOnMap() { + return false; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List objects) { getAmenityFromPoint(tileBox, point, objects); diff --git a/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java b/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java index c2d75bd38f..01b69c14b0 100644 --- a/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java @@ -143,16 +143,15 @@ public class PointNavigationLayer extends OsmandMapLayer implements IContextMenu } @Override - public boolean onLongPressEvent(PointF point, RotatedTileBox tileBox) { + public boolean disableSingleTap() { return false; } @Override - public boolean onSingleTap(PointF point, RotatedTileBox tileBox) { + public boolean disableLongPressOnMap() { return false; } - @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { TargetPointsHelper tg = map.getMyApplication().getTargetPointsHelper(); diff --git a/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java b/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java index 10ab60906e..78fb223425 100644 --- a/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java @@ -73,26 +73,6 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa - - - @Override - public boolean onSingleTap(PointF point, RotatedTileBox tileBox) { - ArrayList stops = new ArrayList(); - getFromPoint(tileBox, point, stops); - if(!stops.isEmpty()){ - StringBuilder res = new StringBuilder(); - int i = 0; - for (TransportStop n : stops) { - if (i++ > 0) { - res.append("\n\n"); - } - res.append(getStopDescription(n, true)); - } - AccessibleToast.makeText(view.getContext(), res.toString(), Toast.LENGTH_LONG).show(); - return true; - } - return false; - } private String getStopDescription(TransportStop n, boolean useName) { StringBuilder text = new StringBuilder(250); @@ -199,6 +179,16 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa return null; } + @Override + public boolean disableSingleTap() { + return false; + } + + @Override + public boolean disableLongPressOnMap() { + return false; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List res) { getFromPoint(tileBox, point, res);