From 75f77f60aafab938b881811ee982679ca28a377f Mon Sep 17 00:00:00 2001 From: PavelRatushnyi Date: Tue, 7 Nov 2017 20:25:06 +0200 Subject: [PATCH] Switch to previous input --- .../plus/mapmarkers/CoordinateInputDialogFragment.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java index e0bcefd818..7bb5a2371c 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java @@ -296,6 +296,8 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm str = str.substring(0, str.length() - 1); focusedEditText.setText(str); focusedEditText.setSelection(str.length()); + } else { + switchToPreviousInput(focusedEditText.getId()); } break; case SWITCH_TO_NEXT_INPUT_BUTTON_POSITION: @@ -657,6 +659,14 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm } } + private void switchToPreviousInput(int id) { + if (id == R.id.name_edit_text) { + ((OsmandTextFieldBoxes) mainView.findViewById(R.id.longitude_box)).select(); + } else if (id == R.id.longitude_edit_text) { + ((OsmandTextFieldBoxes) mainView.findViewById(R.id.latitude_box)).select(); + } + } + private void addMapMarker() { final String latitude = ((EditText) mainView.findViewById(R.id.latitude_edit_text)).getText().toString(); final String longitude = ((EditText) mainView.findViewById(R.id.longitude_edit_text)).getText().toString();