summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorNicolas Roard <nicolasroard@google.com>2011-08-03 15:35:34 -0700
committerNicolas Roard <nicolasroard@google.com>2011-08-03 17:16:45 -0700
commit5d513105dff9f453872be40f8bed2391396cf9c7 (patch)
treeb05ba91367438b07644dc4d136aa6c54bce5c4a8 /src/com
parent7cff891f31311139e215e3948198843bcafd6137 (diff)
downloadpackages_apps_Browser-5d513105dff9f453872be40f8bed2391396cf9c7.zip
packages_apps_Browser-5d513105dff9f453872be40f8bed2391396cf9c7.tar.gz
packages_apps_Browser-5d513105dff9f453872be40f8bed2391396cf9c7.tar.bz2
Move inverted mode to Accessibility settings
Add contrast settings bug:5111259 Change-Id: Ic95e1fbae94c01fc8560cbd326503244b9ab4988
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/browser/BrowserSettings.java13
-rw-r--r--src/com/android/browser/PreferenceKeys.java3
-rw-r--r--src/com/android/browser/preferences/AccessibilityPreferencesFragment.java13
-rw-r--r--src/com/android/browser/preferences/WebViewPreview.java2
4 files changed, 28 insertions, 3 deletions
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index 35393ac..11972ee 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -250,8 +250,11 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
settings.setUserAgentString(USER_AGENTS[getUserAgent()]);
}
- settings.setProperty("gfxInvertedScreen",
+ settings.setProperty(PREF_INVERTED,
useInvertedRendering() ? "true" : "false");
+
+ settings.setProperty(PREF_INVERTED_CONTRAST,
+ Float.toString(getInvertedContrast()));
}
/**
@@ -735,6 +738,14 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
return mPrefs.getBoolean(PREF_INVERTED, false);
}
+ public float getInvertedContrast() {
+ return 1 + (mPrefs.getInt(PREF_INVERTED_CONTRAST, 0) / 10f);
+ }
+
+ public void setInvertedContrast(int contrast) {
+ mPrefs.edit().putInt(PREF_INVERTED_CONTRAST, contrast).apply();
+ }
+
// -----------------------------
// getter/setters for privacy_security_preferences.xml
// -----------------------------
diff --git a/src/com/android/browser/PreferenceKeys.java b/src/com/android/browser/PreferenceKeys.java
index 65218e5..1bfe389 100644
--- a/src/com/android/browser/PreferenceKeys.java
+++ b/src/com/android/browser/PreferenceKeys.java
@@ -28,6 +28,8 @@ public interface PreferenceKeys {
static final String PREF_TEXT_SIZE = "text_size";
static final String PREF_TEXT_ZOOM = "text_zoom";
static final String PREF_FORCE_USERSCALABLE = "force_userscalable";
+ static final String PREF_INVERTED = "inverted";
+ static final String PREF_INVERTED_CONTRAST = "inverted_contrast";
// ----------------------
// Keys for advanced_preferences.xml
@@ -79,7 +81,6 @@ public interface PreferenceKeys {
static final String PREF_ENABLE_QUICK_CONTROLS = "enable_quick_controls";
static final String PREF_USE_INSTANT_SEARCH = "use_instant_search";
static final String PREF_FULLSCREEN = "fullscreen";
- static final String PREF_INVERTED = "inverted";
// ----------------------
// Keys for privacy_security_preferences.xml
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");
}