Search in sources :

Example 6 with MapContextMenu

use of net.osmand.plus.mapcontextmenu.MapContextMenu in project Osmand by osmandapp.

the class AvoidSpecificRoads method addImpassableRoadInternal.

private void addImpassableRoadInternal(@NonNull RouteDataObject object, @NonNull Location ll, boolean showDialog, @Nullable MapActivity activity, @NonNull LatLon loc) {
    if (!app.getDefaultRoutingConfig().addImpassableRoad(object, ll)) {
        LatLon location = getLocation(object);
        if (location != null) {
            app.getSettings().removeImpassableRoad(getLocation(object));
        }
    }
    RoutingHelper rh = app.getRoutingHelper();
    if (rh.isRouteCalculated() || rh.isRouteBeingCalculated()) {
        rh.recalculateRouteDueToSettingsChange();
    }
    if (activity != null) {
        if (showDialog) {
            showDialog(activity);
        }
        MapContextMenu menu = activity.getContextMenu();
        if (menu.isActive() && menu.getLatLon().equals(loc)) {
            menu.close();
        }
        activity.refreshMap();
    }
}
Also used : LatLon(net.osmand.data.LatLon) MapContextMenu(net.osmand.plus.mapcontextmenu.MapContextMenu) RoutingHelper(net.osmand.plus.routing.RoutingHelper)

Example 7 with MapContextMenu

use of net.osmand.plus.mapcontextmenu.MapContextMenu in project Osmand by osmandapp.

the class ExternalApiHelper method showOnMap.

private void showOnMap(double lat, double lon, Object object, PointDescription pointDescription) {
    MapContextMenu mapContextMenu = mapActivity.getContextMenu();
    mapContextMenu.setMapCenter(new LatLon(lat, lon));
    mapContextMenu.setMapPosition(mapActivity.getMapView().getMapPosition());
    mapContextMenu.setCenterMarker(true);
    mapContextMenu.setMapZoom(15);
    mapContextMenu.show(new LatLon(lat, lon), pointDescription, object);
}
Also used : LatLon(net.osmand.data.LatLon) MapContextMenu(net.osmand.plus.mapcontextmenu.MapContextMenu)

Example 8 with MapContextMenu

use of net.osmand.plus.mapcontextmenu.MapContextMenu in project Osmand by osmandapp.

the class AudioVideoNotesPlugin method updateContextMenu.

private void updateContextMenu(Recording rec) {
    if (mapActivity != null && rec != null) {
        MapContextMenu menu = mapActivity.getContextMenu();
        menu.show(new LatLon(rec.lat, rec.lon), audioNotesLayer.getObjectName(rec), rec);
        if (app.getRoutingHelper().isFollowingMode()) {
            menu.hideWithTimeout(3000);
        }
    }
}
Also used : LatLon(net.osmand.data.LatLon) MapContextMenu(net.osmand.plus.mapcontextmenu.MapContextMenu)

Example 9 with MapContextMenu

use of net.osmand.plus.mapcontextmenu.MapContextMenu in project Osmand by osmandapp.

the class ParkingPositionPlugin method showContextMenuIfNeeded.

void showContextMenuIfNeeded(final MapActivity mapActivity, boolean animated) {
    if (parkingLayer != null) {
        MapContextMenu menu = mapActivity.getContextMenu();
        if (menu.isVisible()) {
            menu.hide(animated);
            menu.show(new LatLon(parkingPosition.getLatitude(), parkingPosition.getLongitude()), parkingLayer.getObjectName(parkingPosition), parkingPosition);
        }
    }
}
Also used : LatLon(net.osmand.data.LatLon) MapContextMenu(net.osmand.plus.mapcontextmenu.MapContextMenu)

Example 10 with MapContextMenu

use of net.osmand.plus.mapcontextmenu.MapContextMenu in project Osmand by osmandapp.

the class DownloadedRegionsLayer method collectObjectsFromPoint.

// IContextMenuProvider
@Override
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> objects, boolean unknownLocation) {
    boolean isMenuVisible = false;
    if (view.getContext() instanceof MapActivity) {
        MapActivity mapActivity = (MapActivity) view.getContext();
        MapContextMenu menu = mapActivity.getContextMenu();
        MapMultiSelectionMenu multiMenu = menu.getMultiSelectionMenu();
        isMenuVisible = menu.isVisible() || multiMenu.isVisible();
    }
    if (!isMenuVisible) {
        getWorldRegionFromPoint(tileBox, point, objects);
    }
}
Also used : MapContextMenu(net.osmand.plus.mapcontextmenu.MapContextMenu) MapMultiSelectionMenu(net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu) MapActivity(net.osmand.plus.activities.MapActivity)

Aggregations

MapContextMenu (net.osmand.plus.mapcontextmenu.MapContextMenu)13 LatLon (net.osmand.data.LatLon)8 View (android.view.View)2 OnClickListener (android.view.View.OnClickListener)2 PointDescription (net.osmand.data.PointDescription)2 RoutingHelper (net.osmand.plus.routing.RoutingHelper)2 DialogInterface (android.content.DialogInterface)1 AlertDialog (android.support.v7.app.AlertDialog)1 ImageView (android.widget.ImageView)1 TapTargetView (com.getkeepsafe.taptargetview.TapTargetView)1 RotatedTileBox (net.osmand.data.RotatedTileBox)1 TransportStop (net.osmand.data.TransportStop)1 TargetPointsHelper (net.osmand.plus.TargetPointsHelper)1 MapActivity (net.osmand.plus.activities.MapActivity)1 MapMultiSelectionMenu (net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu)1