mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 19:52:17 -05:00
Changed font size unit from DIP to SP
"Scale-independent Pixels - this is like the dp unit, but it is also scaled by the user's font size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen density and the user's preference." - Android Developer Docs
This commit is contained in:
parent
edf0361aab
commit
8e627834c1
@ -30,14 +30,14 @@ public class FontSizes {
|
||||
private static final String MESSAGE_COMPOSE_INPUT = "fontSizeMessageComposeInput";
|
||||
|
||||
/*
|
||||
* Values for the font sizes in DIP (device independent pixel)
|
||||
* Values for the font sizes in SP (Scale-independent Pixels)
|
||||
*/
|
||||
public static final int FONT_10DIP = 10;
|
||||
public static final int FONT_12DIP = 12;
|
||||
public static final int FONT_10SP = 10;
|
||||
public static final int FONT_12SP = 12;
|
||||
public static final int SMALL = 14; // ?android:attr/textAppearanceSmall
|
||||
public static final int FONT_16DIP = 16;
|
||||
public static final int FONT_16SP = 16;
|
||||
public static final int MEDIUM = 18; // ?android:attr/textAppearanceMedium
|
||||
public static final int FONT_20DIP = 20;
|
||||
public static final int FONT_20SP = 20;
|
||||
public static final int LARGE = 22; // ?android:attr/textAppearanceLarge
|
||||
|
||||
|
||||
@ -139,18 +139,18 @@ public class FontSizes {
|
||||
folderName = LARGE;
|
||||
folderStatus = SMALL;
|
||||
|
||||
messageListSubject = FONT_16DIP;
|
||||
messageListSubject = FONT_16SP;
|
||||
messageListSender = SMALL;
|
||||
messageListDate = SMALL;
|
||||
messageListPreview = SMALL;
|
||||
|
||||
messageViewSender = SMALL;
|
||||
messageViewTo = FONT_12DIP;
|
||||
messageViewCC = FONT_12DIP;
|
||||
messageViewAdditionalHeaders = FONT_12DIP;
|
||||
messageViewSubject = FONT_12DIP;
|
||||
messageViewTime = FONT_10DIP;
|
||||
messageViewDate = FONT_10DIP;
|
||||
messageViewTo = FONT_12SP;
|
||||
messageViewCC = FONT_12SP;
|
||||
messageViewAdditionalHeaders = FONT_12SP;
|
||||
messageViewSubject = FONT_12SP;
|
||||
messageViewTime = FONT_10SP;
|
||||
messageViewDate = FONT_10SP;
|
||||
|
||||
messageComposeInput = MEDIUM;
|
||||
}
|
||||
|
@ -1645,8 +1645,8 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
||||
}
|
||||
|
||||
|
||||
holder.description.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getAccountName());
|
||||
holder.email.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getAccountDescription());
|
||||
holder.description.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getAccountName());
|
||||
holder.email.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getAccountDescription());
|
||||
|
||||
if (K9.useCompactLayouts()) {
|
||||
holder.accountsItemLayout.setMinimumHeight(0);
|
||||
|
@ -176,7 +176,7 @@ public class ChooseAccount extends K9ExpandableListActivity {
|
||||
final TextView description = (TextView) v.findViewById(R.id.description);
|
||||
final Account account = getAccounts()[groupPosition];
|
||||
description.setText(account.getDescription());
|
||||
description.setTextSize(TypedValue.COMPLEX_UNIT_DIP, K9.getFontSizes().getAccountName());
|
||||
description.setTextSize(TypedValue.COMPLEX_UNIT_SP, K9.getFontSizes().getAccountName());
|
||||
|
||||
// display unavailable accounts translucent
|
||||
/*
|
||||
@ -214,8 +214,8 @@ public class ChooseAccount extends K9ExpandableListActivity {
|
||||
|
||||
final TextView name = (TextView) v.findViewById(R.id.name);
|
||||
final TextView description = (TextView) v.findViewById(R.id.description);
|
||||
name.setTextSize(TypedValue.COMPLEX_UNIT_DIP, K9.getFontSizes().getAccountName());
|
||||
description.setTextSize(TypedValue.COMPLEX_UNIT_DIP, K9.getFontSizes().getAccountDescription());
|
||||
name.setTextSize(TypedValue.COMPLEX_UNIT_SP, K9.getFontSizes().getAccountName());
|
||||
description.setTextSize(TypedValue.COMPLEX_UNIT_SP, K9.getFontSizes().getAccountDescription());
|
||||
|
||||
name.setText(identity.getDescription());
|
||||
description.setText(String.format("%s <%s>", identity.getName(), identity.getEmail()));
|
||||
|
@ -1147,8 +1147,8 @@ public class FolderList extends K9ListActivity {
|
||||
holder.chip.setBackgroundDrawable(mAccount.generateColorChip().drawable());
|
||||
holder.chip.getBackground().setAlpha(folder.unreadMessageCount == 0 ? 127 : 255);
|
||||
|
||||
holder.folderName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getFolderName());
|
||||
holder.folderStatus.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getFolderStatus());
|
||||
holder.folderName.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getFolderName());
|
||||
holder.folderStatus.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getFolderStatus());
|
||||
|
||||
|
||||
return view;
|
||||
|
@ -113,8 +113,8 @@ public class LauncherShortcuts extends K9ListActivity implements OnItemClickList
|
||||
holder.chip.setBackgroundColor(account.getChipColor());
|
||||
holder.chip.getBackground().setAlpha(255);
|
||||
|
||||
holder.description.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getAccountName());
|
||||
holder.email.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getAccountDescription());
|
||||
holder.description.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getAccountName());
|
||||
holder.email.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getAccountDescription());
|
||||
|
||||
return view;
|
||||
}
|
||||
|
@ -697,13 +697,13 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
||||
|
||||
// Set font size of input controls
|
||||
int fontSize = mFontSizes.getMessageComposeInput();
|
||||
mToView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize);
|
||||
mCcView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize);
|
||||
mBccView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize);
|
||||
mSubjectView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize);
|
||||
mMessageContentView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize);
|
||||
mQuotedText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize);
|
||||
mSignatureView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize);
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2169,15 +2169,15 @@ public class MessageList
|
||||
if (holder.selected != null) {
|
||||
holder.selected.setOnCheckedChangeListener(holder);
|
||||
}
|
||||
holder.subject.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageListSubject());
|
||||
holder.date.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageListDate());
|
||||
holder.subject.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListSubject());
|
||||
holder.date.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListDate());
|
||||
|
||||
if (mTouchView) {
|
||||
holder.preview.setLines(mPreviewLines);
|
||||
holder.preview.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageListPreview());
|
||||
holder.preview.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListPreview());
|
||||
|
||||
} else {
|
||||
holder.from.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageListSender());
|
||||
holder.from.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListSender());
|
||||
}
|
||||
|
||||
view.setTag(holder);
|
||||
|
@ -90,31 +90,31 @@ public class GlobalSettings {
|
||||
new V(1, new FontSizeSetting(FontSizes.SMALL))
|
||||
));
|
||||
s.put("fontSizeMessageListSubject", Settings.versions(
|
||||
new V(1, new FontSizeSetting(FontSizes.FONT_16DIP))
|
||||
new V(1, new FontSizeSetting(FontSizes.FONT_16SP))
|
||||
));
|
||||
s.put("fontSizeMessageViewAdditionalHeaders", Settings.versions(
|
||||
new V(1, new FontSizeSetting(FontSizes.FONT_12DIP))
|
||||
new V(1, new FontSizeSetting(FontSizes.FONT_12SP))
|
||||
));
|
||||
s.put("fontSizeMessageViewCC", Settings.versions(
|
||||
new V(1, new FontSizeSetting(FontSizes.FONT_12DIP))
|
||||
new V(1, new FontSizeSetting(FontSizes.FONT_12SP))
|
||||
));
|
||||
s.put("fontSizeMessageViewContent", Settings.versions(
|
||||
new V(1, new WebFontSizeSetting(3))
|
||||
));
|
||||
s.put("fontSizeMessageViewDate", Settings.versions(
|
||||
new V(1, new FontSizeSetting(FontSizes.FONT_10DIP))
|
||||
new V(1, new FontSizeSetting(FontSizes.FONT_10SP))
|
||||
));
|
||||
s.put("fontSizeMessageViewSender", Settings.versions(
|
||||
new V(1, new FontSizeSetting(FontSizes.SMALL))
|
||||
));
|
||||
s.put("fontSizeMessageViewSubject", Settings.versions(
|
||||
new V(1, new FontSizeSetting(FontSizes.FONT_12DIP))
|
||||
new V(1, new FontSizeSetting(FontSizes.FONT_12SP))
|
||||
));
|
||||
s.put("fontSizeMessageViewTime", Settings.versions(
|
||||
new V(1, new FontSizeSetting(FontSizes.FONT_10DIP))
|
||||
new V(1, new FontSizeSetting(FontSizes.FONT_10SP))
|
||||
));
|
||||
s.put("fontSizeMessageViewTo", Settings.versions(
|
||||
new V(1, new FontSizeSetting(FontSizes.FONT_12DIP))
|
||||
new V(1, new FontSizeSetting(FontSizes.FONT_12SP))
|
||||
));
|
||||
s.put("gesturesEnabled", Settings.versions(
|
||||
new V(1, new BooleanSetting(true)),
|
||||
|
@ -516,12 +516,12 @@ public class Settings {
|
||||
super(defaultValue);
|
||||
|
||||
Map<Integer, String> mapping = new HashMap<Integer, String>();
|
||||
mapping.put(FontSizes.FONT_10DIP, "tiniest");
|
||||
mapping.put(FontSizes.FONT_12DIP, "tiny");
|
||||
mapping.put(FontSizes.FONT_10SP, "tiniest");
|
||||
mapping.put(FontSizes.FONT_12SP, "tiny");
|
||||
mapping.put(FontSizes.SMALL, "smaller");
|
||||
mapping.put(FontSizes.FONT_16DIP, "small");
|
||||
mapping.put(FontSizes.FONT_16SP, "small");
|
||||
mapping.put(FontSizes.MEDIUM, "medium");
|
||||
mapping.put(FontSizes.FONT_20DIP, "large");
|
||||
mapping.put(FontSizes.FONT_20SP, "large");
|
||||
mapping.put(FontSizes.LARGE, "larger");
|
||||
mMapping = Collections.unmodifiableMap(mapping);
|
||||
}
|
||||
|
@ -94,18 +94,18 @@ public class MessageHeader extends LinearLayout {
|
||||
mFlagged = (CheckBox) findViewById(R.id.flagged);
|
||||
|
||||
defaultSubjectColor = mSubjectView.getCurrentTextColor();
|
||||
mSubjectView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewSubject());
|
||||
mTimeView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewTime());
|
||||
mDateView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewDate());
|
||||
mAdditionalHeadersView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewAdditionalHeaders());
|
||||
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());
|
||||
mAdditionalHeadersView.setVisibility(View.GONE);
|
||||
mAttachmentIcon.setVisibility(View.GONE);
|
||||
mAnsweredIcon.setVisibility(View.GONE);
|
||||
mFromView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewSender());
|
||||
mToView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewTo());
|
||||
mCcView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewCC());
|
||||
((TextView) findViewById(R.id.to_label)).setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewTo());
|
||||
((TextView) findViewById(R.id.cc_label)).setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewCC());
|
||||
mFromView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewSender());
|
||||
mToView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewTo());
|
||||
mCcView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewCC());
|
||||
((TextView) findViewById(R.id.to_label)).setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewTo());
|
||||
((TextView) findViewById(R.id.cc_label)).setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewCC());
|
||||
|
||||
setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user