Skip to content
Merged
Show file tree
Hide file tree
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 @@ -4,7 +4,6 @@
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.SearchView;
import android.util.AttributeSet;
import android.view.View;
import androidx.fragment.app.FragmentManager;

public class SearchPreferenceActionView extends SearchView {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageView;
Expand Down Expand Up @@ -95,6 +96,13 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
viewHolder.recyclerView.setAdapter(adapter);

viewHolder.searchView.addTextChangedListener(textWatcher);
viewHolder.searchView.setOnEditorActionListener((v, actionId, event) -> {
if (actionId == EditorInfo.IME_ACTION_DONE) {
hideKeyboard();
return true;
}
return false;
});

if (!searchConfiguration.isSearchBarEnabled()) {
viewHolder.cardView.setVisibility(View.GONE);
Expand Down Expand Up @@ -202,6 +210,7 @@ private void hideKeyboard() {
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
if (view != null && imm != null) {
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
view.clearFocus();
}
}

Expand Down