diff options
author | John Reck <jreck@google.com> | 2011-10-21 18:31:44 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2011-10-21 18:31:44 -0700 |
commit | 600928560852c7b9ffffbfc91ee9fe1016465329 (patch) | |
tree | dd8d309c512d2d25f1783f84166e6d3ca8e136e3 | |
parent | 59bf8725cfa019effc19b8fdcdeb117a7f710755 (diff) | |
download | packages_apps_browser-600928560852c7b9ffffbfc91ee9fe1016465329.zip packages_apps_browser-600928560852c7b9ffffbfc91ee9fe1016465329.tar.gz packages_apps_browser-600928560852c7b9ffffbfc91ee9fe1016465329.tar.bz2 |
Use UTF-8 for font size preview
Bug: 5489018
Apparantly ASCII isn't good enough
Change-Id: I9402c7c3e1ceedc26822469b652166885a40d6e3
-rw-r--r-- | src/com/android/browser/preferences/AccessibilityPreferencesFragment.java | 23 | ||||
-rw-r--r-- | src/com/android/browser/preferences/FontSizePreview.java | 5 |
2 files changed, 25 insertions, 3 deletions
diff --git a/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java b/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java index c07c184..364d337 100644 --- a/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java +++ b/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java @@ -20,6 +20,7 @@ import android.content.Context; import android.os.Bundle; import android.preference.Preference; import android.preference.PreferenceFragment; +import android.webkit.WebView; import com.android.browser.BrowserSettings; import com.android.browser.PreferenceKeys; @@ -31,10 +32,13 @@ public class AccessibilityPreferencesFragment extends PreferenceFragment implements Preference.OnPreferenceChangeListener { NumberFormat mFormat; + // Used to pause/resume timers, which are required for WebViewPreview + WebView mControlWebView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + mControlWebView = new WebView(getActivity()); addPreferencesFromResource(R.xml.accessibility_preferences); BrowserSettings settings = BrowserSettings.getInstance(); mFormat = NumberFormat.getPercentInstance(); @@ -53,6 +57,25 @@ public class AccessibilityPreferencesFragment extends PreferenceFragment updateInvertedContrastSummary(e, (int) (settings.getInvertedContrast() * 100)); } + @Override + public void onResume() { + super.onResume(); + mControlWebView.resumeTimers(); + } + + @Override + public void onPause() { + super.onPause(); + mControlWebView.pauseTimers(); + } + + @Override + public void onDestroy() { + super.onDestroy(); + mControlWebView.destroy(); + mControlWebView = null; + } + void updateMinFontSummary(Preference pref, int minFontSize) { Context c = getActivity(); pref.setSummary(c.getString(R.string.pref_min_font_size_value, minFontSize)); diff --git a/src/com/android/browser/preferences/FontSizePreview.java b/src/com/android/browser/preferences/FontSizePreview.java index 7311e80..91ecb00 100644 --- a/src/com/android/browser/preferences/FontSizePreview.java +++ b/src/com/android/browser/preferences/FontSizePreview.java @@ -25,11 +25,10 @@ import android.webkit.WebView; import com.android.browser.BrowserSettings; import com.android.browser.R; -import com.android.browser.WebViewProperties; public class FontSizePreview extends WebViewPreview { - static final String HTML_FORMAT = "<html><head><style type=\"text/css\">p { margin: 2px auto;}</style><body><p style=\"font-size: 4pt\">%s</p><p style=\"font-size: 8pt\">%s</p><p style=\"font-size: 10pt\">%s</p><p style=\"font-size: 14pt\">%s</p><p style=\"font-size: 18pt\">%s</p></body></html>"; + static final String HTML_FORMAT = "<!DOCTYPE html><html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><style type=\"text/css\">p { margin: 2px auto;}</style><body><p style=\"font-size: 4pt\">%s</p><p style=\"font-size: 8pt\">%s</p><p style=\"font-size: 10pt\">%s</p><p style=\"font-size: 14pt\">%s</p><p style=\"font-size: 18pt\">%s</p></body></html>"; String mHtml; @@ -62,7 +61,7 @@ public class FontSizePreview extends WebViewPreview { BrowserSettings bs = BrowserSettings.getInstance(); ws.setMinimumFontSize(bs.getMinimumFontSize()); ws.setTextZoom(bs.getTextZoom()); - mWebView.loadData(mHtml, "text/html", "utf-8"); + mWebView.loadDataWithBaseURL(null, mHtml, "text/html", "utf-8", null); } @Override |