From 6fab8a126a6f5e71ec921d4d45f279fb16a8b7da Mon Sep 17 00:00:00 2001 From: Daniel Hammann Date: Mon, 10 Mar 2014 20:58:15 +0100 Subject: [PATCH] Reset cursor query when closing search view #386 Without focus the search result get erased. --- .../keychain/ui/KeyListPublicFragment.java | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 c2b21027c..92c6262b6 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 @@ -367,6 +367,16 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer // Execute this when searching mSearchView.setOnQueryTextListener(this); + //Erase search result without focus + mSearchView.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() { + @Override + public void onFocusChange(View v, boolean hasFocus) { + if (!hasFocus) { + mCurQuery = null; + getLoaderManager().restartLoader(0, null, KeyListPublicFragment.this); + } + } + }); super.onCreateOptionsMenu(menu, inflater); }