]> gitweb.fperrin.net Git - Dictionary.git/blobdiff - src/com/hughes/android/dictionary/DictionaryActivity.java
Fix selecting FreeSerif in settings.
[Dictionary.git] / src / com / hughes / android / dictionary / DictionaryActivity.java
index 2a37b6e369f249d9694ee407d5ab2ac08e81229f..db7e8aa7fae78e860628bba64108572d4f33557e 100644 (file)
@@ -204,13 +204,6 @@ public class DictionaryActivity extends ActionBarActivity {
         outState.putString(C.SEARCH_TOKEN, searchView.getQuery().toString());
     }
 
-    @Override
-    protected void onRestoreInstanceState(final Bundle savedInstanceState) {
-        super.onRestoreInstanceState(savedInstanceState);
-        Log.d(LOG, "onRestoreInstanceState: " + savedInstanceState.getString(C.SEARCH_TOKEN));
-        onCreate(savedInstanceState);
-    }
-
     @Override
     public void onCreate(Bundle savedInstanceState) {
         // This needs to be before super.onCreate, otherwise ActionbarSherlock
@@ -405,7 +398,7 @@ public class DictionaryActivity extends ActionBarActivity {
             }
         }).start();
 
-        String fontName = prefs.getString(getString(R.string.fontKey), "FreeSerif.ttf.jpg");
+        String fontName = prefs.getString(getString(R.string.fontKey), "FreeSerif.otf.jpg");
         if ("SYSTEM".equals(fontName)) {
             typeface = Typeface.DEFAULT;
        } else if ("SERIF".equals(fontName)) {
@@ -415,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) {
@@ -478,7 +474,7 @@ public class DictionaryActivity extends ActionBarActivity {
         final int width = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 300,
                 getResources().getDisplayMetrics());
         final LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
-                width, ViewGroup.LayoutParams.WRAP_CONTENT);
+                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
         customSearchView.setLayoutParams(layoutParams);
 
         listView.setOnItemClickListener(new OnItemClickListener() {