summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/values/strings.xml12
-rw-r--r--res/xml-sw600dp/lab_preferences.xml5
-rw-r--r--res/xml/accessibility_preferences.xml16
-rw-r--r--res/xml/lab_preferences.xml5
-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
8 files changed, 52 insertions, 17 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d9667bc..87e77fc 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -524,6 +524,14 @@
<string name="pref_force_userscalable">Force enable zoom</string>
<!-- Summary for whether or not to force-enable user scalablity (aka, zoom) [CHAR LIMIT=30] -->
<string name="pref_force_userscalable_summary">Whether or not to override a website\'s request to control zoom behavior</string>
+ <!-- Inverted screen category under accessibility settings [CHAR LIMIT=50] -->
+ <string name="pref_inverted_category">Inverted Screen Rendering</string>
+ <!-- Title for the inverted screen feature. This causes the screen to render with inverted colors (black becomes white and vice versa) [CHAR LIMIT=40] -->
+ <string name="pref_inverted">Inverted Rendering</string>
+ <!-- Summary for the inverted screen feature. [CHAR LIMIT=120] -->
+ <string name="pref_inverted_summary">Enable inverted rendering. Black will become white and vice versa.</string>
+ <!-- Title for the inverted screen contrast. Change the contrast value from 1.0 to 3.0. [CHAR LIMIT=30] -->
+ <string name="pref_inverted_contrast">Contrast</string>
<!-- Settings label -->
<string name="pref_default_zoom">Default zoom</string>
<!-- Settings default zoom options; appear in default zoom dialog box -->
@@ -654,10 +662,6 @@
<!-- Summary for the fullscreen lab feature [CHAR LIMIT=120] -->
<string name="pref_lab_fullscreen_summary">
Use fullscreen mode to hide the status bar.</string>
- <!-- Title for the inverted screen lab feature. This causes the screen to render with inverted colors (black becomes white and vice versa) [CHAR LIMIT=40] -->
- <string name="pref_lab_inverted">Inverted Rendering</string>
- <!-- Summary for the inverted screen lab feature. [CHAR LIMIT=120] -->
- <string name="pref_lab_inverted_summary">Checking this causes the browser to invert colors. Black will become white and vice versa.</string>
<!-- Title for bandwidth management preference [CHAR LIMIT=25] -->
<string name="pref_data_title">Bandwidth Management</string>
<!-- Title for search preloading [CHAR LIMIT=40] -->
diff --git a/res/xml-sw600dp/lab_preferences.xml b/res/xml-sw600dp/lab_preferences.xml
index 512c8c1..0edc919 100644
--- a/res/xml-sw600dp/lab_preferences.xml
+++ b/res/xml-sw600dp/lab_preferences.xml
@@ -26,9 +26,4 @@
android:defaultValue="false"
android:title="@string/pref_use_instant_search"
android:summary="@string/pref_use_instant_search_summary" />
- <CheckBoxPreference
- android:key="inverted"
- android:defaultValue="false"
- android:title="@string/pref_lab_inverted"
- android:summary="@string/pref_lab_inverted_summary" />
</PreferenceScreen>
diff --git a/res/xml/accessibility_preferences.xml b/res/xml/accessibility_preferences.xml
index a7124f4..db5a539 100644
--- a/res/xml/accessibility_preferences.xml
+++ b/res/xml/accessibility_preferences.xml
@@ -40,4 +40,20 @@
</PreferenceCategory>
+ <PreferenceCategory android:title="@string/pref_inverted_category">
+
+ <CheckBoxPreference
+ android:key="inverted"
+ android:defaultValue="false"
+ android:title="@string/pref_inverted"
+ android:summary="@string/pref_inverted_summary" />
+
+ <com.android.browser.preferences.FontSizePreference
+ android:key="inverted_contrast"
+ android:title="@string/pref_inverted_contrast"
+ android:defaultValue="0"
+ android:max="20" />
+
+ </PreferenceCategory>
+
</PreferenceScreen>
diff --git a/res/xml/lab_preferences.xml b/res/xml/lab_preferences.xml
index a3de6ca..3320cee 100644
--- a/res/xml/lab_preferences.xml
+++ b/res/xml/lab_preferences.xml
@@ -26,9 +26,4 @@
android:defaultValue="false"
android:title="@string/pref_lab_fullscreen"
android:summary="@string/pref_lab_fullscreen_summary" />
- <CheckBoxPreference
- android:key="inverted"
- android:defaultValue="false"
- android:title="@string/pref_lab_inverted"
- android:summary="@string/pref_lab_inverted_summary" />
</PreferenceScreen>
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");
}