src/main/java/de/blau/android/easyedit/turnrestriction/ViaElementActionModeCallback.java
/**
     * The next step in adding the restriction
     * 
     * @param element the clicked element
     * @param viaNode the via node
     * @param toWay the to way
     */
The next step in adding the restriction

@param element the clicked element
@param viaNode the via node
@param toWay the to way
The next step in adding the restriction @param element the clicked element @param viaNode the via node @param toWay the to way
private void nextStep(@NonNull OsmElement element, @NonNull Node viaNode, @NonNull Way toWay) {
        if (viaElement != null && viaElement.equals(toWay)) {
            main.startSupportActionMode(
                    new RestrictionWaySplittingActionModeCallback(manager, R.string.actionmode_restriction_split_via, toWay, fromWay, savedResults));
        } else if (!toWay.isEndNode(viaNode) && !toWay.isClosed()) { 
            splitSafe(Util.wrapInList(toWay), () -> {
                try {
                    List<Result> result = logic.performSplit(main, toWay, viaNode);
                    Way newToWay = newWayFromSplitResult(result);
                    saveSplitResult(toWay, result);
                    Snack.barInfo(main, R.string.toast_split_to);
                    Set<OsmElement> toCandidates = new HashSet<>();
                    toCandidates.add(toWay);
                    toCandidates.add(newToWay);
                    main.startSupportActionMode(new ViaElementActionModeCallback(manager, fromWay, viaElement, toCandidates, savedResults));
                } catch (OsmIllegalOperationException | StorageException ex) {
                    manager.finish();
                }
            });
        } else {
            toSelected = true;
            main.startSupportActionMode(new ToElementActionModeCallback(manager, fromWay, viaElement, (Way) element, savedResults)); 
        }
    }
private void nextStep ( @ NonNull OsmElement element , @ NonNull Node viaNode , @ NonNull Way toWay ) { if ( viaElement != null && viaElement . equals ( toWay ) ) { main . startSupportActionMode ( new RestrictionWaySplittingActionModeCallback ( manager , R . string . actionmode_restriction_split_via , toWay , fromWay , savedResults ) ) ; } else if ( ! toWay . isEndNode ( viaNode ) && ! toWay . isClosed ( ) ) { splitSafe ( Util . wrapInList ( toWay ) , ( ) -> { try { List < Result > result = logic . performSplit ( main , toWay , viaNode ) ; Way newToWay = newWayFromSplitResult ( result ) ; saveSplitResult ( toWay , result ) ; Snack . barInfo ( main , R . string . toast_split_to ) ; Set < OsmElement > toCandidates = new HashSet < > ( ) ; toCandidates . add ( toWay ) ; toCandidates . add ( newToWay ) ; main . startSupportActionMode ( new ViaElementActionModeCallback ( manager , fromWay , viaElement , toCandidates , savedResults ) ) ; } catch ( OsmIllegalOperationException | StorageException ex ) { manager . finish ( ) ; } } ) ; } else { toSelected = true ; main . startSupportActionMode ( new ToElementActionModeCallback ( manager , fromWay , viaElement , ( Way ) element , savedResults ) ) ; } }
The next step in adding the restriction
The next step in adding the restriction
// now check if we need to split the toWay // toast has already been displayed // NOSONAR // viaElement can't actually be null