diff --git a/res/values/strings.xml b/res/values/strings.xml index dc60041e1..3963a7eb0 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -325,6 +325,8 @@ Please submit bug reports, contribute new features and ask questions at Fixed-width fonts Use a fixed-width font when showing plain-text messages + Auto-fit messages + Shrink messages to fit the screen Return to list after delete Return to message list after message deletion Show next message after delete diff --git a/res/xml/global_preferences.xml b/res/xml/global_preferences.xml index f10fa93b0..ef3ecd56f 100644 --- a/res/xml/global_preferences.xml +++ b/res/xml/global_preferences.xml @@ -217,6 +217,12 @@ android:title="@string/settings_messageview_mobile_layout_label" android:summary="@string/settings_messageview_mobile_layout_summary" /> + + diff --git a/src/com/fsck/k9/K9.java b/src/com/fsck/k9/K9.java index d2c843b94..5b1589552 100644 --- a/src/com/fsck/k9/K9.java +++ b/src/com/fsck/k9/K9.java @@ -239,6 +239,7 @@ public class K9 extends Application { private static boolean mCountSearchMessages = true; private static boolean mHideSpecialAccounts = false; private static boolean mMobileOptimizedLayout = false; + private static boolean mAutofitWidth; private static boolean mQuietTimeEnabled = false; private static String mQuietTimeStarts = null; private static String mQuietTimeEnds = null; @@ -487,6 +488,7 @@ public class K9 extends Application { editor.putBoolean("useVolumeKeysForNavigation", mUseVolumeKeysForNavigation); editor.putBoolean("useVolumeKeysForListNavigation", mUseVolumeKeysForListNavigation); editor.putBoolean("mobileOptimizedLayout", mMobileOptimizedLayout); + editor.putBoolean("autofitWidth", mAutofitWidth); editor.putBoolean("quietTimeEnabled", mQuietTimeEnabled); editor.putString("quietTimeStarts", mQuietTimeStarts); editor.putString("quietTimeEnds", mQuietTimeEnds); @@ -684,6 +686,7 @@ public class K9 extends Application { mMessageListPreviewLines = sprefs.getInt("messageListPreviewLines", 2); mMobileOptimizedLayout = sprefs.getBoolean("mobileOptimizedLayout", false); + mAutofitWidth = sprefs.getBoolean("autofitWidth", true); mQuietTimeEnabled = sprefs.getBoolean("quietTimeEnabled", false); mQuietTimeStarts = sprefs.getString("quietTimeStarts", "21:00"); @@ -933,6 +936,14 @@ public class K9 extends Application { mMobileOptimizedLayout = mobileOptimizedLayout; } + public static boolean autofitWidth() { + return mAutofitWidth; + } + + public static void setAutofitWidth(boolean autofitWidth) { + mAutofitWidth = autofitWidth; + } + public static boolean getQuietTimeEnabled() { return mQuietTimeEnabled; } diff --git a/src/com/fsck/k9/activity/setup/Prefs.java b/src/com/fsck/k9/activity/setup/Prefs.java index fa8505779..128f22c2a 100644 --- a/src/com/fsck/k9/activity/setup/Prefs.java +++ b/src/com/fsck/k9/activity/setup/Prefs.java @@ -82,6 +82,7 @@ public class Prefs extends K9PreferenceActivity { private static final String PREFERENCE_NOTIF_QUICK_DELETE = "notification_quick_delete"; private static final String PREFERENCE_MESSAGEVIEW_MOBILE_LAYOUT = "messageview_mobile_layout"; + private static final String PREFERENCE_AUTOFIT_WIDTH = "messageview_autofit_width"; private static final String PREFERENCE_BACKGROUND_OPS = "background_ops"; private static final String PREFERENCE_GALLERY_BUG_WORKAROUND = "use_gallery_bug_workaround"; private static final String PREFERENCE_DEBUG_LOGGING = "debug_logging"; @@ -122,6 +123,7 @@ public class Prefs extends K9PreferenceActivity { private CheckBoxPreference mReturnToList; private CheckBoxPreference mShowNext; private CheckBoxPreference mMobileOptimizedLayout; + private CheckBoxPreference mAutofitWidth; private ListPreference mBackgroundOps; private CheckBoxPreference mUseGalleryBugWorkaround; private CheckBoxPreference mDebugLogging; @@ -290,6 +292,9 @@ public class Prefs extends K9PreferenceActivity { category.removePreference(mMobileOptimizedLayout); } + mAutofitWidth = (CheckBoxPreference) findPreference(PREFERENCE_AUTOFIT_WIDTH); + mAutofitWidth.setChecked(K9.autofitWidth()); + mQuietTimeEnabled = (CheckBoxPreference) findPreference(PREFERENCE_QUIET_TIME_ENABLED); mQuietTimeEnabled.setChecked(K9.getQuietTimeEnabled()); @@ -458,6 +463,7 @@ public class Prefs extends K9PreferenceActivity { K9.setMessageViewReturnToList(mReturnToList.isChecked()); K9.setMessageViewShowNext(mShowNext.isChecked()); K9.setMobileOptimizedLayout(mMobileOptimizedLayout.isChecked()); + K9.setAutofitWidth(mAutofitWidth.isChecked()); K9.setQuietTimeEnabled(mQuietTimeEnabled.isChecked()); K9.setQuietTimeStarts(mQuietTimeStarts.getTime()); diff --git a/src/com/fsck/k9/preferences/GlobalSettings.java b/src/com/fsck/k9/preferences/GlobalSettings.java index 9a88fde94..03eec7870 100644 --- a/src/com/fsck/k9/preferences/GlobalSettings.java +++ b/src/com/fsck/k9/preferences/GlobalSettings.java @@ -221,6 +221,9 @@ public class GlobalSettings { s.put("showContactPicture", Settings.versions( new V(25, new BooleanSetting(true)) )); + s.put("autofitWidth", Settings.versions( + new V(26, new BooleanSetting(true)) + )); SETTINGS = Collections.unmodifiableMap(s); diff --git a/src/com/fsck/k9/preferences/Settings.java b/src/com/fsck/k9/preferences/Settings.java index b56f2d87e..e52872f20 100644 --- a/src/com/fsck/k9/preferences/Settings.java +++ b/src/com/fsck/k9/preferences/Settings.java @@ -35,7 +35,7 @@ public class Settings { * * @see SettingsExporter */ - public static final int VERSION = 26; + public static final int VERSION = 27; public static Map validate(int version, Map> settings, diff --git a/src/com/fsck/k9/view/MessageWebView.java b/src/com/fsck/k9/view/MessageWebView.java index 1d54f1254..06d17c1fa 100644 --- a/src/com/fsck/k9/view/MessageWebView.java +++ b/src/com/fsck/k9/view/MessageWebView.java @@ -112,6 +112,14 @@ public class MessageWebView extends TitleBarWebView { webSettings.setSupportZoom(true); webSettings.setBuiltInZoomControls(true); webSettings.setUseWideViewPort(true); + if (K9.autofitWidth()) { + // 1% will be smaller than overview, so it effectively + // goes into overview mode. + // Tried the following, neither of which worked: + // webSettings.setLoadWithOverviewMode(true); + // setInitialScale(0); + setInitialScale(1); + } disableDisplayZoomControls();