Search in sources :

Example 1 with SnapToRoadFragmentListener

use of net.osmand.plus.measurementtool.SnapToRoadBottomSheetDialogFragment.SnapToRoadFragmentListener in project Osmand by osmandapp.

the class PlanRouteFragment method createSnapToRoadFragmentListener.

private SnapToRoadFragmentListener createSnapToRoadFragmentListener() {
    return new SnapToRoadFragmentListener() {

        @Override
        public void onDestroyView(boolean snapToRoadEnabled) {
        }

        @Override
        public void onApplicationModeItemClick(ApplicationMode mode) {
            if (planRouteContext.getSnappedMode() != mode) {
                boolean defaultMode = mode == ApplicationMode.DEFAULT;
                MapMarkersLayer layer = getMapMarkersLayer();
                if (layer != null) {
                    layer.setDefaultAppMode(defaultMode);
                }
                if (defaultMode) {
                    planRouteContext.cancelSnapToRoad();
                }
                planRouteContext.getSnappedToRoadPoints().clear();
                planRouteContext.setSnappedMode(mode);
                planRouteContext.recreateSnapTrkSegment(false);
                setupAppModesBtn();
            }
        }
    };
}
Also used : MapMarkersLayer(net.osmand.plus.views.MapMarkersLayer) SnapToRoadFragmentListener(net.osmand.plus.measurementtool.SnapToRoadBottomSheetDialogFragment.SnapToRoadFragmentListener) ApplicationMode(net.osmand.plus.ApplicationMode)

Example 2 with SnapToRoadFragmentListener

use of net.osmand.plus.measurementtool.SnapToRoadBottomSheetDialogFragment.SnapToRoadFragmentListener in project Osmand by osmandapp.

the class MeasurementToolFragment method createSnapToRoadFragmentListener.

private SnapToRoadFragmentListener createSnapToRoadFragmentListener() {
    return new SnapToRoadFragmentListener() {

        @Override
        public void onDestroyView(boolean snapToRoadEnabled) {
            if (!snapToRoadEnabled && !editingCtx.isInSnapToRoadMode()) {
                toolBarController.setTitle(previousToolBarTitle);
                MapActivity mapActivity = getMapActivity();
                if (mapActivity != null) {
                    mapActivity.refreshMap();
                }
            }
        }

        @Override
        public void onApplicationModeItemClick(ApplicationMode mode) {
            enableSnapToRoadMode(mode);
        }
    };
}
Also used : SnapToRoadFragmentListener(net.osmand.plus.measurementtool.SnapToRoadBottomSheetDialogFragment.SnapToRoadFragmentListener) ApplicationMode(net.osmand.plus.ApplicationMode) MapActivity(net.osmand.plus.activities.MapActivity)

Aggregations

ApplicationMode (net.osmand.plus.ApplicationMode)2 SnapToRoadFragmentListener (net.osmand.plus.measurementtool.SnapToRoadBottomSheetDialogFragment.SnapToRoadFragmentListener)2 MapActivity (net.osmand.plus.activities.MapActivity)1 MapMarkersLayer (net.osmand.plus.views.MapMarkersLayer)1