X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=src%2Fcom%2Fhughes%2Fandroid%2Fdictionary%2FDictionaryActivity.java;h=89869b646e0dd4aa543288fe514cf68f9ffa0e62;hb=024aa6ab96c467bbf234826ebc57c065f1db48f6;hp=78c8a476b822cb0de1d69de411af4cef3a0d4512;hpb=66affc8fb8939878b1abdb7d15da1c5d60ccc0fe;p=Dictionary.git diff --git a/src/com/hughes/android/dictionary/DictionaryActivity.java b/src/com/hughes/android/dictionary/DictionaryActivity.java index 78c8a47..89869b6 100644 --- a/src/com/hughes/android/dictionary/DictionaryActivity.java +++ b/src/com/hughes/android/dictionary/DictionaryActivity.java @@ -247,8 +247,15 @@ public class DictionaryActivity extends ListActivity { } }).start(); - final String fontName = prefs.getString(getString(R.string.fontKey), "FreeSerif.ttf.jpg"); - if ("SYSTEM".equals(fontName)) { + + final int fontWorkAround = prefs.getInt(C.FONT_WORKAROUND, 1); + if (fontWorkAround == 0) { + Toast.makeText(this, getString(R.string.fontWorkaround), Toast.LENGTH_LONG).show(); + prefs.edit().putString(getString(R.string.fontKey), "SYSTEM").commit(); + } + prefs.edit().putInt(C.FONT_WORKAROUND, 0).commit(); + String fontName = prefs.getString(getString(R.string.fontKey), "FreeSerif.ttf.jpg"); + if (fontWorkAround == 0 || "SYSTEM".equals(fontName)) { typeface = Typeface.DEFAULT; } else { try { @@ -258,6 +265,9 @@ public class DictionaryActivity extends ListActivity { Toast.makeText(this, getString(R.string.fontFailure, e.getLocalizedMessage()), Toast.LENGTH_LONG).show(); } } +// if (!"SYSTEM".equals(fontName)) { +// throw new RuntimeException("Test force using system font: " + fontName); +// } if (typeface == null) { Log.w(LOG, "Unable to create typeface, using default."); typeface = Typeface.DEFAULT; @@ -267,7 +277,10 @@ public class DictionaryActivity extends ListActivity { fontSizeSp = Integer.parseInt(fontSize.trim()); } catch (NumberFormatException e) { fontSizeSp = 14; - } + } + // Things worked with loading the font. + prefs.edit().putInt(C.FONT_WORKAROUND, 1).commit(); + setContentView(R.layout.dictionary_activity); searchText = (EditText) findViewById(R.id.SearchText);