diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 31f9fa90b..483e656fc 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -537,6 +537,7 @@
+ - @string/font_size_default
- @string/font_size_tiniest
- @string/font_size_tiny
- @string/font_size_smaller
@@ -547,6 +548,7 @@
+ - -1
- 10
- 12
- 14
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e30ff41dc..0a0906b41 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -941,6 +941,7 @@ Please submit bug reports, contribute new features and ask questions at
Message composition
Text input fields
+ Default
Tiniest
Tiny
Smaller
diff --git a/src/com/fsck/k9/FontSizes.java b/src/com/fsck/k9/FontSizes.java
index 352570ec5..539e2da45 100644
--- a/src/com/fsck/k9/FontSizes.java
+++ b/src/com/fsck/k9/FontSizes.java
@@ -1,7 +1,9 @@
package com.fsck.k9;
import android.content.SharedPreferences;
+import android.util.TypedValue;
import android.webkit.WebSettings.TextSize;
+import android.widget.TextView;
/**
* Manage font size of the information displayed in the account list, folder
@@ -32,6 +34,7 @@ public class FontSizes {
/*
* Values for the font sizes in SP (Scale-independent Pixels)
*/
+ public static final int FONT_DEFAULT = -1; // Don't force-reset the size of this setting
public static final int FONT_10SP = 10;
public static final int FONT_12SP = 12;
public static final int SMALL = 14; // ?android:attr/textAppearanceSmall
@@ -133,24 +136,24 @@ public class FontSizes {
* Create a FontSizes
object with default values.
*/
public FontSizes() {
- accountName = MEDIUM;
- accountDescription = SMALL;
+ accountName = FONT_DEFAULT;
+ accountDescription = FONT_DEFAULT;
- folderName = MEDIUM;
- folderStatus = SMALL;
+ folderName = FONT_DEFAULT;
+ folderStatus = FONT_DEFAULT;
- messageListSubject = FONT_16SP;
- messageListSender = SMALL;
- messageListDate = SMALL;
- messageListPreview = SMALL;
+ messageListSubject = FONT_DEFAULT;
+ messageListSender = FONT_DEFAULT;
+ messageListDate = FONT_DEFAULT;
+ messageListPreview = FONT_DEFAULT;
- messageViewSender = SMALL;
- messageViewTo = FONT_12SP;
- messageViewCC = FONT_12SP;
- messageViewAdditionalHeaders = FONT_12SP;
- messageViewSubject = FONT_12SP;
- messageViewTime = FONT_10SP;
- messageViewDate = FONT_10SP;
+ messageViewSender = FONT_DEFAULT;
+ messageViewTo = FONT_DEFAULT;
+ messageViewCC = FONT_DEFAULT;
+ messageViewAdditionalHeaders = FONT_DEFAULT;
+ messageViewSubject = FONT_DEFAULT;
+ messageViewTime = FONT_DEFAULT;
+ messageViewDate = FONT_DEFAULT;
messageComposeInput = MEDIUM;
}
@@ -380,4 +383,12 @@ public class FontSizes {
public void setMessageComposeInput(int messageComposeInput) {
this.messageComposeInput = messageComposeInput;
}
-}
+
+ // This, arguably, should live somewhere in a view class, but since we call it from activities, fragments
+ // and views, where isn't exactly clear.
+ public void setViewTextSize(TextView v, int fontSize) {
+ if (fontSize != FONT_DEFAULT) {
+ v.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/com/fsck/k9/activity/AccountList.java b/src/com/fsck/k9/activity/AccountList.java
index 9c17ffd42..638cf9024 100644
--- a/src/com/fsck/k9/activity/AccountList.java
+++ b/src/com/fsck/k9/activity/AccountList.java
@@ -154,10 +154,9 @@ public abstract class AccountList extends K9ListActivity implements OnItemClickL
holder.chip.getBackground().setAlpha(255);
- holder.description.setTextSize(TypedValue.COMPLEX_UNIT_SP,
- mFontSizes.getAccountName());
- holder.email.setTextSize(TypedValue.COMPLEX_UNIT_SP,
- mFontSizes.getAccountDescription());
+ mFontSizes.setViewTextSize(holder.description, mFontSizes.getAccountName());
+ mFontSizes.setViewTextSize(holder.email, mFontSizes.getAccountDescription());
+
return view;
}
diff --git a/src/com/fsck/k9/activity/Accounts.java b/src/com/fsck/k9/activity/Accounts.java
index 6fff601d3..afa4b0973 100644
--- a/src/com/fsck/k9/activity/Accounts.java
+++ b/src/com/fsck/k9/activity/Accounts.java
@@ -1748,8 +1748,10 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
}
- holder.description.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getAccountName());
- holder.email.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getAccountDescription());
+
+
+ mFontSizes.setViewTextSize(holder.description, mFontSizes.getAccountName());
+ mFontSizes.setViewTextSize(holder.email, mFontSizes.getAccountDescription());
if (account instanceof SearchAccount) {
holder.folders.setVisibility(View.GONE);
diff --git a/src/com/fsck/k9/activity/FolderList.java b/src/com/fsck/k9/activity/FolderList.java
index 68458167e..6c9b103b8 100644
--- a/src/com/fsck/k9/activity/FolderList.java
+++ b/src/com/fsck/k9/activity/FolderList.java
@@ -1103,7 +1103,9 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
holder.chip.setBackgroundDrawable(mAccount.generateColorChip((folder.unreadMessageCount == 0 ? true : false ), false, false, false,false).drawable());
- holder.folderName.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getFolderName());
+
+ mFontSizes.setViewTextSize(holder.folderName, mFontSizes.getFolderName());
+
if (K9.wrapFolderNames()) {
holder.folderName.setEllipsize(null);
holder.folderName.setSingleLine(false);
@@ -1112,7 +1114,7 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
holder.folderName.setEllipsize(TruncateAt.START);
holder.folderName.setSingleLine(true);
}
- holder.folderStatus.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getFolderStatus());
+ mFontSizes.setViewTextSize(holder.folderStatus, mFontSizes.getFolderStatus());
return view;
diff --git a/src/com/fsck/k9/activity/MessageCompose.java b/src/com/fsck/k9/activity/MessageCompose.java
index b0206a047..0c1c60dd3 100644
--- a/src/com/fsck/k9/activity/MessageCompose.java
+++ b/src/com/fsck/k9/activity/MessageCompose.java
@@ -850,13 +850,14 @@ public class MessageCompose extends K9Activity implements OnClickListener {
// Set font size of input controls
int fontSize = mFontSizes.getMessageComposeInput();
- mToView.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
- mCcView.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
- mBccView.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
- mSubjectView.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
- mMessageContentView.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
- mQuotedText.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
- mSignatureView.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
+ mFontSizes.setViewTextSize(mToView, fontSize);
+ mFontSizes.setViewTextSize(mCcView, fontSize);
+ mFontSizes.setViewTextSize(mBccView, fontSize);
+ mFontSizes.setViewTextSize(mSubjectView, fontSize);
+ mFontSizes.setViewTextSize(mMessageContentView, fontSize);
+ mFontSizes.setViewTextSize(mQuotedText, fontSize);
+ mFontSizes.setViewTextSize(mSignatureView, fontSize);
+
updateMessageFormat();
diff --git a/src/com/fsck/k9/fragment/MessageListFragment.java b/src/com/fsck/k9/fragment/MessageListFragment.java
index 777d9f6d4..2236392a9 100644
--- a/src/com/fsck/k9/fragment/MessageListFragment.java
+++ b/src/com/fsck/k9/fragment/MessageListFragment.java
@@ -1746,17 +1746,20 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
if (mSenderAboveSubject) {
holder.from = (TextView) view.findViewById(R.id.subject);
- holder.from.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListSender());
+ mFontSizes.setViewTextSize(holder.from, mFontSizes.getMessageListSender());
+
} else {
holder.subject = (TextView) view.findViewById(R.id.subject);
- holder.subject.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListSubject());
+ mFontSizes.setViewTextSize(holder.subject, mFontSizes.getMessageListSubject());
+
}
- holder.date.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListDate());
+ mFontSizes.setViewTextSize(holder.date, mFontSizes.getMessageListDate());
+
// 1 preview line is needed even if it is set to 0, because subject is part of the same text view
holder.preview.setLines(Math.max(mPreviewLines,1));
- holder.preview.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListPreview());
+ mFontSizes.setViewTextSize(holder.preview, mFontSizes.getMessageListPreview());
holder.threadCount = (TextView) view.findViewById(R.id.thread_count);
holder.selected = (CheckBox) view.findViewById(R.id.selected_checkbox);
diff --git a/src/com/fsck/k9/preferences/GlobalSettings.java b/src/com/fsck/k9/preferences/GlobalSettings.java
index ac1f07450..6b4403414 100644
--- a/src/com/fsck/k9/preferences/GlobalSettings.java
+++ b/src/com/fsck/k9/preferences/GlobalSettings.java
@@ -73,55 +73,55 @@ public class GlobalSettings {
new V(1, new BooleanSetting(false))
));
s.put("fontSizeAccountDescription", Settings.versions(
- new V(1, new FontSizeSetting(FontSizes.SMALL))
+ new V(1, new FontSizeSetting(FontSizes.FONT_DEFAULT))
));
s.put("fontSizeAccountName", Settings.versions(
- new V(1, new FontSizeSetting(FontSizes.MEDIUM))
+ new V(1, new FontSizeSetting(FontSizes.FONT_DEFAULT))
));
s.put("fontSizeFolderName", Settings.versions(
- new V(1, new FontSizeSetting(FontSizes.LARGE))
+ new V(1, new FontSizeSetting(FontSizes.FONT_DEFAULT))
));
s.put("fontSizeFolderStatus", Settings.versions(
- new V(1, new FontSizeSetting(FontSizes.SMALL))
+ new V(1, new FontSizeSetting(FontSizes.FONT_DEFAULT))
));
s.put("fontSizeMessageComposeInput", Settings.versions(
- new V(5, new FontSizeSetting(FontSizes.MEDIUM))
+ new V(5, new FontSizeSetting(FontSizes.FONT_DEFAULT))
));
s.put("fontSizeMessageListDate", Settings.versions(
- new V(1, new FontSizeSetting(FontSizes.SMALL))
+ new V(1, new FontSizeSetting(FontSizes.FONT_DEFAULT))
));
s.put("fontSizeMessageListPreview", Settings.versions(
- new V(1, new FontSizeSetting(FontSizes.SMALL))
+ new V(1, new FontSizeSetting(FontSizes.FONT_DEFAULT))
));
s.put("fontSizeMessageListSender", Settings.versions(
- new V(1, new FontSizeSetting(FontSizes.SMALL))
+ new V(1, new FontSizeSetting(FontSizes.FONT_DEFAULT))
));
s.put("fontSizeMessageListSubject", Settings.versions(
- new V(1, new FontSizeSetting(FontSizes.FONT_16SP))
+ new V(1, new FontSizeSetting(FontSizes.FONT_DEFAULT))
));
s.put("fontSizeMessageViewAdditionalHeaders", Settings.versions(
- new V(1, new FontSizeSetting(FontSizes.FONT_12SP))
+ new V(1, new FontSizeSetting(FontSizes.FONT_DEFAULT))
));
s.put("fontSizeMessageViewCC", Settings.versions(
- new V(1, new FontSizeSetting(FontSizes.FONT_12SP))
+ new V(1, new FontSizeSetting(FontSizes.FONT_DEFAULT))
));
s.put("fontSizeMessageViewContent", Settings.versions(
new V(1, new WebFontSizeSetting(3))
));
s.put("fontSizeMessageViewDate", Settings.versions(
- new V(1, new FontSizeSetting(FontSizes.FONT_10SP))
+ new V(1, new FontSizeSetting(FontSizes.FONT_DEFAULT))
));
s.put("fontSizeMessageViewSender", Settings.versions(
- new V(1, new FontSizeSetting(FontSizes.SMALL))
+ new V(1, new FontSizeSetting(FontSizes.FONT_DEFAULT))
));
s.put("fontSizeMessageViewSubject", Settings.versions(
- new V(1, new FontSizeSetting(FontSizes.FONT_12SP))
+ new V(1, new FontSizeSetting(FontSizes.FONT_DEFAULT))
));
s.put("fontSizeMessageViewTime", Settings.versions(
- new V(1, new FontSizeSetting(FontSizes.FONT_10SP))
+ new V(1, new FontSizeSetting(FontSizes.FONT_DEFAULT))
));
s.put("fontSizeMessageViewTo", Settings.versions(
- new V(1, new FontSizeSetting(FontSizes.FONT_12SP))
+ new V(1, new FontSizeSetting(FontSizes.FONT_DEFAULT))
));
s.put("gesturesEnabled", Settings.versions(
new V(1, new BooleanSetting(true)),
diff --git a/src/com/fsck/k9/view/MessageHeader.java b/src/com/fsck/k9/view/MessageHeader.java
index c0bd45db9..e56a593cd 100644
--- a/src/com/fsck/k9/view/MessageHeader.java
+++ b/src/com/fsck/k9/view/MessageHeader.java
@@ -100,14 +100,14 @@ public class MessageHeader extends ScrollView implements OnClickListener {
mFlagged = (CheckBox) findViewById(R.id.flagged);
defaultSubjectColor = mSubjectView.getCurrentTextColor();
- mSubjectView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewSubject());
- mTimeView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewTime());
- mDateView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewDate());
- mAdditionalHeadersView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewAdditionalHeaders());
+ mFontSizes.setViewTextSize(mSubjectView, mFontSizes.getMessageViewSubject());
+ mFontSizes.setViewTextSize(mTimeView, mFontSizes.getMessageViewTime());
+ mFontSizes.setViewTextSize(mDateView, mFontSizes.getMessageViewDate());
+ mFontSizes.setViewTextSize(mAdditionalHeadersView, mFontSizes.getMessageViewAdditionalHeaders());
- mFromView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewSender());
- mToView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewTo());
- mCcView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewCC());
+ mFontSizes.setViewTextSize(mFromView, mFontSizes.getMessageViewSender());
+ mFontSizes.setViewTextSize(mToView, mFontSizes.getMessageViewTo());
+ mFontSizes.setViewTextSize(mCcView, mFontSizes.getMessageViewCC());
mFromView.setOnClickListener(this);
mToView.setOnClickListener(this);