@Override
  public void onResume() {
    super.onResume();

    distance = KeypadMapperApplication.getInstance().getSettings().getHouseNumberDistance();

    geocodeController.onResume();
    address = mapper.getCurrentAddress();
    textHousenumber.setText(address.getNumber());
    inputNotes.setText(address.getNotes());
    updateLastHouseNumbers();
    mapper.addUndoListener(this);
    textHousenumber.clearFocus();

    View middleButton = root.findViewById(R.id.keysLandMiddle);
    if (KeypadMapperApplication.getInstance().getSettings().isLayoutOptimizationEnabled()) {
      root.findViewById(R.id.geoinfo_container).setVisibility(View.GONE);
      inputNotes.setVisibility(View.GONE);
      root.findViewById(R.id.keysRow1).setVisibility(View.GONE);
      if (middleButton != null) {
        middleButton.setVisibility(View.GONE);
        root.findViewById(R.id.delimiter1).setVisibility(View.GONE);
      }
    } else {
      root.findViewById(R.id.geoinfo_container).setVisibility(View.VISIBLE);
      inputNotes.setVisibility(View.VISIBLE);
      root.findViewById(R.id.keysRow1).setVisibility(View.VISIBLE);
      if (middleButton != null) {
        middleButton.setVisibility(View.VISIBLE);
        root.findViewById(R.id.delimiter1).setVisibility(View.VISIBLE);
      }
    }

    InputMethodManager imm =
        (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(inputNotes.getApplicationWindowToken(), 0);
  }
 @Override
 public void onPause() {
   mapper.removeUndoListener(this);
   geocodeController.onPause();
   super.onPause();
 }