]> gitweb.fperrin.net Git - Dictionary.git/blobdiff - src/com/hughes/android/dictionary/DictionaryActivity.java
Simplify: weight can be specified directly.
[Dictionary.git] / src / com / hughes / android / dictionary / DictionaryActivity.java
index d6463609e4bc78f0c9414c0e11d2711c463ee688..e876f0ceff330dba8e53c0f9d3632bb51ecccde3 100644 (file)
@@ -408,6 +408,9 @@ public class DictionaryActivity extends ActionBarActivity {
        } else if ("MONOSPACE".equals(fontName)) {
             typeface = Typeface.MONOSPACE;
         } else {
+            if ("FreeSerif.ttf.jpg".equals(fontName)) {
+                fontName = "FreeSerif.otf.jpg";
+            }
             try {
                 typeface = Typeface.createFromAsset(getAssets(), fontName);
             } catch (Exception e) {
@@ -507,8 +510,7 @@ public class DictionaryActivity extends ActionBarActivity {
         searchView.setQueryHint(getString(R.string.searchText));
         searchView.setSubmitButtonEnabled(false);
         LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0,
-                FrameLayout.LayoutParams.WRAP_CONTENT);
-        lp.weight = 1;
+                FrameLayout.LayoutParams.WRAP_CONTENT, 1);
         searchView.setLayoutParams(lp);
         searchView.setImeOptions(
                 EditorInfo.IME_ACTION_SEARCH |
@@ -1097,6 +1099,11 @@ public class DictionaryActivity extends ActionBarActivity {
         searchView.setQuery(text, false);
         moveCursorToRight();
         searchView.setOnQueryTextListener(onQueryTextListener);
+
+        // Hide search icon once text is entered
+        searchView.setIconifiedByDefault(text.length() > 0);
+        searchView.setIconified(false);
+
         if (triggerSearch) {
             onQueryTextListener.onQueryTextChange(text);
         }
@@ -1572,6 +1579,11 @@ public class DictionaryActivity extends ActionBarActivity {
             Log.d(LOG, "searchText changed during shutdown, doing nothing.");
             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;