@Override
    public View onCreateView(@NonNull final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {

        binding = CoordinatescalculateglobalDialogBinding.inflate(inflater, container, false);
        binding.NonPlainFormat.setVisibility(View.GONE);
        binding.ccSwitchGuided.setChecked(false);
        binding.ccGuidedFormat.setVisibility(View.GONE);

        //handle dialog title
        final Dialog dialog = getDialog();
        final boolean noTitle = dialog != null && dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        if (!noTitle) {
            if (dialog != null) {
                dialog.setTitle(R.string.cache_coordinates);
            }
            binding.done.setOnClickListener(view -> saveAndFinishDialog());
        } else {
            final Toolbar toolbar = binding.toolbarWrapper.toolbar;
            toolbar.setTitle(R.string.waypoint_calculated_coordinates_global);
            toolbar.inflateMenu(R.menu.menu_ok_cancel);
            toolbar.setOnMenuItemClickListener(item -> {
                if (item.getItemId() == R.id.menu_item_save) {
                    saveAndFinishDialog();
                } else {
                    dismiss();
                }
                return true;
            });
            binding.done.setVisibility(View.GONE);
        }

        binding.convertToPlain.setOnClickListener(v -> {
            final CoordinateInputData cid = createFromDialog();
            cid.setCalculatedCoordinate(null);
            CoordinatesInputDialog.show(this.requireActivity().getSupportFragmentManager(), cid);
            dismiss();
        });

        binding.generateRangeCoordinates.setOnClickListener(v -> generateRangeCoordinates());

        displayType.setSpinner(binding.ccGuidedFormat)
                .setValues(CollectionStream.of(CalculatedCoordinateType.values()).filter(t -> PLAIN != t).toList())
                .setDisplayMapperPure(CalculatedCoordinateType::toUserDisplayableString)
                .set(calcCoord.getType())
                .setChangeListener(t -> refreshType(t, false));

        varListAdapter = binding.variableList.getAdapter();
        varListAdapter.setDisplay(VariableListView.DisplayType.MINIMALISTIC, 2);
        varListAdapter.setVarChangeCallback((v, s) -> {
            varListAdapter.checkAddVisibleVariables(Collections.singletonList(v));
            updateView();
        });
        varListAdapter.setVariableList(varList);
        varListAdapter.setVisibleVariablesAndDependent(calcCoord.getNeededVars());

        binding.variablesTidyup.setOnClickListener(v -> varListAdapter.tidyUp(calcCoord.getNeededVars()));

        binding.notesText.setText(notes);

        binding.PlainLat.addTextChangedListener(ViewUtils.createSimpleWatcher(s -> {
            calcCoord.setLatitudePattern(s.toString());
            varListAdapter.checkAddVisibleVariables(calcCoord.getNeededVars());
            updateView();
        }));
        binding.PlainLat.setText(calcCoord.getLatitudePattern());

        binding.PlainLon.addTextChangedListener(ViewUtils.createSimpleWatcher(s -> {
            calcCoord.setLongitudePattern(s.toString());
            varListAdapter.checkAddVisibleVariables(calcCoord.getNeededVars());
            updateView();
        }));
        binding.PlainLon.setText(calcCoord.getLongitudePattern());

        binding.NonPlainFormat.setChangeListener(p -> {
            calcCoord.setLatitudePattern(p.first);
            calcCoord.setLongitudePattern(p.second);
            varListAdapter.checkAddVisibleVariables(calcCoord.getNeededVars());
            updateView();
        });

        binding.ccSwitchGuided.setOnCheckedChangeListener((v, c) -> {
            if (!c) {
                refreshType(PLAIN, false);
            } else {
                final CalculatedCoordinateType guessType = CalculatedCoordinateInputGuideView.guessType(calcCoord.getLatitudePattern(), calcCoord.getLongitudePattern());
                refreshType(guessType == null ? displayType.get() : guessType, false);
            }
        });

        binding.ccPaste.setOnClickListener(v -> {
            final String clip = ClipboardUtils.getText();
            final List<Pair<String, String>> patterns = FormulaUtils.scanForCoordinates(Collections.singleton(clip), null);
            if (patterns.isEmpty()) {
                ActivityMixin.showShortToast(this.getActivity(), R.string.variables_scanlisting_nopatternfound);
            } else {
                binding.PlainLat.setText(patterns.get(0).first);
                binding.PlainLon.setText(patterns.get(0).second);
            }
        });

        binding.ccPlainTools.setOnClickListener(v -> {
            final List<Integer> options = List.of(R.string.calccoord_remove_spaces, R.string.calccoord_replace_x_with_multiplication_symbol);
            final SimpleDialog.ItemSelectModel<Integer> model = new SimpleDialog.ItemSelectModel<>();
            model
                .setItems(options)
                .setDisplayMapper(TextParam::id)
                .setChoiceMode(SimpleItemListModel.ChoiceMode.SINGLE_PLAIN);

            SimpleDialog.of(this.getActivity()).setTitle(R.string.calccoord_plain_tools_title)
                    .selectSingle(model, (o) -> {
                        if (o == R.string.calccoord_remove_spaces) {
                            binding.PlainLat.setText(DegreeFormula.removeSpaces(ViewUtils.getEditableText(binding.PlainLat.getText())));
                            binding.PlainLon.setText(DegreeFormula.removeSpaces(ViewUtils.getEditableText(binding.PlainLon.getText())));
                        } else if (o == R.string.calccoord_replace_x_with_multiplication_symbol) {
                            binding.PlainLat.setText(DegreeFormula.replaceXWithMultiplicationSign(ViewUtils.getEditableText(binding.PlainLat.getText())));
                            binding.PlainLon.setText(DegreeFormula.replaceXWithMultiplicationSign(ViewUtils.getEditableText(binding.PlainLon.getText())));
                        }
                    });
        });

        //check if type from config is applicable
        if (calcCoord.getType() != PLAIN) {
            final CalculatedCoordinateType type = CalculatedCoordinateInputGuideView.guessType(calcCoord.getLatitudePattern(), calcCoord.getLongitudePattern());
            calcCoord.setType(type == null ? PLAIN : type);
        }

        refreshType(calcCoord.getType(), true);

        return binding.getRoot();
    }
Save the current state of the calculator such that it can be restored after screen rotation (or similar)
main/src/main/java/cgeo/geocaching/ui/dialog/CoordinatesCalculateGlobalDialog.java