Merge "Make message view text sizes consistent w/ Gmail" into honeycomb
This commit is contained in:
commit
09cb192d56
@ -47,13 +47,15 @@ public class Preferences {
|
|||||||
// "move to older" was the behavior on older versions.
|
// "move to older" was the behavior on older versions.
|
||||||
public static final int AUTO_ADVANCE_DEFAULT = AUTO_ADVANCE_OLDER;
|
public static final int AUTO_ADVANCE_DEFAULT = AUTO_ADVANCE_OLDER;
|
||||||
|
|
||||||
|
// The following constants are used as offsets into TEXT_ZOOM_ARRAY (below)
|
||||||
public static final int TEXT_ZOOM_TINY = 0;
|
public static final int TEXT_ZOOM_TINY = 0;
|
||||||
public static final int TEXT_ZOOM_SMALL = 1;
|
public static final int TEXT_ZOOM_SMALL = 1;
|
||||||
public static final int TEXT_ZOOM_NORMAL = 2;
|
public static final int TEXT_ZOOM_NORMAL = 2;
|
||||||
public static final int TEXT_ZOOM_LARGE = 3;
|
public static final int TEXT_ZOOM_LARGE = 3;
|
||||||
public static final int TEXT_ZOOM_HUGE = 4;
|
public static final int TEXT_ZOOM_HUGE = 4;
|
||||||
// "large" will be the default
|
// "normal" will be the default
|
||||||
public static final int TEXT_ZOOM_DEFAULT = TEXT_ZOOM_LARGE;
|
public static final int TEXT_ZOOM_DEFAULT = TEXT_ZOOM_NORMAL;
|
||||||
|
public static final float[] TEXT_ZOOM_ARRAY = new float[] {0.8f, 0.9f, 1.0f, 1.2f, 1.5f};
|
||||||
|
|
||||||
private static Preferences sPreferences;
|
private static Preferences sPreferences;
|
||||||
|
|
||||||
|
@ -502,18 +502,9 @@ public abstract class MessageViewFragmentBase extends Fragment implements View.O
|
|||||||
mMessageContentView.clearView();
|
mMessageContentView.clearView();
|
||||||
|
|
||||||
// Dynamic configuration of WebView
|
// Dynamic configuration of WebView
|
||||||
WebSettings.TextSize textZoom;
|
|
||||||
switch (Preferences.getPreferences(mContext).getTextZoom()) {
|
|
||||||
case Preferences.TEXT_ZOOM_TINY: textZoom = WebSettings.TextSize.SMALLEST; break;
|
|
||||||
case Preferences.TEXT_ZOOM_SMALL: textZoom = WebSettings.TextSize.SMALLER; break;
|
|
||||||
case Preferences.TEXT_ZOOM_NORMAL: textZoom = WebSettings.TextSize.NORMAL; break;
|
|
||||||
case Preferences.TEXT_ZOOM_LARGE: textZoom = WebSettings.TextSize.LARGER; break;
|
|
||||||
case Preferences.TEXT_ZOOM_HUGE: textZoom = WebSettings.TextSize.LARGEST; break;
|
|
||||||
default: textZoom = WebSettings.TextSize.NORMAL; break;
|
|
||||||
}
|
|
||||||
final WebSettings settings = mMessageContentView.getSettings();
|
final WebSettings settings = mMessageContentView.getSettings();
|
||||||
settings.setTextSize(textZoom);
|
|
||||||
settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL);
|
settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL);
|
||||||
|
setTextZoom();
|
||||||
}
|
}
|
||||||
mAttachmentsScroll.scrollTo(0, 0);
|
mAttachmentsScroll.scrollTo(0, 0);
|
||||||
mInviteScroll.scrollTo(0, 0);
|
mInviteScroll.scrollTo(0, 0);
|
||||||
@ -522,6 +513,20 @@ public abstract class MessageViewFragmentBase extends Fragment implements View.O
|
|||||||
initContactStatusViews();
|
initContactStatusViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the zoom value which is a combination of the user setting
|
||||||
|
* (tiny, small, normal, large, huge) and the device density. The intention
|
||||||
|
* is for the text to be physically equal in size over different density
|
||||||
|
* screens.
|
||||||
|
*/
|
||||||
|
private void setTextZoom() {
|
||||||
|
float density = mContext.getResources().getDisplayMetrics().density;
|
||||||
|
int zoom = Preferences.getPreferences(mContext).getTextZoom();
|
||||||
|
float textZoom = Preferences.TEXT_ZOOM_ARRAY[zoom] * density;
|
||||||
|
|
||||||
|
mMessageContentView.setInitialScale((int) (textZoom * 100));
|
||||||
|
}
|
||||||
|
|
||||||
private void initContactStatusViews() {
|
private void initContactStatusViews() {
|
||||||
mContactStatusState = CONTACT_STATUS_STATE_UNLOADED;
|
mContactStatusState = CONTACT_STATUS_STATE_UNLOADED;
|
||||||
mQuickContactLookupUri = null;
|
mQuickContactLookupUri = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user