am fb9c860a
: Remove hard-coded references to zoom values and set them as resource arrays instead.
* commit 'fb9c860ae2fafffd95931ded199e8c07ed3831bb': Remove hard-coded references to zoom values and set them as resource arrays instead.
This commit is contained in:
commit
cc026d2df5
@ -1129,6 +1129,16 @@ as <xliff:g id="filename">%s</xliff:g>.</string>
|
||||
<item>Large text</item>
|
||||
<item>Huge text</item>
|
||||
</string-array>
|
||||
|
||||
<!-- The message text size values -->
|
||||
<string-array translatable="false" name="general_preference_text_zoom_size">
|
||||
<item>0.8</item>
|
||||
<item>0.9</item>
|
||||
<item>1.0</item>
|
||||
<item>1.2</item>
|
||||
<item>1.5</item>
|
||||
</string-array>
|
||||
|
||||
<!-- General preference: Title of the dialog box with options for text zoom. [CHAR LIMIT=32] -->
|
||||
<string name="general_preference_text_zoom_dialog_title">Message text size</string>
|
||||
<!-- General preference: Text zoom. Value is "tiny" (-2) [CHAR LIMIT=32] -->
|
||||
|
@ -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;
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user