diff --git a/src/com/fsck/k9/activity/setup/Prefs.java b/src/com/fsck/k9/activity/setup/Prefs.java index 20e77a455..734c7761a 100644 --- a/src/com/fsck/k9/activity/setup/Prefs.java +++ b/src/com/fsck/k9/activity/setup/Prefs.java @@ -33,6 +33,7 @@ import com.fsck.k9.preferences.CheckBoxListPreference; import com.fsck.k9.preferences.TimePickerPreference; import com.fsck.k9.service.MailService; +import com.fsck.k9.view.MessageWebView; public class Prefs extends K9PreferenceActivity { @@ -279,13 +280,13 @@ public class Prefs extends K9PreferenceActivity { mZoomControlsEnabled.setChecked(K9.zoomControlsEnabled()); mMobileOptimizedLayout = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGEVIEW_MOBILE_LAYOUT); - if (Build.VERSION.SDK_INT <= 7) { + if (!MessageWebView.isSingleColumnLayoutSupported()) { mMobileOptimizedLayout.setEnabled(false); + mMobileOptimizedLayout.setChecked(false); + } else { + mMobileOptimizedLayout.setChecked(K9.mobileOptimizedLayout()); } - - mMobileOptimizedLayout.setChecked(K9.mobileOptimizedLayout()); - mQuietTimeEnabled = (CheckBoxPreference) findPreference(PREFERENCE_QUIET_TIME_ENABLED); mQuietTimeEnabled.setChecked(K9.getQuietTimeEnabled()); @@ -354,7 +355,7 @@ public class Prefs extends K9PreferenceActivity { } }; }); - + mBatchButtonsMarkRead = (CheckBoxPreference)findPreference(PREFERENCE_BATCH_BUTTONS_MARK_READ); mBatchButtonsDelete = (CheckBoxPreference)findPreference(PREFERENCE_BATCH_BUTTONS_DELETE); mBatchButtonsArchive = (CheckBoxPreference)findPreference(PREFERENCE_BATCH_BUTTONS_ARCHIVE); diff --git a/src/com/fsck/k9/view/MessageWebView.java b/src/com/fsck/k9/view/MessageWebView.java index 9d61b87e4..563262203 100644 --- a/src/com/fsck/k9/view/MessageWebView.java +++ b/src/com/fsck/k9/view/MessageWebView.java @@ -25,6 +25,27 @@ public class MessageWebView extends WebView { */ public static final Method mGetBlockNetworkLoads = K9.getMethod(WebSettings.class, "setBlockNetworkLoads"); + /** + * Check whether the single column layout algorithm can be used on this version of Android. + * + *
+ * Single column layout was broken on Android < 2.2 (see + * issue 5024). + *
+ * + *+ * Android versions >= 3.0 have problems with unclickable links when single column layout is + * enabled (see + * issue 34886 + * in Android's bug tracker, and + * issue 3820 + * in K-9 Mail's bug tracker). + */ + public static boolean isSingleColumnLayoutSupported() { + return (Build.VERSION.SDK_INT > 7 && Build.VERSION.SDK_INT < 11); + } + + public MessageWebView(Context context) { super(context); } @@ -91,9 +112,7 @@ public class MessageWebView extends WebView { webSettings.setBuiltInZoomControls(true); } - // SINGLE_COLUMN layout was broken on Android < 2.2, so we - // administratively disable it - if (Build.VERSION.SDK_INT > 7 && K9.mobileOptimizedLayout()) { + if (isSingleColumnLayoutSupported() && K9.mobileOptimizedLayout()) { webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); } else { webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);