From 024aa6ab96c467bbf234826ebc57c065f1db48f6 Mon Sep 17 00:00:00 2001 From: Thad Hughes Date: Tue, 10 Apr 2012 15:49:10 -0700 Subject: [PATCH] Try to fix font issue. --- .classpath | 1 + AndroidManifest.xml | 4 ++-- res/raw-de/whats_new.html | 4 +--- res/raw/whats_new.html | 3 +-- res/values-de/strings.xml | 5 +++-- res/values/arrays.xml | 2 +- res/values/strings.xml | 5 +++-- src/com/hughes/android/dictionary/C.java | 2 ++ .../dictionary/DictionaryActivity.java | 19 ++++++++++++++++--- .../dictionary/DictionaryManagerActivity.java | 8 ++++---- 10 files changed, 34 insertions(+), 19 deletions(-) diff --git a/.classpath b/.classpath index 00ba4b7..117a6ee 100644 --- a/.classpath +++ b/.classpath @@ -5,5 +5,6 @@ + diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 6b49408..fce4847 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -4,8 +4,8 @@ package="com.hughes.android.dictionary" - android:versionCode="19" - android:versionName="3.2.1" + android:versionCode="20" + android:versionName="3.2.2" android:installLocation="auto"> diff --git a/res/raw-de/whats_new.html b/res/raw-de/whats_new.html index 23901b4..d74e30b 100644 --- a/res/raw-de/whats_new.html +++ b/res/raw-de/whats_new.html @@ -9,11 +9,9 @@ -Vielen Dank für die Aktualisierung auf QuickDic 3.2.1. +Vielen Dank für die Aktualisierung auf QuickDic 3.2.2.

Neue Funktionen:

    -
  • Wörterbücher filtern.
  • -
  • Übersetungen verbessert.
  • Fixed font bug on Sony Ericsson devices.
diff --git a/res/raw/whats_new.html b/res/raw/whats_new.html index 41bda33..abb19b1 100644 --- a/res/raw/whats_new.html +++ b/res/raw/whats_new.html @@ -9,10 +9,9 @@ -Thanks for updating to QuickDic 3.2.1. +Thanks for updating to QuickDic 3.2.2.

New features:

    -
  • Filter dictionary list.
  • Fixed font bug on Sony Ericsson devices.
diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 8f2f22d..f78b506 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -3,13 +3,14 @@ QuickDic - QuickDic 3.2.1 + QuickDic 3.2.2 Über QuickDic… Einstellungen… Hilfe Problem melden… + Detected font problem (common on Sony Ericsson devices), switching back to default font. @@ -21,7 +22,7 @@ Wörterbuch entfernen %1$s: %2$,d Wörter - 3.2.1_de_a + 3.2.2_de_a Suchtext diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 0e4d665..73b5acc 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -11,7 +11,7 @@ FreeSerif FreeSans System default - + themeLight diff --git a/res/values/strings.xml b/res/values/strings.xml index d7949db..d6b5977 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -3,13 +3,14 @@ QuickDic - QuickDic 3.2.1 + QuickDic 3.2.2 About QuickDic… Preferences… Help Report issue… + Detected font problem (common on Sony Ericsson devices), switching back to default font. @@ -24,7 +25,7 @@ Local only - 3.2.1_en_a + 3.2.2_en_e Search Text diff --git a/src/com/hughes/android/dictionary/C.java b/src/com/hughes/android/dictionary/C.java index c8511da..452c98b 100644 --- a/src/com/hughes/android/dictionary/C.java +++ b/src/com/hughes/android/dictionary/C.java @@ -26,6 +26,8 @@ public class C { public static final String THANKS_FOR_UPDATING_VERSION = "thanksForUpdatingVersion"; + public static final String FONT_WORKAROUND = "fontWorkaround"; + enum Theme { DEFAULT(R.style.Theme_Default, R.style.Theme_Default_TokenRow_Fg, 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); diff --git a/src/com/hughes/android/dictionary/DictionaryManagerActivity.java b/src/com/hughes/android/dictionary/DictionaryManagerActivity.java index dab77f5..f136dbd 100644 --- a/src/com/hughes/android/dictionary/DictionaryManagerActivity.java +++ b/src/com/hughes/android/dictionary/DictionaryManagerActivity.java @@ -136,19 +136,19 @@ public class DictionaryManagerActivity extends ListActivity { builder.setCancelable(false); final WebView webView = new WebView(getApplicationContext()); webView.loadData(StringUtil.readToString(getResources().openRawResource(R.raw.whats_new)), "text/html", "utf-8"); - builder.setView(webView); builder.setNegativeButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); - final AlertDialog alert = builder.create(); WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(); - layoutParams.copyFrom(alert.getWindow().getAttributes()); layoutParams.width = WindowManager.LayoutParams.FILL_PARENT; layoutParams.height = WindowManager.LayoutParams.FILL_PARENT; + webView.setLayoutParams(layoutParams); + builder.setView(webView); + final AlertDialog alert = builder.create(); + alert.getWindow().setLayout(WindowManager.LayoutParams.FILL_PARENT, WindowManager.LayoutParams.FILL_PARENT); alert.show(); - alert.getWindow().setAttributes(layoutParams); prefs.edit().putString(C.THANKS_FOR_UPDATING_VERSION, thanksForUpdatingLatestVersion).commit(); } } -- 2.43.0