1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -05:00

Issue 4503: Auto-fit messages option

Create a preference option to automatically shrink messages
to fit the screen width (default setting is "shrink").
This commit is contained in:
Joe Steele 2013-04-04 17:11:17 -04:00
parent 0ecc49815f
commit d9979cb1a2
7 changed files with 37 additions and 1 deletions

View File

@ -325,6 +325,8 @@ Please submit bug reports, contribute new features and ask questions at
<string name="global_settings_messageview_fixedwidth_label">Fixed-width fonts</string>
<string name="global_settings_messageview_fixedwidth_summary">Use a fixed-width font when showing plain-text messages</string>
<string name="global_settings_messageview_autofit_width_label">Auto-fit messages</string>
<string name="global_settings_messageview_autofit_width_summary">Shrink messages to fit the screen</string>
<string name="global_settings_messageview_return_to_list_label">Return to list after delete</string>
<string name="global_settings_messageview_return_to_list_summary">Return to message list after message deletion</string>
<string name="global_settings_messageview_show_next_label">Show next message after delete</string>

View File

@ -217,6 +217,12 @@
android:title="@string/settings_messageview_mobile_layout_label"
android:summary="@string/settings_messageview_mobile_layout_summary" />
<CheckBoxPreference
android:persistent="false"
android:key="messageview_autofit_width"
android:title="@string/global_settings_messageview_autofit_width_label"
android:summary="@string/global_settings_messageview_autofit_width_summary"/>
</PreferenceCategory>
</PreferenceScreen>

View File

@ -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;
}

View File

@ -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());

View File

@ -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);

View File

@ -35,7 +35,7 @@ public class Settings {
*
* @see SettingsExporter
*/
public static final int VERSION = 26;
public static final int VERSION = 27;
public static Map<String, Object> validate(int version, Map<String,
TreeMap<Integer, SettingsDescription>> settings,

View File

@ -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();