From: Reimar Döffinger Date: Sat, 2 Apr 2016 14:02:52 +0000 (+0200) Subject: Always hide search icon. X-Git-Url: http://gitweb.fperrin.net/?p=Dictionary.git;a=commitdiff_plain;h=741d05c759511f08dcce81642d3dbe17f459197c Always hide search icon. Dynamically hiding it via setIconifiedByDefault causes a focus switch which breaks the T9 keyboard on e.g. GT-S6102. Not reproducible on emulator, so probably typical Samsung software quality, but this seems a reasonable enough change. --- diff --git a/src/com/hughes/android/dictionary/DictionaryActivity.java b/src/com/hughes/android/dictionary/DictionaryActivity.java index 33e3466..6f7eeb0 100644 --- a/src/com/hughes/android/dictionary/DictionaryActivity.java +++ b/src/com/hughes/android/dictionary/DictionaryActivity.java @@ -507,9 +507,12 @@ public class DictionaryActivity extends ActionBarActivity { customSearchView.addView(languageButton, lpb); searchView = new SearchView(getSupportActionBar().getThemedContext()); - searchView.setIconifiedByDefault(false); - // searchView.setIconified(false); // puts the magnifying glass in the - // wrong place. + + // Get rid of search icon, it takes up too much space. + // There is still text saying "search" in the search field. + searchView.setIconifiedByDefault(true); + searchView.setIconified(false); + searchView.setQueryHint(getString(R.string.searchText)); searchView.setSubmitButtonEnabled(false); searchView.setInputType(InputType.TYPE_CLASS_TEXT); @@ -1144,10 +1147,6 @@ public class DictionaryActivity extends ActionBarActivity { moveCursorToRight(); searchView.setOnQueryTextListener(onQueryTextListener); - // Hide search icon once text is entered - searchView.setIconifiedByDefault(text.length() > 0); - searchView.setIconified(false); - if (triggerSearch) { onSearchTextChange(text); } @@ -1631,10 +1630,6 @@ public class DictionaryActivity extends ActionBarActivity { return; } - // Hide search icon once text is entered - searchView.setIconifiedByDefault(text.length() > 0); - searchView.setIconified(false); - // if (!searchView.hasFocus()) { // Log.d(LOG, "searchText changed without focus, doing nothing."); // return;