Replace search query without searching on suggestion panel long click

This commit is contained in:
Stypox 2020-07-05 00:44:40 +02:00
parent 20e828be51
commit 13a0d1de70
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
1 changed files with 10 additions and 7 deletions

View File

@ -704,10 +704,6 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
return false; return false;
} }
public void giveSearchEditTextFocus() {
showKeyboardSearch();
}
private void initSuggestionObserver() { private void initSuggestionObserver() {
if (DEBUG) { if (DEBUG) {
Log.d(TAG, "initSuggestionObserver() called"); Log.d(TAG, "initSuggestionObserver() called");
@ -1000,7 +996,9 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
} }
private void handleSearchSuggestion() { private void handleSearchSuggestion() {
if (!TextUtils.isEmpty(searchSuggestion)) { if (TextUtils.isEmpty(searchSuggestion)) {
correctSuggestion.setVisibility(View.GONE);
} else {
final String helperText = getString(isCorrectedSearch final String helperText = getString(isCorrectedSearch
? R.string.search_showing_result_for ? R.string.search_showing_result_for
: R.string.did_you_mean); : R.string.did_you_mean);
@ -1013,9 +1011,14 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
searchEditText.setText(searchSuggestion); searchEditText.setText(searchSuggestion);
}); });
correctSuggestion.setOnLongClickListener(v -> {
searchEditText.setText(searchSuggestion);
searchEditText.setSelection(searchSuggestion.length());
showKeyboardSearch();
return true;
});
correctSuggestion.setVisibility(View.VISIBLE); correctSuggestion.setVisibility(View.VISIBLE);
} else {
correctSuggestion.setVisibility(View.GONE);
} }
} }