summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-09-14 15:00:15 -0700
committerJohn Reck <jreck@google.com>2011-09-14 15:02:02 -0700
commit5ba3c76b201c4448de4b520f2aee2e7d99fc712d (patch)
tree59024d59cb86d917e35145777dcf37323af63fb3 /src
parentef4a243155bec06dfa88039e3b76f5709f014993 (diff)
downloadpackages_apps_Browser-5ba3c76b201c4448de4b520f2aee2e7d99fc712d.zip
packages_apps_Browser-5ba3c76b201c4448de4b520f2aee2e7d99fc712d.tar.gz
packages_apps_Browser-5ba3c76b201c4448de4b520f2aee2e7d99fc712d.tar.bz2
Adjust text zoom by system preference
Bug: 5287968 System setting is a multiplier on top of browser's text zoom preference Change-Id: I88ea1340827492412c51efaf28ca789767ba8c56
Diffstat (limited to 'src')
-rw-r--r--src/com/android/browser/BrowserSettings.java8
-rw-r--r--src/com/android/browser/preferences/AccessibilityPreferencesFragment.java3
2 files changed, 8 insertions, 3 deletions
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index 6b8daec..cfaa18a 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -25,6 +25,7 @@ import android.os.Build;
import android.os.Message;
import android.preference.PreferenceManager;
import android.provider.Browser;
+import android.util.DisplayMetrics;
import android.webkit.CookieManager;
import android.webkit.GeolocationPermissions;
import android.webkit.WebIconDatabase;
@@ -104,6 +105,7 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
private WeakHashMap<WebSettings, String> mCustomUserAgents;
private static boolean sInitialized = false;
private boolean mNeedsSharedSync = true;
+ private float mFontSizeMult = 1.0f;
// Cached values
private int mPageCacheCapacity = 1;
@@ -158,6 +160,8 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
@Override
public void run() {
+ DisplayMetrics metrics = mContext.getResources().getDisplayMetrics();
+ mFontSizeMult = metrics.scaledDensity / metrics.density;
// the cost of one cached page is ~3M (measured using nytimes.com). For
// low end devices, we only cache one page. For high end devices, we try
// to cache more pages, currently choose 5.
@@ -522,9 +526,9 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
return rawValue;
}
- public static int getAdjustedTextZoom(int rawValue) {
+ public int getAdjustedTextZoom(int rawValue) {
rawValue = (rawValue - TEXT_ZOOM_START_VAL) * TEXT_ZOOM_STEP;
- return rawValue + 100;
+ return (int) ((rawValue + 100) * mFontSizeMult);
}
static int getRawTextZoom(int percent) {
diff --git a/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java b/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java
index 312a61e..6adfd23 100644
--- a/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java
+++ b/src/com/android/browser/preferences/AccessibilityPreferencesFragment.java
@@ -76,7 +76,8 @@ public class AccessibilityPreferencesFragment extends PreferenceFragment
.getAdjustedMinimumFontSize((Integer) objValue));
}
if (PreferenceKeys.PREF_TEXT_ZOOM.equals(pref.getKey())) {
- updateTextZoomSummary(pref, BrowserSettings
+ BrowserSettings settings = BrowserSettings.getInstance();
+ updateTextZoomSummary(pref, settings
.getAdjustedTextZoom((Integer) objValue));
}
if (PreferenceKeys.PREF_INVERTED_CONTRAST.equals(pref.getKey())) {