Hide keyboard on search submit

This commit is contained in:
M66B 2016-02-01 08:36:22 +01:00
parent 64b00b73b8
commit d9bf4682b6
1 changed files with 2 additions and 1 deletions

View File

@ -495,12 +495,13 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
// Search // Search
menuSearch = menu.findItem(R.id.menu_search); menuSearch = menu.findItem(R.id.menu_search);
SearchView searchView = (SearchView) MenuItemCompat.getActionView(menuSearch); final SearchView searchView = (SearchView) MenuItemCompat.getActionView(menuSearch);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override @Override
public boolean onQueryTextSubmit(String query) { public boolean onQueryTextSubmit(String query) {
if (adapter != null) if (adapter != null)
adapter.getFilter().filter(query); adapter.getFilter().filter(query);
searchView.clearFocus();
return true; return true;
} }