mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-12 04:25:08 -05:00
Only use the single-column layout on known good Android versions
Fixes issue 3820
This commit is contained in:
parent
83e57064ff
commit
b72fcd9d4b
@ -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,12 +280,12 @@ 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());
|
||||
}
|
||||
|
||||
mQuietTimeEnabled = (CheckBoxPreference) findPreference(PREFERENCE_QUIET_TIME_ENABLED);
|
||||
mQuietTimeEnabled.setChecked(K9.getQuietTimeEnabled());
|
||||
|
@ -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.
|
||||
*
|
||||
* <p>
|
||||
* Single column layout was broken on Android < 2.2 (see
|
||||
* <a href="http://code.google.com/p/android/issues/detail?id=5024">issue 5024</a>).
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Android versions >= 3.0 have problems with unclickable links when single column layout is
|
||||
* enabled (see
|
||||
* <a href="http://code.google.com/p/android/issues/detail?id=34886">issue 34886</a>
|
||||
* in Android's bug tracker, and
|
||||
* <a href="http://code.google.com/p/k9mail/issues/detail?id=3820">issue 3820</a>
|
||||
* 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);
|
||||
|
Loading…
Reference in New Issue
Block a user