mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-24 08:38:51 -05:00
Switch our font sizes to have a "default", which is the size described in the XML.
Unify the text field size setting code. We should put it in a better place
This commit is contained in:
parent
cf988cad7e
commit
c4b941b9b9
@ -537,6 +537,7 @@
|
|||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="font_entries">
|
<string-array name="font_entries">
|
||||||
|
<item>@string/font_size_default</item>
|
||||||
<item>@string/font_size_tiniest</item>
|
<item>@string/font_size_tiniest</item>
|
||||||
<item>@string/font_size_tiny</item>
|
<item>@string/font_size_tiny</item>
|
||||||
<item>@string/font_size_smaller</item>
|
<item>@string/font_size_smaller</item>
|
||||||
@ -547,6 +548,7 @@
|
|||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="font_values">
|
<string-array name="font_values">
|
||||||
|
<item>-1</item>
|
||||||
<item>10</item>
|
<item>10</item>
|
||||||
<item>12</item>
|
<item>12</item>
|
||||||
<item>14</item>
|
<item>14</item>
|
||||||
|
@ -941,6 +941,7 @@ Please submit bug reports, contribute new features and ask questions at
|
|||||||
<string name="font_size_message_compose">Message composition</string>
|
<string name="font_size_message_compose">Message composition</string>
|
||||||
<string name="font_size_message_compose_input">Text input fields</string>
|
<string name="font_size_message_compose_input">Text input fields</string>
|
||||||
|
|
||||||
|
<string name="font_size_default">Default</string>
|
||||||
<string name="font_size_tiniest">Tiniest</string>
|
<string name="font_size_tiniest">Tiniest</string>
|
||||||
<string name="font_size_tiny">Tiny</string>
|
<string name="font_size_tiny">Tiny</string>
|
||||||
<string name="font_size_smaller">Smaller</string>
|
<string name="font_size_smaller">Smaller</string>
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package com.fsck.k9;
|
package com.fsck.k9;
|
||||||
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.webkit.WebSettings.TextSize;
|
import android.webkit.WebSettings.TextSize;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manage font size of the information displayed in the account list, folder
|
* 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)
|
* 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_10SP = 10;
|
||||||
public static final int FONT_12SP = 12;
|
public static final int FONT_12SP = 12;
|
||||||
public static final int SMALL = 14; // ?android:attr/textAppearanceSmall
|
public static final int SMALL = 14; // ?android:attr/textAppearanceSmall
|
||||||
@ -133,24 +136,24 @@ public class FontSizes {
|
|||||||
* Create a <code>FontSizes</code> object with default values.
|
* Create a <code>FontSizes</code> object with default values.
|
||||||
*/
|
*/
|
||||||
public FontSizes() {
|
public FontSizes() {
|
||||||
accountName = MEDIUM;
|
accountName = FONT_DEFAULT;
|
||||||
accountDescription = SMALL;
|
accountDescription = FONT_DEFAULT;
|
||||||
|
|
||||||
folderName = MEDIUM;
|
folderName = FONT_DEFAULT;
|
||||||
folderStatus = SMALL;
|
folderStatus = FONT_DEFAULT;
|
||||||
|
|
||||||
messageListSubject = FONT_16SP;
|
messageListSubject = FONT_DEFAULT;
|
||||||
messageListSender = SMALL;
|
messageListSender = FONT_DEFAULT;
|
||||||
messageListDate = SMALL;
|
messageListDate = FONT_DEFAULT;
|
||||||
messageListPreview = SMALL;
|
messageListPreview = FONT_DEFAULT;
|
||||||
|
|
||||||
messageViewSender = SMALL;
|
messageViewSender = FONT_DEFAULT;
|
||||||
messageViewTo = FONT_12SP;
|
messageViewTo = FONT_DEFAULT;
|
||||||
messageViewCC = FONT_12SP;
|
messageViewCC = FONT_DEFAULT;
|
||||||
messageViewAdditionalHeaders = FONT_12SP;
|
messageViewAdditionalHeaders = FONT_DEFAULT;
|
||||||
messageViewSubject = FONT_12SP;
|
messageViewSubject = FONT_DEFAULT;
|
||||||
messageViewTime = FONT_10SP;
|
messageViewTime = FONT_DEFAULT;
|
||||||
messageViewDate = FONT_10SP;
|
messageViewDate = FONT_DEFAULT;
|
||||||
|
|
||||||
messageComposeInput = MEDIUM;
|
messageComposeInput = MEDIUM;
|
||||||
}
|
}
|
||||||
@ -380,4 +383,12 @@ public class FontSizes {
|
|||||||
public void setMessageComposeInput(int messageComposeInput) {
|
public void setMessageComposeInput(int messageComposeInput) {
|
||||||
this.messageComposeInput = 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -154,10 +154,9 @@ public abstract class AccountList extends K9ListActivity implements OnItemClickL
|
|||||||
|
|
||||||
holder.chip.getBackground().setAlpha(255);
|
holder.chip.getBackground().setAlpha(255);
|
||||||
|
|
||||||
holder.description.setTextSize(TypedValue.COMPLEX_UNIT_SP,
|
mFontSizes.setViewTextSize(holder.description, mFontSizes.getAccountName());
|
||||||
mFontSizes.getAccountName());
|
mFontSizes.setViewTextSize(holder.email, mFontSizes.getAccountDescription());
|
||||||
holder.email.setTextSize(TypedValue.COMPLEX_UNIT_SP,
|
|
||||||
mFontSizes.getAccountDescription());
|
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
if (account instanceof SearchAccount) {
|
||||||
holder.folders.setVisibility(View.GONE);
|
holder.folders.setVisibility(View.GONE);
|
||||||
|
@ -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.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()) {
|
if (K9.wrapFolderNames()) {
|
||||||
holder.folderName.setEllipsize(null);
|
holder.folderName.setEllipsize(null);
|
||||||
holder.folderName.setSingleLine(false);
|
holder.folderName.setSingleLine(false);
|
||||||
@ -1112,7 +1114,7 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
|
|||||||
holder.folderName.setEllipsize(TruncateAt.START);
|
holder.folderName.setEllipsize(TruncateAt.START);
|
||||||
holder.folderName.setSingleLine(true);
|
holder.folderName.setSingleLine(true);
|
||||||
}
|
}
|
||||||
holder.folderStatus.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getFolderStatus());
|
mFontSizes.setViewTextSize(holder.folderStatus, mFontSizes.getFolderStatus());
|
||||||
|
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
|
@ -850,13 +850,14 @@ public class MessageCompose extends K9Activity implements OnClickListener {
|
|||||||
|
|
||||||
// Set font size of input controls
|
// Set font size of input controls
|
||||||
int fontSize = mFontSizes.getMessageComposeInput();
|
int fontSize = mFontSizes.getMessageComposeInput();
|
||||||
mToView.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
|
mFontSizes.setViewTextSize(mToView, fontSize);
|
||||||
mCcView.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
|
mFontSizes.setViewTextSize(mCcView, fontSize);
|
||||||
mBccView.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
|
mFontSizes.setViewTextSize(mBccView, fontSize);
|
||||||
mSubjectView.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
|
mFontSizes.setViewTextSize(mSubjectView, fontSize);
|
||||||
mMessageContentView.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
|
mFontSizes.setViewTextSize(mMessageContentView, fontSize);
|
||||||
mQuotedText.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
|
mFontSizes.setViewTextSize(mQuotedText, fontSize);
|
||||||
mSignatureView.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
|
mFontSizes.setViewTextSize(mSignatureView, fontSize);
|
||||||
|
|
||||||
|
|
||||||
updateMessageFormat();
|
updateMessageFormat();
|
||||||
|
|
||||||
|
@ -1746,17 +1746,20 @@ public class MessageListFragment extends SherlockFragment implements OnItemClick
|
|||||||
|
|
||||||
if (mSenderAboveSubject) {
|
if (mSenderAboveSubject) {
|
||||||
holder.from = (TextView) view.findViewById(R.id.subject);
|
holder.from = (TextView) view.findViewById(R.id.subject);
|
||||||
holder.from.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListSender());
|
mFontSizes.setViewTextSize(holder.from, mFontSizes.getMessageListSender());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
holder.subject = (TextView) view.findViewById(R.id.subject);
|
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
|
// 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.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.threadCount = (TextView) view.findViewById(R.id.thread_count);
|
||||||
|
|
||||||
holder.selected = (CheckBox) view.findViewById(R.id.selected_checkbox);
|
holder.selected = (CheckBox) view.findViewById(R.id.selected_checkbox);
|
||||||
|
@ -73,55 +73,55 @@ public class GlobalSettings {
|
|||||||
new V(1, new BooleanSetting(false))
|
new V(1, new BooleanSetting(false))
|
||||||
));
|
));
|
||||||
s.put("fontSizeAccountDescription", Settings.versions(
|
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(
|
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(
|
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(
|
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(
|
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(
|
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(
|
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(
|
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(
|
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(
|
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(
|
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(
|
s.put("fontSizeMessageViewContent", Settings.versions(
|
||||||
new V(1, new WebFontSizeSetting(3))
|
new V(1, new WebFontSizeSetting(3))
|
||||||
));
|
));
|
||||||
s.put("fontSizeMessageViewDate", Settings.versions(
|
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(
|
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(
|
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(
|
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(
|
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(
|
s.put("gesturesEnabled", Settings.versions(
|
||||||
new V(1, new BooleanSetting(true)),
|
new V(1, new BooleanSetting(true)),
|
||||||
|
@ -100,14 +100,14 @@ public class MessageHeader extends ScrollView implements OnClickListener {
|
|||||||
mFlagged = (CheckBox) findViewById(R.id.flagged);
|
mFlagged = (CheckBox) findViewById(R.id.flagged);
|
||||||
|
|
||||||
defaultSubjectColor = mSubjectView.getCurrentTextColor();
|
defaultSubjectColor = mSubjectView.getCurrentTextColor();
|
||||||
mSubjectView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewSubject());
|
mFontSizes.setViewTextSize(mSubjectView, mFontSizes.getMessageViewSubject());
|
||||||
mTimeView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewTime());
|
mFontSizes.setViewTextSize(mTimeView, mFontSizes.getMessageViewTime());
|
||||||
mDateView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewDate());
|
mFontSizes.setViewTextSize(mDateView, mFontSizes.getMessageViewDate());
|
||||||
mAdditionalHeadersView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewAdditionalHeaders());
|
mFontSizes.setViewTextSize(mAdditionalHeadersView, mFontSizes.getMessageViewAdditionalHeaders());
|
||||||
|
|
||||||
mFromView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewSender());
|
mFontSizes.setViewTextSize(mFromView, mFontSizes.getMessageViewSender());
|
||||||
mToView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewTo());
|
mFontSizes.setViewTextSize(mToView, mFontSizes.getMessageViewTo());
|
||||||
mCcView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewCC());
|
mFontSizes.setViewTextSize(mCcView, mFontSizes.getMessageViewCC());
|
||||||
|
|
||||||
mFromView.setOnClickListener(this);
|
mFromView.setOnClickListener(this);
|
||||||
mToView.setOnClickListener(this);
|
mToView.setOnClickListener(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user