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

Add preferences to enable pinch-to-zoom and single-column layout for

messages
This commit is contained in:
Jesse Vincent 2010-10-11 14:54:15 +00:00
parent 7689cc237c
commit c5d68fb49d
5 changed files with 71 additions and 2 deletions

View File

@ -800,6 +800,13 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="settings_theme_label">Theme</string>
<string name="settings_language_label">Language</string>
<string name="settings_messageview_mobile_layout_label">Single-column layout</string>
<string name="settings_messageview_mobile_layout_summary">Reformat HTML messages for smaller screens</string>
<string name="settings_messageview_zoom_controls_label">System zoom controls</string>
<string name="settings_messageview_zoom_controls_summary">Enable zoom widgets or pinch-zoom if your device supports it</string>
<string name="setting_language_system">System default</string>
<string name="background_ops_label">Background sync</string>

View File

@ -101,6 +101,10 @@
android:key="messageview_fixedwidth_font"
android:title="@string/global_settings_messageview_fixedwidth_label"
android:summary="@string/global_settings_messageview_fixedwidth_summary" />
<CheckBoxPreference
android:key="messageview_mobile_layout"
android:title="@string/settings_messageview_mobile_layout_label"
android:summary="@string/settings_messageview_mobile_layout_summary" />
</PreferenceCategory>
@ -139,6 +143,10 @@
android:key="messageview_return_to_list"
android:title="@string/global_settings_messageview_return_to_list_label"
android:summary="@string/global_settings_messageview_return_to_list_summary" />
<CheckBoxPreference
android:key="messageview_zoom_controls"
android:title="@string/settings_messageview_zoom_controls_label"
android:summary="@string/settings_messageview_zoom_controls_summary" />
<com.fsck.k9.preferences.CheckBoxListPreference
android:key="confirm_actions"

View File

@ -154,6 +154,8 @@ public class K9 extends Application
private static boolean mStartIntegratedInbox = false;
private static boolean mMeasureAccounts = true;
private static boolean mCountSearchMessages = true;
private static boolean mZoomControlsEnabled = false;
private static boolean mMobileOptimizedLayout = false;
private static boolean useGalleryBugWorkaround = false;
private static boolean galleryBuggy;
@ -374,6 +376,10 @@ public class K9 extends Application
editor.putBoolean("useVolumeKeysForNavigation", mUseVolumeKeysForNavigation);
editor.putBoolean("useVolumeKeysForListNavigation", mUseVolumeKeysForListNavigation);
editor.putBoolean("manageBack", mManageBack);
editor.putBoolean("zoomControlsEnabled",mZoomControlsEnabled);
editor.putBoolean("mobileOptimizedLayout", mMobileOptimizedLayout);
editor.putBoolean("startIntegratedInbox", mStartIntegratedInbox);
editor.putBoolean("measureAccounts", mMeasureAccounts);
editor.putBoolean("countSearchMessages", mCountSearchMessages);
@ -421,6 +427,8 @@ public class K9 extends Application
mMessageListStars = sprefs.getBoolean("messageListStars",true);
mMessageListCheckboxes = sprefs.getBoolean("messageListCheckboxes",false);
mMessageListTouchable = sprefs.getBoolean("messageListTouchable",false);
mMobileOptimizedLayout = sprefs.getBoolean("mobileOptimizedLayout", false);
mZoomControlsEnabled = sprefs.getBoolean("zoomControlsEnabled",false);
mShowContactName = sprefs.getBoolean("showContactName", false);
mChangeContactNameColor = sprefs.getBoolean("changeRegisteredNameColor", false);
@ -642,6 +650,31 @@ public class K9 extends Application
mManageBack = manageBack;
}
public static boolean zoomControlsEnabled()
{
return mZoomControlsEnabled;
}
public static void setZoomControlsEnabled(boolean zoomControlsEnabled)
{
mZoomControlsEnabled = zoomControlsEnabled;
}
public static boolean mobileOptimizedLayout()
{
return mMobileOptimizedLayout;
}
public static void setMobileOptimizedLayout(boolean mobileOptimizedLayout)
{
mMobileOptimizedLayout = mobileOptimizedLayout;
}
public static boolean startIntegratedInbox()
{
return mStartIntegratedInbox;

View File

@ -880,8 +880,14 @@ public class MessageView extends K9Activity implements OnClickListener
webSettings.setSupportZoom(true);
webSettings.setLoadsImagesAutomatically(true);
//webSettings.setBuiltInZoomControls(true);
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
if (K9.zoomControlsEnabled())
{
webSettings.setBuiltInZoomControls(true);
}
if (K9.mobileOptimizedLayout())
{
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
}
webSettings.setTextSize(mFontSizes.getMessageViewContent());

View File

@ -55,7 +55,10 @@ public class Prefs extends K9PreferenceActivity
private static final String PREFERENCE_MESSAGELIST_SHOW_CONTACT_NAME = "messagelist_show_contact_name";
private static final String PREFERENCE_MESSAGELIST_CONTACT_NAME_COLOR = "messagelist_contact_name_color";
private static final String PREFERENCE_MESSAGEVIEW_FIXEDWIDTH = "messageview_fixedwidth_font";
private static final String PREFERENCE_MESSAGEVIEW_RETURN_TO_LIST = "messageview_return_to_list";
private static final String PREFERENCE_MESSAGEVIEW_ZOOM_CONTROLS_ENABLED = "messageview_zoom_controls";
private static final String PREFERENCE_MESSAGEVIEW_MOBILE_LAYOUT = "messageview_mobile_layout";
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";
@ -81,6 +84,8 @@ public class Prefs extends K9PreferenceActivity
private CheckBoxPreference mChangeContactNameColor;
private CheckBoxPreference mFixedWidth;
private CheckBoxPreference mReturnToList;
private CheckBoxPreference mZoomControlsEnabled;
private CheckBoxPreference mMobileOptimizedLayout;
private ListPreference mBackgroundOps;
private CheckBoxPreference mUseGalleryBugWorkaround;
private CheckBoxPreference mDebugLogging;
@ -218,6 +223,13 @@ public class Prefs extends K9PreferenceActivity
mReturnToList = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGEVIEW_RETURN_TO_LIST);
mReturnToList.setChecked(K9.messageViewReturnToList());
mZoomControlsEnabled = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGEVIEW_ZOOM_CONTROLS_ENABLED);
mZoomControlsEnabled.setChecked(K9.zoomControlsEnabled());
mMobileOptimizedLayout = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGEVIEW_MOBILE_LAYOUT);
mMobileOptimizedLayout.setChecked(K9.mobileOptimizedLayout());
mBackgroundOps = setupListPreference(PREFERENCE_BACKGROUND_OPS, K9.getBackgroundOps().toString());
mUseGalleryBugWorkaround = (CheckBoxPreference)findPreference(PREFERENCE_GALLERY_BUG_WORKAROUND);
@ -253,6 +265,9 @@ public class Prefs extends K9PreferenceActivity
K9.setChangeContactNameColor(mChangeContactNameColor.isChecked());
K9.setMessageViewFixedWidthFont(mFixedWidth.isChecked());
K9.setMessageViewReturnToList(mReturnToList.isChecked());
K9.setMobileOptimizedLayout(mMobileOptimizedLayout.isChecked());
K9.setZoomControlsEnabled(mZoomControlsEnabled.isChecked());
boolean needsRefresh = K9.setBackgroundOps(mBackgroundOps.getValue());
K9.setUseGalleryBugWorkaround(mUseGalleryBugWorkaround.isChecked());