From 35880e3bc7b482dcf44ebf6398eb0226064d9ad6 Mon Sep 17 00:00:00 2001 From: Tobias Zwick Date: Thu, 7 Jun 2018 22:30:04 +0200 Subject: [PATCH] fix #1093 --- .../streetcomplete/quests/housenumber/AddHousenumberForm.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/de/westnordost/streetcomplete/quests/housenumber/AddHousenumberForm.java b/app/src/main/java/de/westnordost/streetcomplete/quests/housenumber/AddHousenumberForm.java index 7fae4c2db3..7254bd7d79 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/quests/housenumber/AddHousenumberForm.java +++ b/app/src/main/java/de/westnordost/streetcomplete/quests/housenumber/AddHousenumberForm.java @@ -196,6 +196,8 @@ private void initKeyboardButton(View view) if(focus != null && focus instanceof EditText) { EditText input = (EditText) focus; + int start = input.getSelectionStart(); + int end = input.getSelectionEnd(); if ((input.getInputType() & InputType.TYPE_CLASS_NUMBER) != 0) { input.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); @@ -206,6 +208,8 @@ private void initKeyboardButton(View view) input.setKeyListener(DigitsKeyListener.getInstance("0123456789.,- /")); toggleKeyboardButton.setText("abc"); } + // for some reason, the cursor position gets lost first time the input type is set (#1093) + input.setSelection(start, end); InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(input, InputMethodManager.SHOW_IMPLICIT);