From e0d6a55d06cd15ace22fa224fd1966cf5d983992 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Fri, 29 Oct 2010 22:35:19 +0000 Subject: [PATCH] SINGLE_COLUMN layouts cause Android 1.0-2.1 to segfault. --- src/com/fsck/k9/activity/MessageView.java | 8 +++++++- src/com/fsck/k9/activity/setup/Prefs.java | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/com/fsck/k9/activity/MessageView.java b/src/com/fsck/k9/activity/MessageView.java index 1c59ac6e5..2851ea88a 100644 --- a/src/com/fsck/k9/activity/MessageView.java +++ b/src/com/fsck/k9/activity/MessageView.java @@ -32,6 +32,7 @@ import android.graphics.drawable.Drawable; import android.media.MediaScannerConnection; import android.media.MediaScannerConnection.MediaScannerConnectionClient; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.os.Handler; @@ -886,7 +887,12 @@ public class MessageView extends K9Activity implements OnClickListener { webSettings.setBuiltInZoomControls(true); } - if (K9.mobileOptimizedLayout()) + + // SINGLE_COLUMN layout was broken on Android < 2.2, so we + // administratively disable it + if ( + ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) + && K9.mobileOptimizedLayout()) { webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); } diff --git a/src/com/fsck/k9/activity/setup/Prefs.java b/src/com/fsck/k9/activity/setup/Prefs.java index 1e62ca524..891458fce 100644 --- a/src/com/fsck/k9/activity/setup/Prefs.java +++ b/src/com/fsck/k9/activity/setup/Prefs.java @@ -8,6 +8,7 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; +import android.os.Build; import android.os.Bundle; import android.preference.CheckBoxPreference; import android.preference.ListPreference; @@ -227,6 +228,12 @@ public class Prefs extends K9PreferenceActivity mZoomControlsEnabled.setChecked(K9.zoomControlsEnabled()); mMobileOptimizedLayout = (CheckBoxPreference) findPreference(PREFERENCE_MESSAGEVIEW_MOBILE_LAYOUT); + if ( Build.VERSION.SDK_INT < Build.VERSION_CODES.FROYO) + { + mMobileOptimizedLayout.setEnabled(false); + } + + mMobileOptimizedLayout.setChecked(K9.mobileOptimizedLayout());