Switch to previous input

This commit is contained in:
PavelRatushnyi 2017-11-07 20:25:06 +02:00
parent 8285969ca9
commit 75f77f60aa

View file

@ -296,6 +296,8 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
str = str.substring(0, str.length() - 1); str = str.substring(0, str.length() - 1);
focusedEditText.setText(str); focusedEditText.setText(str);
focusedEditText.setSelection(str.length()); focusedEditText.setSelection(str.length());
} else {
switchToPreviousInput(focusedEditText.getId());
} }
break; break;
case SWITCH_TO_NEXT_INPUT_BUTTON_POSITION: 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() { private void addMapMarker() {
final String latitude = ((EditText) mainView.findViewById(R.id.latitude_edit_text)).getText().toString(); 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(); final String longitude = ((EditText) mainView.findViewById(R.id.longitude_edit_text)).getText().toString();