1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Merge branch 'Issue_4503_auto-fit_messages_option' of https://github.com/zjw/k-9 into zjw-Issue_4503_auto-fit_messages_option

* 'Issue_4503_auto-fit_messages_option' of https://github.com/zjw/k-9:
  Revert "Don't show a disabled preference if there is nothing a user can do to enable it."
  Fix indentation
  Correct preference version number.
  Issue 4503: Auto-fit messages option
  Don't show a disabled preference if there is nothing a user can do to enable it.
This commit is contained in:
Jesse Vincent 2013-05-07 21:49:12 -04:00
commit 2e74d28da9
6 changed files with 36 additions and 0 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";
@ -121,6 +122,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 {
mMobileOptimizedLayout.setChecked(K9.mobileOptimizedLayout());
}
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

@ -222,6 +222,9 @@ public class GlobalSettings {
s.put("showContactPicture", Settings.versions(
new V(25, new BooleanSetting(true))
));
s.put("autofitWidth", Settings.versions(
new V(27, new BooleanSetting(true))
));
SETTINGS = Collections.unmodifiableMap(s);

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