From 97baa0e52f1830c98f68de69e8d07e3c04527088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Sun, 26 Oct 2014 01:09:35 +0200 Subject: Keyboard tests --- .../keychain/ui/ImportKeysCloudFragment.java | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'OpenKeychain') diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysCloudFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysCloudFragment.java index 3db0628ab..03aba344a 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysCloudFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysCloudFragment.java @@ -50,7 +50,6 @@ public class ImportKeysCloudFragment extends Fragment { private View mSearchButton; private AutoCompleteTextView mQueryEditText; private View mConfigButton; - private ArrayAdapter mServerAdapter; /** * Creates new instance of this fragment @@ -136,11 +135,7 @@ public class ImportKeysCloudFragment extends Fragment { } else { // open keyboard mQueryEditText.requestFocus(); - InputMethodManager inputMethodManager = (InputMethodManager) - getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); - if (inputMethodManager != null) { - inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); - } + toggleKeyboard(true); } if (getArguments().getBoolean(ARG_DISABLE_QUERY_EDIT, false)) { @@ -159,10 +154,10 @@ public class ImportKeysCloudFragment extends Fragment { private void search(String query) { Preferences prefs = Preferences.getPreferences(getActivity()); mImportActivity.loadCallback(new ImportKeysListFragment.CloudLoaderState(query, prefs.getCloudSearchPrefs())); - hideKeyboard(); + toggleKeyboard(false); } - private void hideKeyboard() { + private void toggleKeyboard(boolean show) { if (getActivity() == null) { return; } @@ -171,10 +166,15 @@ public class ImportKeysCloudFragment extends Fragment { // check if no view has focus View v = getActivity().getCurrentFocus(); - if (v == null) + if (v == null) { return; + } - inputManager.hideSoftInputFromWindow(v.getWindowToken(), 0); + if (show) { + inputManager.showSoftInput(v, InputMethodManager.SHOW_IMPLICIT); + } else { + inputManager.hideSoftInputFromWindow(v.getWindowToken(), 0); + } } } -- cgit v1.2.3