Fix MapMultiSelectionMenu menu for tracks
This commit is contained in:
parent
47e08d7338
commit
60b346373f
17 changed files with 114 additions and 20 deletions
|
@ -169,6 +169,11 @@ public class AudioNotesLayer extends OsmandMapLayer implements
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showMenuAction(@Nullable Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> objects, boolean unknownLocation) {
|
||||
if (tileBox.getZoom() >= startZoom) {
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.graphics.Canvas;
|
|||
import android.graphics.Paint;
|
||||
import android.graphics.PointF;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
@ -346,6 +347,11 @@ class MapillaryVectorLayer extends MapTileLayer implements MapillaryLayer, ICont
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showMenuAction(@Nullable Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void getImagesFromPoint(RotatedTileBox tb, PointF point, List<? super MapillaryImage> images) {
|
||||
Map<QuadPointDouble, Map> points = this.visiblePoints;
|
||||
if (points != null) {
|
||||
|
|
|
@ -7,6 +7,7 @@ import android.graphics.Paint;
|
|||
import android.graphics.Path;
|
||||
import android.graphics.PointF;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import net.osmand.GPXUtilities.TrkSegment;
|
||||
|
@ -516,6 +517,11 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showMenuAction(@Nullable Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private Location getLocationFromLL(double lat, double lon) {
|
||||
Location l = new Location("");
|
||||
l.setLatitude(lat);
|
||||
|
|
|
@ -7,6 +7,7 @@ import android.view.View;
|
|||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
|
@ -467,6 +468,11 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showMenuAction(@Nullable Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> res, boolean unknownLocation) {
|
||||
if (tileBox.getZoom() >= startZoom) {
|
||||
|
|
|
@ -194,6 +194,11 @@ public class OsmEditsLayer extends OsmandMapLayer implements ContextMenuLayer.IC
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showMenuAction(@Nullable Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) {
|
||||
if (tileBox.getZoom() >= startZoom) {
|
||||
|
|
|
@ -24,13 +24,14 @@ import net.osmand.data.LatLon;
|
|||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.settings.backend.CommonPreference;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||
import net.osmand.plus.settings.backend.CommonPreference;
|
||||
import net.osmand.plus.views.OsmandMapLayer;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.plus.views.layers.ContextMenuLayer.IContextMenuProvider;
|
||||
import net.osmand.plus.views.layers.MapTextLayer.MapTextProvider;
|
||||
import net.osmand.plus.widgets.tools.CropCircleTransformation;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -46,7 +47,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
|
||||
import static net.osmand.aidl.ConnectedApp.AIDL_LAYERS_PREFIX;
|
||||
|
||||
public class AidlMapLayer extends OsmandMapLayer implements IContextMenuProvider, MapTextLayer.MapTextProvider<AidlMapPointWrapper> {
|
||||
public class AidlMapLayer extends OsmandMapLayer implements IContextMenuProvider, MapTextProvider<AidlMapPointWrapper> {
|
||||
|
||||
private static final float POINT_IMAGE_VERTICAL_OFFSET = 0.91f;
|
||||
|
||||
|
@ -281,6 +282,11 @@ public class AidlMapLayer extends OsmandMapLayer implements IContextMenuProvider
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showMenuAction(@Nullable Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) {
|
||||
if (isLayerEnabled()) {
|
||||
|
|
|
@ -609,7 +609,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
String title = pointDescription == null ? "" : pointDescription.getName();
|
||||
mAddGpxPointBottomSheetHelper.setTitle(title);
|
||||
view.getAnimatedDraggingThread().startMoving(latLon.getLatitude(), latLon.getLongitude(), view.getZoom(), true);
|
||||
} else {
|
||||
} else if (provider == null || !provider.showMenuAction(object)) {
|
||||
selectedObjectContextMenuProvider = provider;
|
||||
hideVisibleMenues();
|
||||
activity.getMapViewTrackingUtilities().setMapLinkedToLocation(false);
|
||||
|
@ -1106,6 +1106,8 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
boolean isObjectClickable(Object o);
|
||||
|
||||
boolean runExclusiveAction(@Nullable Object o, boolean unknownLocation);
|
||||
|
||||
boolean showMenuAction(@Nullable Object o);
|
||||
}
|
||||
|
||||
public interface IMoveObjectProvider {
|
||||
|
|
|
@ -13,6 +13,7 @@ import android.util.DisplayMetrics;
|
|||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.binary.BinaryMapDataObject;
|
||||
|
@ -580,6 +581,11 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showMenuAction(@Nullable Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void getWorldRegionFromPoint(RotatedTileBox tb, PointF point, List<? super DownloadMapObject> dataObjects) {
|
||||
int zoom = tb.getZoom();
|
||||
if (zoom >= ZOOM_TO_SHOW_SELECTION_ST && zoom < ZOOM_TO_SHOW_SELECTION
|
||||
|
|
|
@ -227,6 +227,11 @@ public class FavouritesLayer extends OsmandMapLayer implements IContextMenuProvi
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showMenuAction(@Nullable Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> res, boolean unknownLocation) {
|
||||
if (this.settings.SHOW_FAVORITES.get() && tileBox.getZoom() >= startZoom) {
|
||||
|
|
|
@ -1108,13 +1108,7 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM
|
|||
|
||||
@Override
|
||||
public boolean runExclusiveAction(Object object, boolean unknownLocation) {
|
||||
if (unknownLocation || !(object instanceof SelectedGpxPoint)) {
|
||||
return false;
|
||||
}
|
||||
MapActivity mapActivity = (MapActivity) view.getContext();
|
||||
SelectedGpxPoint point = (SelectedGpxPoint) object;
|
||||
TrackMenuFragment.showInstance(mapActivity, point.getSelectedGpxFile(), point, null, null, false);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1158,14 +1152,24 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM
|
|||
SelectedGpxPoint selectedGpxPoint = (SelectedGpxPoint) trackPoints.get(0);
|
||||
WptPt wptPt = selectedGpxPoint.getSelectedPoint();
|
||||
PointDescription description = getObjectName(selectedGpxPoint);
|
||||
ContextMenuLayer contextMenuLayer = mapActivity.getMapLayers().getContextMenuLayer();
|
||||
contextMenuLayer.showContextMenu(new LatLon(wptPt.lat, wptPt.lon), description, selectedGpxPoint, this);
|
||||
mapActivity.getContextMenu().show(new LatLon(wptPt.lat, wptPt.lon), description, selectedGpxPoint);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showMenuAction(@Nullable Object object) {
|
||||
if (!(object instanceof SelectedGpxPoint)) {
|
||||
return false;
|
||||
}
|
||||
MapActivity mapActivity = (MapActivity) view.getContext();
|
||||
SelectedGpxPoint point = (SelectedGpxPoint) object;
|
||||
TrackMenuFragment.showInstance(mapActivity, point.getSelectedGpxFile(), point, null, null, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LatLon getTextLocation(WptPt o) {
|
||||
return new LatLon(o.lat, o.lon);
|
||||
|
|
|
@ -142,6 +142,11 @@ public class ImpassableRoadsLayer extends OsmandMapLayer implements
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showMenuAction(@Nullable Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) {
|
||||
if (tileBox.getZoom() >= START_ZOOM) {
|
||||
|
|
|
@ -531,6 +531,11 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showMenuAction(@Nullable Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) {
|
||||
if (tileBox.getZoom() < 3 || !map.getMyApplication().getSettings().SHOW_MAP_MARKERS.get()) {
|
||||
|
|
|
@ -16,6 +16,7 @@ import android.widget.LinearLayout.LayoutParams;
|
|||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
|
@ -408,6 +409,11 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showMenuAction(@Nullable Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LatLon getTextLocation(Amenity o) {
|
||||
return o.getLocation();
|
||||
|
|
|
@ -13,6 +13,7 @@ import android.graphics.RectF;
|
|||
import android.graphics.drawable.LayerDrawable;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
|
@ -22,14 +23,15 @@ import net.osmand.PlatformUtil;
|
|||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.OsmAndLocationProvider;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
||||
import net.osmand.plus.profiles.ProfileIconColors;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.views.OsmandMapLayer;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.plus.views.layers.ContextMenuLayer.IContextMenuProvider;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
|
@ -38,7 +40,7 @@ import java.util.List;
|
|||
import static android.graphics.Paint.ANTI_ALIAS_FLAG;
|
||||
import static android.graphics.Paint.FILTER_BITMAP_FLAG;
|
||||
|
||||
public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider {
|
||||
public class PointLocationLayer extends OsmandMapLayer implements IContextMenuProvider {
|
||||
private static final Log LOG = PlatformUtil.getLog(PointLocationLayer.class);
|
||||
|
||||
protected final static int RADIUS = 7;
|
||||
|
@ -240,6 +242,11 @@ public class PointLocationLayer extends OsmandMapLayer implements ContextMenuLay
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showMenuAction(@Nullable Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private LatLon getMyLocation() {
|
||||
Location location = locationProvider.getLastKnownLocation();
|
||||
if (location != null) {
|
||||
|
|
|
@ -23,11 +23,13 @@ import net.osmand.plus.activities.MapActivity;
|
|||
import net.osmand.plus.views.OsmandMapLayer;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.plus.views.layers.ContextMenuLayer.IContextMenuProvider;
|
||||
import net.osmand.plus.views.layers.ContextMenuLayer.IMoveObjectProvider;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PointNavigationLayer extends OsmandMapLayer implements
|
||||
IContextMenuProvider, ContextMenuLayer.IMoveObjectProvider {
|
||||
IContextMenuProvider, IMoveObjectProvider {
|
||||
|
||||
protected final static int DIST_TO_SHOW = 80;
|
||||
|
||||
private Paint mPoint;
|
||||
|
@ -186,6 +188,11 @@ public class PointNavigationLayer extends OsmandMapLayer implements
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showMenuAction(@Nullable Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o, boolean unknownLocation) {
|
||||
if (tileBox.getZoom() >= 3) {
|
||||
|
|
|
@ -46,6 +46,7 @@ import net.osmand.plus.routing.TransportRoutingHelper;
|
|||
import net.osmand.plus.settings.backend.CommonPreference;
|
||||
import net.osmand.plus.views.OsmandMapLayer;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.plus.views.layers.ContextMenuLayer.IContextMenuProvider;
|
||||
import net.osmand.plus.views.layers.geometry.PublicTransportGeometryWay;
|
||||
import net.osmand.plus.views.layers.geometry.PublicTransportGeometryWayContext;
|
||||
import net.osmand.plus.views.layers.geometry.RouteGeometryWay;
|
||||
|
@ -67,7 +68,7 @@ import java.util.Map;
|
|||
|
||||
import static net.osmand.plus.dialogs.ConfigureMapMenu.CURRENT_TRACK_WIDTH_ATTR;
|
||||
|
||||
public class RouteLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider {
|
||||
public class RouteLayer extends OsmandMapLayer implements IContextMenuProvider {
|
||||
|
||||
private static final Log log = PlatformUtil.getLog(RouteLayer.class);
|
||||
|
||||
|
@ -815,4 +816,9 @@ public class RouteLayer extends OsmandMapLayer implements ContextMenuLayer.ICont
|
|||
public boolean runExclusiveAction(@Nullable Object o, boolean unknownLocation) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showMenuAction(@Nullable Object o) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import android.util.DisplayMetrics;
|
|||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import net.osmand.ResultMatcher;
|
||||
|
@ -21,16 +22,17 @@ import net.osmand.data.TransportStop;
|
|||
import net.osmand.osm.edit.Node;
|
||||
import net.osmand.osm.edit.Way;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.base.PointImageDrawable;
|
||||
import net.osmand.plus.settings.backend.CommonPreference;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.PointImageDrawable;
|
||||
import net.osmand.plus.render.RenderingIcons;
|
||||
import net.osmand.plus.settings.backend.CommonPreference;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.plus.transport.TransportStopRoute;
|
||||
import net.osmand.plus.transport.TransportStopType;
|
||||
import net.osmand.plus.views.OsmandMapLayer;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.plus.views.layers.ContextMenuLayer.IContextMenuProvider;
|
||||
import net.osmand.plus.views.layers.geometry.GeometryWay;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -40,7 +42,7 @@ import java.util.Comparator;
|
|||
import java.util.List;
|
||||
import java.util.TreeSet;
|
||||
|
||||
public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider {
|
||||
public class TransportStopsLayer extends OsmandMapLayer implements IContextMenuProvider {
|
||||
|
||||
public static final String TRANSPORT_STOPS_OVER_MAP = "transportStops";
|
||||
|
||||
|
@ -308,6 +310,11 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showMenuAction(@Nullable Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> res, boolean unknownLocation) {
|
||||
if(tileBox.getZoom() >= startZoomRoute && stopRoute != null) {
|
||||
|
|
Loading…
Reference in a new issue