summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-06-16 17:44:29 -0700
committerJohn Reck <jreck@google.com>2011-06-17 10:42:55 -0700
commit7dc444b4c3b70a09a33c0892fb8677922bdf1ecc (patch)
tree46e04952dca7ea89e54f2aa3675361f76e0a7bf3 /src/com/android/browser/preferences/AccessibilityPreferencesFragment.java
parentf43990eed0a2b97f181c44fd03271f1844a8d133 (diff)
downloadpackages_apps_Browser-7dc444b4c3b70a09a33c0892fb8677922bdf1ecc.zip
packages_apps_Browser-7dc444b4c3b70a09a33c0892fb8677922bdf1ecc.tar.gz
packages_apps_Browser-7dc444b4c3b70a09a33c0892fb8677922bdf1ecc.tar.bz2
Accessibility tweaks
Min font size now shows pt value Text size replaced with text zoom Change-Id: Ic5906be094425bc5099a17571868c7a994a6cb86
Diffstat (limited to 'src/com/android/browser/preferences/AccessibilityPreferencesFragment.java')
-rw-r--r--src/com/android/browser/preferences/AccessibilityPreferencesFragment.java65
1 files changed, 30 insertions, 35 deletions
diff --git a/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java b/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java
index d083f43..b7d06a1 100644
--- a/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java
+++ b/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java
@@ -16,33 +16,44 @@
package com.android.browser.preferences;
-import com.android.browser.PreferenceKeys;
-import com.android.browser.R;
-
-import android.content.res.Resources;
+import android.content.Context;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
-import android.view.View;
+
+import com.android.browser.BrowserSettings;
+import com.android.browser.PreferenceKeys;
+import com.android.browser.R;
+
+import java.text.NumberFormat;
public class AccessibilityPreferencesFragment extends PreferenceFragment
implements Preference.OnPreferenceChangeListener {
+ NumberFormat mFormat;
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.accessibility_preferences);
+ BrowserSettings settings = BrowserSettings.getInstance();
+ mFormat = NumberFormat.getPercentInstance();
- Preference e = findPreference(PreferenceKeys.PREF_TEXT_SIZE);
+ Preference e = findPreference(PreferenceKeys.PREF_MIN_FONT_SIZE);
+ e.setOnPreferenceChangeListener(this);
+ updateMinFontSummary(e, settings.getMinimumFontSize());
+ e = findPreference(PreferenceKeys.PREF_TEXT_ZOOM);
e.setOnPreferenceChangeListener(this);
- e.setSummary(getVisualTextSizeName(
- getPreferenceScreen().getSharedPreferences()
- .getString(PreferenceKeys.PREF_TEXT_SIZE, null)) );
+ updateTextZoomSummary(e, settings.getTextZoom());
}
- @Override
- public void onViewCreated(View view, Bundle savedInstanceState) {
- super.onViewCreated(view, savedInstanceState);
+ void updateMinFontSummary(Preference pref, int minFontSize) {
+ Context c = getActivity();
+ pref.setSummary(c.getString(R.string.pref_min_font_size_value, minFontSize));
+ }
+
+ void updateTextZoomSummary(Preference pref, int textZoom) {
+ pref.setSummary(mFormat.format(textZoom / 100.0));
}
@Override
@@ -53,31 +64,15 @@ public class AccessibilityPreferencesFragment extends PreferenceFragment
return false;
}
- if (pref.getKey().equals(PreferenceKeys.PREF_TEXT_SIZE)) {
- pref.setSummary(getVisualTextSizeName((String) objValue));
- return true;
+ if (PreferenceKeys.PREF_MIN_FONT_SIZE.equals(pref.getKey())) {
+ updateMinFontSummary(pref, BrowserSettings
+ .getAdjustedMinimumFontSize((Integer) objValue));
}
- return false;
- }
-
- private CharSequence getVisualTextSizeName(String enumName) {
- Resources res = getActivity().getResources();
- CharSequence[] visualNames = res.getTextArray(R.array.pref_text_size_choices);
- CharSequence[] enumNames = res.getTextArray(R.array.pref_text_size_values);
-
- // Sanity check
- if (visualNames.length != enumNames.length) {
- return "";
- }
-
- int length = enumNames.length;
- for (int i = 0; i < length; i++) {
- if (enumNames[i].equals(enumName)) {
- return visualNames[i];
- }
+ if (PreferenceKeys.PREF_TEXT_ZOOM.equals(pref.getKey())) {
+ updateTextZoomSummary(pref, BrowserSettings
+ .getAdjustedTextZoom((Integer) objValue));
}
-
- return "";
+ return true;
}
} \ No newline at end of file