Skip to content

Commit c2d467e

Browse files
Merge pull request #2906 from nextcloud/backport/2904/stable-4.5
[stable-4.5] fix: note share search view
2 parents caaf635 + 234f5f0 commit c2d467e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

app/src/main/java/it/niedermann/owncloud/notes/share/NoteShareActivity.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import android.view.View;
2323
import android.view.ViewGroup;
2424
import android.view.inputmethod.EditorInfo;
25+
import android.view.inputmethod.InputMethodManager;
2526

2627
import androidx.activity.OnBackPressedCallback;
2728
import androidx.activity.result.ActivityResultLauncher;
@@ -222,7 +223,9 @@ private void setupSearchView(@Nullable SearchManager searchManager, ComponentNam
222223
binding.searchView.setIconifiedByDefault(false);
223224
binding.searchView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
224225
binding.searchView.setQueryHint(getResources().getString(R.string.note_share_activity_search_text));
225-
binding.searchView.setInputType(InputType.TYPE_NULL);
226+
binding.searchView.setInputType(InputType.TYPE_CLASS_TEXT);
227+
binding.searchView.setFocusable(true);
228+
binding.searchView.setFocusableInTouchMode(true);
226229

227230
View closeButton = binding.searchView.findViewById(androidx.appcompat.R.id.search_close_btn);
228231
closeButton.setOnClickListener(v -> {
@@ -284,6 +287,13 @@ public boolean onQueryTextChange(String newText) {
284287
}
285288
});
286289

290+
binding.searchView.setOnQueryTextFocusChangeListener((v, hasFocus) -> {
291+
if (hasFocus) {
292+
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
293+
imm.showSoftInput(binding.searchView.findFocus(), InputMethodManager.SHOW_IMPLICIT);
294+
}
295+
});
296+
287297
binding.searchView.setOnSuggestionListener(new SearchView.OnSuggestionListener() {
288298
@Override
289299
public boolean onSuggestionSelect(int position) {

0 commit comments

Comments
 (0)