From 506782b6890c2aa41adf0042d64c0f24e28975f1 Mon Sep 17 00:00:00 2001 From: Daniel Hammann Date: Tue, 11 Mar 2014 00:07:53 +0100 Subject: [PATCH] OnFocusChangeListener replaced with OnActionExpandListener For same behaviour like contacts app #386 #387 --- .../keychain/ui/KeyListPublicFragment.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java index 92c6262b6..707001de9 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java @@ -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; } });