From 5d513105dff9f453872be40f8bed2391396cf9c7 Mon Sep 17 00:00:00 2001 From: Nicolas Roard Date: Wed, 3 Aug 2011 15:35:34 -0700 Subject: Move inverted mode to Accessibility settings Add contrast settings bug:5111259 Change-Id: Ic95e1fbae94c01fc8560cbd326503244b9ab4988 --- .../preferences/AccessibilityPreferencesFragment.java | 13 ++++++++++++- src/com/android/browser/preferences/WebViewPreview.java | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'src/com/android/browser/preferences') diff --git a/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java b/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java index b7d06a1..312a61e 100644 --- a/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java +++ b/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java @@ -45,6 +45,9 @@ public class AccessibilityPreferencesFragment extends PreferenceFragment e = findPreference(PreferenceKeys.PREF_TEXT_ZOOM); e.setOnPreferenceChangeListener(this); updateTextZoomSummary(e, settings.getTextZoom()); + e = findPreference(PreferenceKeys.PREF_INVERTED_CONTRAST); + e.setOnPreferenceChangeListener(this); + updateInvertedContrastSummary(e, (int) (settings.getInvertedContrast() * 100)); } void updateMinFontSummary(Preference pref, int minFontSize) { @@ -56,6 +59,10 @@ public class AccessibilityPreferencesFragment extends PreferenceFragment pref.setSummary(mFormat.format(textZoom / 100.0)); } + void updateInvertedContrastSummary(Preference pref, int contrast) { + pref.setSummary(mFormat.format(contrast / 100.0)); + } + @Override public boolean onPreferenceChange(Preference pref, Object objValue) { if (getActivity() == null) { @@ -72,7 +79,11 @@ public class AccessibilityPreferencesFragment extends PreferenceFragment updateTextZoomSummary(pref, BrowserSettings .getAdjustedTextZoom((Integer) objValue)); } + if (PreferenceKeys.PREF_INVERTED_CONTRAST.equals(pref.getKey())) { + updateInvertedContrastSummary(pref, + (int) ((10 + (Integer) objValue) * 10)); + } return true; } -} \ No newline at end of file +} diff --git a/src/com/android/browser/preferences/WebViewPreview.java b/src/com/android/browser/preferences/WebViewPreview.java index 1886bed..27c4f00 100644 --- a/src/com/android/browser/preferences/WebViewPreview.java +++ b/src/com/android/browser/preferences/WebViewPreview.java @@ -17,6 +17,7 @@ package com.android.browser.preferences; import com.android.browser.BrowserSettings; +import com.android.browser.PreferenceKeys; import com.android.browser.R; import android.content.Context; @@ -68,6 +69,7 @@ public class WebViewPreview extends Preference implements OnSharedPreferenceChan BrowserSettings bs = BrowserSettings.getInstance(); ws.setMinimumFontSize(bs.getMinimumFontSize()); ws.setTextZoom(bs.getTextZoom()); + ws.setProperty(PreferenceKeys.PREF_INVERTED_CONTRAST, Float.toString(bs.getInvertedContrast())); mWebView.loadData(mHtml, "text/html", "utf-8"); } -- cgit v1.1