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
1 changed files with 10 additions and 6 deletions

View File

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