diff --git a/res/values/strings.xml b/res/values/strings.xml index 2c9fbcf65..3a89687b5 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1129,6 +1129,16 @@ as %s. Large text Huge text + + + + 0.8 + 0.9 + 1.0 + 1.2 + 1.5 + + Message text size diff --git a/src/com/android/email/Preferences.java b/src/com/android/email/Preferences.java index f960797ae..fb5ec25b5 100644 --- a/src/com/android/email/Preferences.java +++ b/src/com/android/email/Preferences.java @@ -58,7 +58,7 @@ public class Preferences { // "move to older" was the behavior on older versions. private static final int AUTO_ADVANCE_DEFAULT = AUTO_ADVANCE_OLDER; - // The following constants are used as offsets into TEXT_ZOOM_ARRAY (below) + // The following constants are used as offsets into R.array.general_preference_text_zoom_size. public static final int TEXT_ZOOM_TINY = 0; public static final int TEXT_ZOOM_SMALL = 1; public static final int TEXT_ZOOM_NORMAL = 2; diff --git a/src/com/android/email/activity/MessageViewFragmentBase.java b/src/com/android/email/activity/MessageViewFragmentBase.java index 1bfbd46e1..4ec0c2083 100644 --- a/src/com/android/email/activity/MessageViewFragmentBase.java +++ b/src/com/android/email/activity/MessageViewFragmentBase.java @@ -109,6 +109,9 @@ public abstract class MessageViewFragmentBase extends Fragment implements View.O private static int PREVIEW_ICON_WIDTH = 62; private static int PREVIEW_ICON_HEIGHT = 62; + // The different levels of zoom: read from the Preferences. + private static String[] sZoomSizes = null; + private TextView mSubjectView; private TextView mFromNameView; private TextView mFromAddressView; @@ -202,12 +205,6 @@ public abstract class MessageViewFragmentBase extends Fragment implements View.O private final EmailAsyncTask.Tracker mTaskTracker = new EmailAsyncTask.Tracker(); - /** - * Zoom scales for webview. Values correspond to {@link Preferences#TEXT_ZOOM_TINY}.. - * {@link Preferences#TEXT_ZOOM_HUGE}. - */ - private static final float[] ZOOM_SCALE_ARRAY = new float[] {0.8f, 0.9f, 1.0f, 1.2f, 1.5f}; - public interface Callback { /** * Called when a link in a message is clicked. @@ -522,7 +519,11 @@ public abstract class MessageViewFragmentBase extends Fragment implements View.O private int getWebViewZoom() { float density = mContext.getResources().getDisplayMetrics().density; int zoom = Preferences.getPreferences(mContext).getTextZoom(); - return (int) (ZOOM_SCALE_ARRAY[zoom] * density * 100); + if (sZoomSizes == null) { + sZoomSizes = mContext.getResources() + .getStringArray(R.array.general_preference_text_zoom_size); + } + return (int)(Float.valueOf(sZoomSizes[zoom]) * density * 100); } private void initContactStatusViews() {