Search in sources :

Example 1 with ChooseRouteFragment

use of net.osmand.plus.routepreparationmenu.ChooseRouteFragment in project Osmand by osmandapp.

the class ContextMenuLayer method onSingleTap.

@Override
public boolean onSingleTap(PointF point, RotatedTileBox tileBox) {
    MapActivity mapActivity = getMapActivity();
    if (mapActivity == null || menu == null || mInChangeMarkerPositionMode || mInGpxDetailsMode || mapActivity.getGpsFilterFragment() != null || mapActivity.getDownloadTilesFragment() != null) {
        return true;
    }
    if (pressedContextMarker(tileBox, point.x, point.y)) {
        hideVisibleMenues();
        menu.show();
        return true;
    }
    if (selectOnMap != null) {
        LatLon latlon = tileBox.getLatLonFromPixel(point.x, point.y);
        menu.init(latlon, null, null);
        CallbackWithObject<LatLon> cb = selectOnMap;
        cb.processResult(latlon);
        selectOnMap = null;
        return true;
    }
    if (!disableSingleTap()) {
        boolean res = showContextMenu(point, tileBox, false);
        if (res) {
            return true;
        }
    }
    boolean processed = hideVisibleMenues();
    processed |= menu.onSingleTapOnMap();
    if (!processed && MapRouteInfoMenu.chooseRoutesVisible) {
        WeakReference<ChooseRouteFragment> chooseRouteFragmentRef = mapActivity.getMapRouteInfoMenu().findChooseRouteFragment();
        if (chooseRouteFragmentRef != null) {
            ChooseRouteFragment chooseRouteFragment = chooseRouteFragmentRef.get();
            if (chooseRouteFragment != null) {
                chooseRouteFragment.dismiss();
                processed = true;
            }
        }
    }
    if (!processed) {
        MapControlsLayer mapControlsLayer = getApplication().getOsmandMap().getMapLayers().getMapControlsLayer();
        if (mapControlsLayer != null && (!mapControlsLayer.isMapControlsVisible() || getApplication().getSettings().MAP_EMPTY_STATE_ALLOWED.get())) {
            mapControlsLayer.switchMapControlsVisibility(true);
        }
    }
    return false;
}
Also used : LatLon(net.osmand.data.LatLon) ChooseRouteFragment(net.osmand.plus.routepreparationmenu.ChooseRouteFragment) MapActivity(net.osmand.plus.activities.MapActivity)

Aggregations

LatLon (net.osmand.data.LatLon)1 MapActivity (net.osmand.plus.activities.MapActivity)1 ChooseRouteFragment (net.osmand.plus.routepreparationmenu.ChooseRouteFragment)1