OnFocusChangeListener replaced with OnActionExpandListener

For same behaviour like contacts app #386 #387
This commit is contained in:
Daniel Hammann 2014-03-11 00:07:53 +01:00
parent 6fab8a126a
commit 506782b689

View File

@ -368,13 +368,17 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer
mSearchView.setOnQueryTextListener(this); mSearchView.setOnQueryTextListener(this);
//Erase search result without focus //Erase search result without focus
mSearchView.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() { MenuItemCompat.setOnActionExpandListener(searchItem, new MenuItemCompat.OnActionExpandListener() {
@Override @Override
public void onFocusChange(View v, boolean hasFocus) { public boolean onMenuItemActionExpand(MenuItem item) {
if (!hasFocus) { return true;
}
@Override
public boolean onMenuItemActionCollapse(MenuItem item) {
mCurQuery = null; mCurQuery = null;
getLoaderManager().restartLoader(0, null, KeyListPublicFragment.this); getLoaderManager().restartLoader(0, null, KeyListPublicFragment.this);
} return true;
} }
}); });