Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,7 @@ public void afterTextChanged(final Editable s) {
}
};
searchEditText.addTextChangedListener(textWatcher);

searchEditText.setOnEditorActionListener(
(final TextView v, final int actionId, final KeyEvent event) -> {
if (DEBUG) {
Expand All @@ -630,11 +631,15 @@ public void afterTextChanged(final Editable s) {
}
if (actionId == EditorInfo.IME_ACTION_PREVIOUS) {
hideKeyboardSearch();
} else if (event != null
&& (event.getKeyCode() == KeyEvent.KEYCODE_ENTER
|| event.getAction() == EditorInfo.IME_ACTION_SEARCH)) {
return true;
} else if (actionId == EditorInfo.IME_ACTION_SEARCH
|| (event != null
&& event.getKeyCode() == KeyEvent.KEYCODE_ENTER
&& event.getAction() == KeyEvent.ACTION_UP)) {
searchEditText.setText(getSearchEditString().trim());
search(getSearchEditString(), new String[0], "");
// Close the IME / drop focus so the keyboard overlay disappears on Firestick.
hideKeyboardSearch();
return true;
}
return false;
Expand Down Expand Up @@ -692,6 +697,12 @@ private void hideKeyboardSearch() {
}

KeyboardUtil.hideKeyboard(activity, searchEditText);

// Remove focus from the search field so the IME overlay doesn't pop back up
// (important on Firestick / TV where the IME is a separate focused window).
if (searchEditText != null) {
searchEditText.clearFocus();
}
}

private void showDeleteSuggestionDialog(final SuggestionItem item) {
Expand Down
Loading