diff options
| author | Charlie Root <root@dangofactory.local> | 2026-11-02 08:30:47 +0900 |
|---|---|---|
| committer | Charlie Root <root@dangofactory.local> | 2026-11-02 08:30:47 +0900 |
| commit | 35933af22c4e52e0d5406ff8b1ddcd7def4169b7 (patch) | |
| tree | f430d87bf2235983f9fdc3bf72b252020ab1964c /android | |
| parent | 3ad3eda1109fedf50b3ed848ee4b7dc3adb4ec5a (diff) | |
| download | organicmaps-dpad-master.tar.gz organicmaps-dpad-master.zip | |
DPAD: クリア while the IME is composing clears the query, and a closed sheet really closesHEADold-master-35933afmaster
- BACK/CLEAR/ESC while the box is a live editor now clear the text, hide the keyboard and
drop the editor state instead of closing the page. The previous check keyed off
getText().length(), which is 0 while the IME is still composing - that is why the page
closed before 確定 and not after it (the user's own reproduction).
- forceCloseSearchFragment() now sets the search sheet to STATE_HIDDEN: disabling the page
left the sheet drawn, so a closed search page could still be seen underneath the map or
the next sheet.
Verified: keyboard up + "あ" -> BACK = empty field, keyboard gone, page open; BACK again =
page closed, plain map, nothing behind.
Diffstat (limited to 'android')
| -rw-r--r-- | android/app/src/main/java/app/organicmaps/MwmActivity.java | 32 | ||||
| -rw-r--r-- | android/app/src/main/java/app/organicmaps/widget/SearchEditText.java | 20 |
2 files changed, 45 insertions, 7 deletions
diff --git a/android/app/src/main/java/app/organicmaps/MwmActivity.java b/android/app/src/main/java/app/organicmaps/MwmActivity.java index 0d09317150..a0b69972d9 100644 --- a/android/app/src/main/java/app/organicmaps/MwmActivity.java +++ b/android/app/src/main/java/app/organicmaps/MwmActivity.java @@ -403,6 +403,21 @@ public class MwmActivity extends BaseMwmFragmentActivity if (mSearchPageViewModel == null) return; mSearchPageViewModel.setSearchEnabled(false, null); + // 701KC: and put the sheet itself away. The ViewModel only disables the page; the sheet is a + // BottomSheet of THIS layout and stayed where it was, so a closed search page could still be + // seen underneath the map / the next sheet ("検索欄が後ろに回る", measured). + final View page = findViewById(R.id.search_page_container); + if (page != null) + { + try + { + BottomSheetBehavior.from(page).setState(BottomSheetBehavior.STATE_HIDDEN); + } + catch (IllegalArgumentException notASheet) + { + UiUtils.hide(page); + } + } } private void showBookmarks() @@ -2850,6 +2865,23 @@ public class MwmActivity extends BaseMwmFragmentActivity if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP && event.getRepeatCount() == 0 && isSearchPageShowing()) { + // 701KC: while the IME is up, クリア / BACK belongs to the TEXT, not to the page. The handset's + // clear key sends BACK, and the IME forwards it, so the page closed (and jumped back to the + // map or to the routing sheet behind it) in the middle of a query - measured complaint + // ("IMEの文字をクリアで消そうとするとmapのほうにとんでもどる"). First press: clear the query and + // put the keyboard away. A second press, with no keyboard up, does what it always did. + if (isImeVisible()) + { + for (EditText field : searchFields()) + { + if (!field.isShown() || !field.hasFocus()) + continue; + if (field.getText() != null && field.getText().length() > 0) + field.setText(""); + app.organicmaps.util.InputUtils.hideKeyboard(field); + return true; + } + } // 701KC: クリア / BACK while a query is typed must clear the text, not throw the page away. // Closing on the first press lost what the user was in the middle of typing (measured // complaint: "文字を打っている状態でもクリアを押すと閉じてしまう"). The page closes only once diff --git a/android/app/src/main/java/app/organicmaps/widget/SearchEditText.java b/android/app/src/main/java/app/organicmaps/widget/SearchEditText.java index 23440529ad..be84e3d205 100644 --- a/android/app/src/main/java/app/organicmaps/widget/SearchEditText.java +++ b/android/app/src/main/java/app/organicmaps/widget/SearchEditText.java @@ -82,15 +82,21 @@ public class SearchEditText extends TextInputEditText @Override public boolean onKeyPreIme(int keyCode, @NonNull KeyEvent event) { - // 701KC: while typing, BACK / クリア clears the text first and keeps the page. Closing on the - // first press threw away the query the user was in the middle of - // ("文字を打っている状態でもクリアを押すと閉じてしまう"); the page only closes once the box is empty. - if (event.getAction() == KeyEvent.ACTION_UP && event.getRepeatCount() == 0 + // 701KC: while this box is a live editor, BACK / クリア belongs to the TEXT, not to the page. + // The handset's clear key sends BACK and the IME forwards it, so the page closed underneath the + // user in the middle of a query ("IMEの文字をクリアで消そうとするとmapのほうにとんでもどる"). + // Note the composing text is NOT in getText() yet - that is why the "clear if non-empty" check + // misfired while the conversion was still unconfirmed, and why pressing 確定 first made the + // problem disappear. + if (event.getAction() == KeyEvent.ACTION_UP && event.getRepeatCount() == 0 && mImeAllowed && (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_CLEAR - || keyCode == KeyEvent.KEYCODE_ESCAPE) - && getText() != null && getText().length() > 0) + || keyCode == KeyEvent.KEYCODE_ESCAPE)) { - setText(""); + if (getText() != null && getText().length() > 0) + setText(""); + app.organicmaps.util.InputUtils.hideKeyboard(this); + // Stop being an editor: the next BACK is a page-level BACK again. + setImeAllowed(false); return true; } if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP |
