X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=src%2Fcom%2Fhughes%2Fandroid%2Fdictionary%2FDictionaryActivity.java;h=c8d99e4f60328e4b440b1c9d280b08b9828b91b7;hb=5f665bc8b167e306d5031a402ecadd4a3a54f64b;hp=bd45672730ce08c79e90f0ac083c3f2e1218e574;hpb=71e3edc548080b5c6abcd043652035397c6a41d8;p=Dictionary.git diff --git a/src/com/hughes/android/dictionary/DictionaryActivity.java b/src/com/hughes/android/dictionary/DictionaryActivity.java index bd45672..c8d99e4 100644 --- a/src/com/hughes/android/dictionary/DictionaryActivity.java +++ b/src/com/hughes/android/dictionary/DictionaryActivity.java @@ -638,6 +638,13 @@ public class DictionaryActivity extends ActionBarActivity { } } + private void hideKeyboard() { + Log.d(LOG, "Hide soft keyboard."); + searchView.clearFocus(); + InputMethodManager manager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); + manager.hideSoftInputFromWindow(searchView.getWindowToken(), 0); + } + void updateLangButton() { final LanguageResources languageResources = DictionaryApplication.isoCodeToResources.get(index.shortName); @@ -1006,7 +1013,7 @@ public class DictionaryActivity extends ActionBarActivity { getListView().requestFocus(); // Visual indication that a new keystroke will clear the search text. - // Doesn't seem to work unless earchText has focus. + // Doesn't seem to work unless searchText has focus. // searchView.selectAll(); } @@ -1109,6 +1116,9 @@ public class DictionaryActivity extends ActionBarActivity { searchView.setIconifiedByDefault(text.length() > 0); searchView.setIconified(false); + // We don't want to show virtual keyboard when we're changing searchView text programatically: + hideKeyboard(); + if (triggerSearch) { onQueryTextListener.onQueryTextChange(text); }