Skip to content

Commit a01de6b

Browse files
Merge pull request #2904 from nextcloud/fix/note-share-search-view
fix: note share search view
2 parents 3a72a01 + 2b7d903 commit a01de6b

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;
@@ -223,7 +224,9 @@ private void setupSearchView(@Nullable SearchManager searchManager, ComponentNam
223224
binding.searchView.setIconifiedByDefault(false);
224225
binding.searchView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
225226
binding.searchView.setQueryHint(getResources().getString(R.string.note_share_activity_search_text));
226-
binding.searchView.setInputType(InputType.TYPE_NULL);
227+
binding.searchView.setInputType(InputType.TYPE_CLASS_TEXT);
228+
binding.searchView.setFocusable(true);
229+
binding.searchView.setFocusableInTouchMode(true);
227230

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

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

0 commit comments

Comments
 (0)