diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 0dcefc83ca..e4c2cfbc91 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -716,7 +716,7 @@ public class OsmandSettings { public final CommonPreference SHOW_LINES_TO_FIRST_MARKERS = new BooleanPreference("show_lines_to_first_markers", false).makeProfile(); public final CommonPreference SHOW_ARROWS_TO_FIRST_MARKERS = new BooleanPreference("show_arrows_to_first_markers", false).makeProfile(); - public final CommonPreference ONE_TAP_MAKE_MARKER_FIRST = new BooleanPreference("one_tap_make_marker_first", false).makeProfile(); + public final CommonPreference SELECT_MARKER_ON_SINGLE_TAP = new BooleanPreference("select_marker_on_single_tap", false).makeProfile(); public final CommonPreference USE_MAPILLARY_FILTER = new BooleanPreference("use_mapillary_filters", false).makeGlobal(); public final CommonPreference MAPILLARY_FILTER_USER_KEY = new StringPreference("mapillary_filter_user_key", "").makeGlobal(); diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java index e8f0d287bb..046fc39059 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioNotesLayer.java @@ -182,6 +182,11 @@ public class AudioNotesLayer extends OsmandMapLayer implements return o instanceof Recording; } + @Override + public boolean runExclusiveAction(Object o, boolean unknownLocation) { + return false; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List objects) { if (tileBox.getZoom() >= startZoom) { diff --git a/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java b/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java index 487e2a22ac..f346b95d0c 100644 --- a/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java +++ b/OsmAnd/src/net/osmand/plus/distancecalculator/DistanceCalculatorPlugin.java @@ -589,6 +589,11 @@ public class DistanceCalculatorPlugin extends OsmandPlugin { return false; } + @Override + public boolean runExclusiveAction(Object o, boolean unknownLocation) { + return false; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { getMPointsFromPoint(tileBox, point, o); diff --git a/OsmAnd/src/net/osmand/plus/mapillary/MapillaryVectorLayer.java b/OsmAnd/src/net/osmand/plus/mapillary/MapillaryVectorLayer.java index 4f802340b3..69ff11e771 100644 --- a/OsmAnd/src/net/osmand/plus/mapillary/MapillaryVectorLayer.java +++ b/OsmAnd/src/net/osmand/plus/mapillary/MapillaryVectorLayer.java @@ -333,6 +333,11 @@ class MapillaryVectorLayer extends MapTileLayer implements MapillaryLayer, ICont return o instanceof MapillaryImage; } + @Override + public boolean runExclusiveAction(Object o, boolean unknownLocation) { + return false; + } + private void getImagesFromPoint(RotatedTileBox tb, PointF point, List images) { Map points = this.visiblePoints; if (points != null) { diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/DirectionIndicationDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/DirectionIndicationDialogFragment.java index ab6bd60d01..1b24b4a1dd 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/DirectionIndicationDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/DirectionIndicationDialogFragment.java @@ -183,11 +183,11 @@ public class DirectionIndicationDialogFragment extends BaseOsmAndDialogFragment }); final CompoundButton oneTapActiveToggle = (CompoundButton) mainView.findViewById(R.id.one_tap_active_switch); - oneTapActiveToggle.setChecked(settings.ONE_TAP_MAKE_MARKER_FIRST.get()); + oneTapActiveToggle.setChecked(settings.SELECT_MARKER_ON_SINGLE_TAP.get()); mainView.findViewById(R.id.one_tap_active_row).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - updateChecked(settings.ONE_TAP_MAKE_MARKER_FIRST, oneTapActiveToggle); + updateChecked(settings.SELECT_MARKER_ON_SINGLE_TAP, oneTapActiveToggle); } }); diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java index b56959ea9d..1cea9008ba 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java @@ -409,6 +409,11 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL return !isInMeasurementMode(); } + @Override + public boolean runExclusiveAction(Object o, boolean unknownLocation) { + return false; + } + interface OnSingleTapListener { void onAddPoint(); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java index 7452609509..5ed95ab18b 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java @@ -512,6 +512,11 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider return o instanceof OpenStreetNote; } + @Override + public boolean runExclusiveAction(Object o, boolean unknownLocation) { + return false; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List res) { if (tileBox.getZoom() >= startZoom) { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java index 1f86adec92..0699f9367a 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsLayer.java @@ -160,6 +160,11 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC return o instanceof OsmPoint; } + @Override + public boolean runExclusiveAction(Object o, boolean unknownLocation) { + return false; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { if (tileBox.getZoom() >= startZoom) { diff --git a/OsmAnd/src/net/osmand/plus/osmo/OsMoPositionLayer.java b/OsmAnd/src/net/osmand/plus/osmo/OsMoPositionLayer.java index 6e6209ce11..35e1368055 100644 --- a/OsmAnd/src/net/osmand/plus/osmo/OsMoPositionLayer.java +++ b/OsmAnd/src/net/osmand/plus/osmo/OsMoPositionLayer.java @@ -13,11 +13,11 @@ import android.graphics.PointF; import android.os.Handler; import android.util.DisplayMetrics; import android.view.WindowManager; + import net.osmand.Location; import net.osmand.data.LatLon; import net.osmand.data.PointDescription; import net.osmand.data.RotatedTileBox; -import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.R; import net.osmand.plus.TargetPointsHelper; import net.osmand.plus.TargetPointsHelper.TargetPoint; @@ -212,6 +212,11 @@ public class OsMoPositionLayer extends OsmandMapLayer implements ContextMenuLaye return o instanceof OsMoDevice; } + @Override + public boolean runExclusiveAction(Object o, boolean unknownLocation) { + 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 56823979bc..d768f4181d 100644 --- a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionLayer.java +++ b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionLayer.java @@ -135,6 +135,11 @@ public class ParkingPositionLayer extends OsmandMapLayer implements return o == getParkingPoint(); } + @Override + public boolean runExclusiveAction(Object o, boolean unknownLocation) { + 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 f171815e89..c8ac99da18 100644 --- a/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsLayer.java +++ b/OsmAnd/src/net/osmand/plus/routepointsnavigation/RoutePointsLayer.java @@ -42,6 +42,11 @@ public class RoutePointsLayer extends OsmandMapLayer implements ContextMenuLaye return false; } + @Override + public boolean runExclusiveAction(Object o, boolean unknownLocation) { + return false; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { diff --git a/OsmAnd/src/net/osmand/plus/views/AidlMapLayer.java b/OsmAnd/src/net/osmand/plus/views/AidlMapLayer.java index e6a7a562e0..b11e902931 100644 --- a/OsmAnd/src/net/osmand/plus/views/AidlMapLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/AidlMapLayer.java @@ -128,6 +128,11 @@ public class AidlMapLayer extends OsmandMapLayer implements IContextMenuProvider return o instanceof AMapPoint; } + @Override + public boolean runExclusiveAction(Object o, boolean unknownLocation) { + return false; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { getFromPoint(tileBox, point, o); diff --git a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java index 84ddef5780..08c0e05efe 100644 --- a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java @@ -642,6 +642,13 @@ public class ContextMenuLayer extends OsmandMapLayer { } } } + for (Map.Entry entry : selectedObjects.entrySet()) { + Object o = entry.getKey(); + IContextMenuProvider provider = entry.getValue(); + if (o != null && provider != null && provider.runExclusiveAction(o, showUnknownLocation)) { + return true; + } + } if (selectedObjects.size() == 1) { Object selectedObj = selectedObjects.keySet().iterator().next(); LatLon latLon = objectLatLon; @@ -924,6 +931,7 @@ public class ContextMenuLayer extends OsmandMapLayer { boolean isObjectClickable(Object o); + boolean runExclusiveAction(Object o, boolean unknownLocation); } public interface IMoveObjectProvider { diff --git a/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java b/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java index 402ddd540e..abbafcdb8e 100644 --- a/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java @@ -11,9 +11,9 @@ import android.graphics.PointF; import android.text.TextPaint; import android.util.DisplayMetrics; import android.view.WindowManager; + import net.osmand.IndexConstants; import net.osmand.binary.BinaryMapDataObject; -import net.osmand.binary.BinaryMapIndexReader; import net.osmand.binary.BinaryMapIndexReader.TagValuePair; import net.osmand.data.LatLon; import net.osmand.data.PointDescription; @@ -458,6 +458,11 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe return false; } + @Override + public boolean runExclusiveAction(Object o, boolean unknownLocation) { + return false; + } + private void getWorldRegionFromPoint(RotatedTileBox tb, PointF point, List dataObjects) { int zoom = tb.getZoom(); if (zoom >= ZOOM_TO_SHOW_SELECTION_ST && zoom < ZOOM_TO_SHOW_SELECTION diff --git a/OsmAnd/src/net/osmand/plus/views/FavouritesLayer.java b/OsmAnd/src/net/osmand/plus/views/FavouritesLayer.java index d820578ecf..9efc9f1054 100644 --- a/OsmAnd/src/net/osmand/plus/views/FavouritesLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/FavouritesLayer.java @@ -209,6 +209,11 @@ public class FavouritesLayer extends OsmandMapLayer implements ContextMenuLayer. return o instanceof FavouritePoint && o != contextMenuLayer.getMoveableObject(); } + @Override + public boolean runExclusiveAction(Object o, boolean unknownLocation) { + return false; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List res) { if (this.settings.SHOW_FAVORITES.get() && tileBox.getZoom() >= startZoom) { diff --git a/OsmAnd/src/net/osmand/plus/views/GPXLayer.java b/OsmAnd/src/net/osmand/plus/views/GPXLayer.java index e5f4b73fc9..be7921a76d 100644 --- a/OsmAnd/src/net/osmand/plus/views/GPXLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/GPXLayer.java @@ -564,6 +564,11 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex return o instanceof WptPt; } + @Override + public boolean runExclusiveAction(Object o, boolean unknownLocation) { + return false; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List res) { if (tileBox.getZoom() >= startZoom) { diff --git a/OsmAnd/src/net/osmand/plus/views/ImpassableRoadsLayer.java b/OsmAnd/src/net/osmand/plus/views/ImpassableRoadsLayer.java index 27136462c4..9fd7c62e70 100644 --- a/OsmAnd/src/net/osmand/plus/views/ImpassableRoadsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/ImpassableRoadsLayer.java @@ -161,6 +161,11 @@ public class ImpassableRoadsLayer extends OsmandMapLayer implements return false; } + @Override + public boolean runExclusiveAction(Object o, boolean unknownLocation) { + return false; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { if (tileBox.getZoom() >= startZoom) { diff --git a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java index 65e2b40e11..3de4f99215 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapMarkersLayer.java @@ -481,6 +481,16 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi return false; } + @Override + public boolean runExclusiveAction(Object o, boolean unknownLocation) { + if (unknownLocation || !(o instanceof MapMarker) + || !map.getMyApplication().getSettings().SELECT_MARKER_ON_SINGLE_TAP.get()) { + return false; + } + map.getMyApplication().getMapMarkersHelper().moveMarkerToTop((MapMarker) o); + return true; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { if (tileBox.getZoom() < 3 || !map.getMyApplication().getSettings().USE_MAP_MARKERS.get()) { diff --git a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java index 04b7287646..8d619e05f8 100644 --- a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java @@ -1,7 +1,6 @@ package net.osmand.plus.views; import android.app.Dialog; -import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.res.Resources; @@ -15,7 +14,6 @@ import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.drawable.Drawable; import android.net.Uri; -import android.provider.Settings; import android.support.v4.content.ContextCompat; import android.support.v4.view.MenuItemCompat; import android.support.v7.widget.PopupMenu; @@ -35,6 +33,7 @@ import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; import android.widget.ScrollView; import android.widget.TextView; + import net.osmand.AndroidUtils; import net.osmand.PlatformUtil; import net.osmand.ResultMatcher; @@ -564,6 +563,11 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon return o instanceof Amenity; } + @Override + public boolean runExclusiveAction(Object o, boolean unknownLocation) { + return false; + } + @Override public LatLon getTextLocation(Amenity o) { return o.getLocation(); diff --git a/OsmAnd/src/net/osmand/plus/views/PointLocationLayer.java b/OsmAnd/src/net/osmand/plus/views/PointLocationLayer.java index 67f527ca10..64a0098002 100644 --- a/OsmAnd/src/net/osmand/plus/views/PointLocationLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/PointLocationLayer.java @@ -215,6 +215,11 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay return false; } + @Override + public boolean runExclusiveAction(Object o, boolean unknownLocation) { + return false; + } + private LatLon getMyLocation() { Location location = locationProvider.getLastKnownLocation(); if (location != null) { diff --git a/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java b/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java index 65910cccc5..9d70ae0c7f 100644 --- a/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java @@ -14,7 +14,6 @@ import android.support.v4.content.ContextCompat; import net.osmand.data.LatLon; import net.osmand.data.PointDescription; -import net.osmand.data.QuadPoint; import net.osmand.data.RotatedTileBox; import net.osmand.plus.R; import net.osmand.plus.TargetPointsHelper; @@ -22,7 +21,6 @@ import net.osmand.plus.TargetPointsHelper.TargetPoint; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.views.ContextMenuLayer.IContextMenuProvider; -import java.util.Iterator; import java.util.List; public class PointNavigationLayer extends OsmandMapLayer implements @@ -180,6 +178,11 @@ public class PointNavigationLayer extends OsmandMapLayer implements return false; } + @Override + public boolean runExclusiveAction(Object o, boolean unknownLocation) { + return false; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List o) { if (tileBox.getZoom() >= 3) { diff --git a/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java b/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java index 9715308027..b43cfae364 100644 --- a/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/TransportStopsLayer.java @@ -279,6 +279,11 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa return false; } + @Override + public boolean runExclusiveAction(Object o, boolean unknownLocation) { + return false; + } + @Override public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List res) { if(tileBox.getZoom() >= startZoomRoute && route != null) {