Revised fix for #347

This commit is contained in:
Nikhil Peter Raj 2014-03-09 01:32:41 +05:30
parent b29c430959
commit 14b3807811

View File

@ -353,22 +353,12 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer
@Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
// Get the searchview
final MenuItem searchItem = menu.findItem(R.id.menu_key_list_public_search);
MenuItem searchItem = menu.findItem(R.id.menu_key_list_public_search);
mSearchView = (SearchView) MenuItemCompat.getActionView(searchItem);
// Execute this when searching
mSearchView.setOnQueryTextListener(this);
//Collapse the SearchView if it does not have focus
mSearchView.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
MenuItemCompat.collapseActionView(searchItem);
}
}
});
super.onCreateOptionsMenu(menu, inflater);
}