diff --git a/res/values/strings.xml b/res/values/strings.xml index cb66bb46d..ae1144ef4 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -293,6 +293,8 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin Touch-friendly view Roomier list items with message previews + Fixed-width fonts + Use a fixed-width font when showing plain-text messages Set up a new account Enter this account\'s email address: @@ -696,8 +698,9 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin Sync Account List Message Lists + Messages Theme - + Background sync Never Always diff --git a/res/xml/global_preferences.xml b/res/xml/global_preferences.xml index cb61bfe8c..557343b13 100644 --- a/res/xml/global_preferences.xml +++ b/res/xml/global_preferences.xml @@ -89,6 +89,15 @@ + + + + classObject, String methodName) { try diff --git a/src/com/fsck/k9/activity/setup/Prefs.java b/src/com/fsck/k9/activity/setup/Prefs.java index 886c5f3a8..0efa66d1d 100644 --- a/src/com/fsck/k9/activity/setup/Prefs.java +++ b/src/com/fsck/k9/activity/setup/Prefs.java @@ -33,6 +33,8 @@ public class Prefs extends K9PreferenceActivity private static final String PREFERENCE_MESSAGELIST_CHECKBOXES = "messagelist_checkboxes"; private static final String PREFERENCE_MESSAGELIST_TOUCHABLE = "messagelist_touchable"; + private static final String PREFERENCE_MESSAGEVIEW_FIXEDWIDTH = "messageview_fixedwidth_font"; + private static final String PREFERENCE_MEASURE_ACCOUNTS = "measure_accounts"; private static final String PREFERENCE_COUNT_SEARCH = "count_search"; private static final String PREFERENCE_GALLERY_BUG_WORKAROUND = "use_gallery_bug_workaround"; @@ -47,6 +49,9 @@ public class Prefs extends K9PreferenceActivity private CheckBoxPreference mStars; private CheckBoxPreference mCheckboxes; private CheckBoxPreference mTouchable; + + private CheckBoxPreference mFixedWidth; + private CheckBoxPreference mMeasureAccounts; private CheckBoxPreference mCountSearch; private CheckBoxPreference mUseGalleryBugWorkaround; @@ -161,6 +166,10 @@ public class Prefs extends K9PreferenceActivity mTouchable = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGELIST_TOUCHABLE); mTouchable.setChecked(K9.messageListTouchable()); + mFixedWidth = (CheckBoxPreference)findPreference(PREFERENCE_MESSAGEVIEW_FIXEDWIDTH); + mFixedWidth.setChecked(K9.messageViewFixedWidthFont()); + + mMeasureAccounts = (CheckBoxPreference)findPreference(PREFERENCE_MEASURE_ACCOUNTS); mMeasureAccounts.setChecked(K9.measureAccounts()); @@ -190,9 +199,10 @@ public class Prefs extends K9PreferenceActivity K9.setManageBack(mManageBack.isChecked()); K9.setMessageListStars(mStars.isChecked()); K9.setMessageListCheckboxes(mCheckboxes.isChecked()); - K9.setMessageListTouchable(mTouchable.isChecked()); + K9.setMessageViewFixedWidthFont(mFixedWidth.isChecked()); + K9.setMeasureAccounts(mMeasureAccounts.isChecked()); K9.setCountSearchMessages(mCountSearch.isChecked()); diff --git a/src/com/fsck/k9/mail/store/LocalStore.java b/src/com/fsck/k9/mail/store/LocalStore.java index de340bd96..bc17dd8f2 100644 --- a/src/com/fsck/k9/mail/store/LocalStore.java +++ b/src/com/fsck/k9/mail/store/LocalStore.java @@ -2333,9 +2333,11 @@ public class LocalStore extends Store implements Serializable text = text.replaceAll("(?m)^([^\r\n]{4,}[\\s\\w,:;+/])(?:\r\n|\n|\r)(?=[a-z]\\S{0,10}[\\s\\n\\r])","$1 "); text = text.replaceAll("(?m)(\r\n|\n|\r){4,}","\n\n"); + Matcher m = Regex.WEB_URL_PATTERN.matcher(text); StringBuffer sb = new StringBuffer(text.length() + 512); - sb.append("
");
+            sb.append("");
+            sb.append(htmlifyMessageHeader());
             while (m.find())
             {
                 int start = m.start();
@@ -2353,12 +2355,38 @@ public class LocalStore extends Store implements Serializable
 
 
             m.appendTail(sb);
-            sb.append("
"); + sb.append(htmlifyMessageFooter()); + sb.append(""); text = sb.toString(); return text; } + private String htmlifyMessageHeader() + { + if (K9.messageViewFixedWidthFont()) + { + return "
";
+            }
+            else
+            {
+                return "
"; + } + } + + + private String htmlifyMessageFooter() + { + if (K9.messageViewFixedWidthFont()) + { + return "
"; + } + else + { + return ""; + } + } + @Override public boolean isInTopGroup() {