mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-02 00:25:10 -04: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";
|
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_10SP = 10;
|
||||||
public static final int FONT_12DIP = 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
|
||||||
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 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
|
public static final int LARGE = 22; // ?android:attr/textAppearanceLarge
|
||||||
|
|
||||||
|
|
||||||
@ -139,18 +139,18 @@ public class FontSizes {
|
|||||||
folderName = LARGE;
|
folderName = LARGE;
|
||||||
folderStatus = SMALL;
|
folderStatus = SMALL;
|
||||||
|
|
||||||
messageListSubject = FONT_16DIP;
|
messageListSubject = FONT_16SP;
|
||||||
messageListSender = SMALL;
|
messageListSender = SMALL;
|
||||||
messageListDate = SMALL;
|
messageListDate = SMALL;
|
||||||
messageListPreview = SMALL;
|
messageListPreview = SMALL;
|
||||||
|
|
||||||
messageViewSender = SMALL;
|
messageViewSender = SMALL;
|
||||||
messageViewTo = FONT_12DIP;
|
messageViewTo = FONT_12SP;
|
||||||
messageViewCC = FONT_12DIP;
|
messageViewCC = FONT_12SP;
|
||||||
messageViewAdditionalHeaders = FONT_12DIP;
|
messageViewAdditionalHeaders = FONT_12SP;
|
||||||
messageViewSubject = FONT_12DIP;
|
messageViewSubject = FONT_12SP;
|
||||||
messageViewTime = FONT_10DIP;
|
messageViewTime = FONT_10SP;
|
||||||
messageViewDate = FONT_10DIP;
|
messageViewDate = FONT_10SP;
|
||||||
|
|
||||||
messageComposeInput = MEDIUM;
|
messageComposeInput = MEDIUM;
|
||||||
}
|
}
|
||||||
|
@ -1645,8 +1645,8 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
holder.description.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getAccountName());
|
holder.description.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getAccountName());
|
||||||
holder.email.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getAccountDescription());
|
holder.email.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getAccountDescription());
|
||||||
|
|
||||||
if (K9.useCompactLayouts()) {
|
if (K9.useCompactLayouts()) {
|
||||||
holder.accountsItemLayout.setMinimumHeight(0);
|
holder.accountsItemLayout.setMinimumHeight(0);
|
||||||
|
@ -176,7 +176,7 @@ public class ChooseAccount extends K9ExpandableListActivity {
|
|||||||
final TextView description = (TextView) v.findViewById(R.id.description);
|
final TextView description = (TextView) v.findViewById(R.id.description);
|
||||||
final Account account = getAccounts()[groupPosition];
|
final Account account = getAccounts()[groupPosition];
|
||||||
description.setText(account.getDescription());
|
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
|
// display unavailable accounts translucent
|
||||||
/*
|
/*
|
||||||
@ -214,8 +214,8 @@ public class ChooseAccount extends K9ExpandableListActivity {
|
|||||||
|
|
||||||
final TextView name = (TextView) v.findViewById(R.id.name);
|
final TextView name = (TextView) v.findViewById(R.id.name);
|
||||||
final TextView description = (TextView) v.findViewById(R.id.description);
|
final TextView description = (TextView) v.findViewById(R.id.description);
|
||||||
name.setTextSize(TypedValue.COMPLEX_UNIT_DIP, K9.getFontSizes().getAccountName());
|
name.setTextSize(TypedValue.COMPLEX_UNIT_SP, K9.getFontSizes().getAccountName());
|
||||||
description.setTextSize(TypedValue.COMPLEX_UNIT_DIP, K9.getFontSizes().getAccountDescription());
|
description.setTextSize(TypedValue.COMPLEX_UNIT_SP, K9.getFontSizes().getAccountDescription());
|
||||||
|
|
||||||
name.setText(identity.getDescription());
|
name.setText(identity.getDescription());
|
||||||
description.setText(String.format("%s <%s>", identity.getName(), identity.getEmail()));
|
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.setBackgroundDrawable(mAccount.generateColorChip().drawable());
|
||||||
holder.chip.getBackground().setAlpha(folder.unreadMessageCount == 0 ? 127 : 255);
|
holder.chip.getBackground().setAlpha(folder.unreadMessageCount == 0 ? 127 : 255);
|
||||||
|
|
||||||
holder.folderName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getFolderName());
|
holder.folderName.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getFolderName());
|
||||||
holder.folderStatus.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getFolderStatus());
|
holder.folderStatus.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getFolderStatus());
|
||||||
|
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
|
@ -113,8 +113,8 @@ public class LauncherShortcuts extends K9ListActivity implements OnItemClickList
|
|||||||
holder.chip.setBackgroundColor(account.getChipColor());
|
holder.chip.setBackgroundColor(account.getChipColor());
|
||||||
holder.chip.getBackground().setAlpha(255);
|
holder.chip.getBackground().setAlpha(255);
|
||||||
|
|
||||||
holder.description.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getAccountName());
|
holder.description.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getAccountName());
|
||||||
holder.email.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getAccountDescription());
|
holder.email.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getAccountDescription());
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
@ -697,13 +697,13 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
|
|
||||||
// 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_DIP, fontSize);
|
mToView.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
|
||||||
mCcView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize);
|
mCcView.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
|
||||||
mBccView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize);
|
mBccView.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
|
||||||
mSubjectView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize);
|
mSubjectView.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
|
||||||
mMessageContentView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize);
|
mMessageContentView.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
|
||||||
mQuotedText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize);
|
mQuotedText.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
|
||||||
mSignatureView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, fontSize);
|
mSignatureView.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2169,15 +2169,15 @@ public class MessageList
|
|||||||
if (holder.selected != null) {
|
if (holder.selected != null) {
|
||||||
holder.selected.setOnCheckedChangeListener(holder);
|
holder.selected.setOnCheckedChangeListener(holder);
|
||||||
}
|
}
|
||||||
holder.subject.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageListSubject());
|
holder.subject.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListSubject());
|
||||||
holder.date.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageListDate());
|
holder.date.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListDate());
|
||||||
|
|
||||||
if (mTouchView) {
|
if (mTouchView) {
|
||||||
holder.preview.setLines(mPreviewLines);
|
holder.preview.setLines(mPreviewLines);
|
||||||
holder.preview.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageListPreview());
|
holder.preview.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListPreview());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
holder.from.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageListSender());
|
holder.from.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageListSender());
|
||||||
}
|
}
|
||||||
|
|
||||||
view.setTag(holder);
|
view.setTag(holder);
|
||||||
|
@ -90,31 +90,31 @@ public class GlobalSettings {
|
|||||||
new V(1, new FontSizeSetting(FontSizes.SMALL))
|
new V(1, new FontSizeSetting(FontSizes.SMALL))
|
||||||
));
|
));
|
||||||
s.put("fontSizeMessageListSubject", Settings.versions(
|
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(
|
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(
|
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(
|
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_10DIP))
|
new V(1, new FontSizeSetting(FontSizes.FONT_10SP))
|
||||||
));
|
));
|
||||||
s.put("fontSizeMessageViewSender", Settings.versions(
|
s.put("fontSizeMessageViewSender", Settings.versions(
|
||||||
new V(1, new FontSizeSetting(FontSizes.SMALL))
|
new V(1, new FontSizeSetting(FontSizes.SMALL))
|
||||||
));
|
));
|
||||||
s.put("fontSizeMessageViewSubject", Settings.versions(
|
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(
|
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(
|
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(
|
s.put("gesturesEnabled", Settings.versions(
|
||||||
new V(1, new BooleanSetting(true)),
|
new V(1, new BooleanSetting(true)),
|
||||||
|
@ -516,12 +516,12 @@ public class Settings {
|
|||||||
super(defaultValue);
|
super(defaultValue);
|
||||||
|
|
||||||
Map<Integer, String> mapping = new HashMap<Integer, String>();
|
Map<Integer, String> mapping = new HashMap<Integer, String>();
|
||||||
mapping.put(FontSizes.FONT_10DIP, "tiniest");
|
mapping.put(FontSizes.FONT_10SP, "tiniest");
|
||||||
mapping.put(FontSizes.FONT_12DIP, "tiny");
|
mapping.put(FontSizes.FONT_12SP, "tiny");
|
||||||
mapping.put(FontSizes.SMALL, "smaller");
|
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.MEDIUM, "medium");
|
||||||
mapping.put(FontSizes.FONT_20DIP, "large");
|
mapping.put(FontSizes.FONT_20SP, "large");
|
||||||
mapping.put(FontSizes.LARGE, "larger");
|
mapping.put(FontSizes.LARGE, "larger");
|
||||||
mMapping = Collections.unmodifiableMap(mapping);
|
mMapping = Collections.unmodifiableMap(mapping);
|
||||||
}
|
}
|
||||||
|
@ -94,18 +94,18 @@ public class MessageHeader extends LinearLayout {
|
|||||||
mFlagged = (CheckBox) findViewById(R.id.flagged);
|
mFlagged = (CheckBox) findViewById(R.id.flagged);
|
||||||
|
|
||||||
defaultSubjectColor = mSubjectView.getCurrentTextColor();
|
defaultSubjectColor = mSubjectView.getCurrentTextColor();
|
||||||
mSubjectView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewSubject());
|
mSubjectView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewSubject());
|
||||||
mTimeView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewTime());
|
mTimeView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewTime());
|
||||||
mDateView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewDate());
|
mDateView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewDate());
|
||||||
mAdditionalHeadersView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewAdditionalHeaders());
|
mAdditionalHeadersView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewAdditionalHeaders());
|
||||||
mAdditionalHeadersView.setVisibility(View.GONE);
|
mAdditionalHeadersView.setVisibility(View.GONE);
|
||||||
mAttachmentIcon.setVisibility(View.GONE);
|
mAttachmentIcon.setVisibility(View.GONE);
|
||||||
mAnsweredIcon.setVisibility(View.GONE);
|
mAnsweredIcon.setVisibility(View.GONE);
|
||||||
mFromView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewSender());
|
mFromView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewSender());
|
||||||
mToView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewTo());
|
mToView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewTo());
|
||||||
mCcView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewCC());
|
mCcView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewCC());
|
||||||
((TextView) findViewById(R.id.to_label)).setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewTo());
|
((TextView) findViewById(R.id.to_label)).setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewTo());
|
||||||
((TextView) findViewById(R.id.cc_label)).setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewCC());
|
((TextView) findViewById(R.id.cc_label)).setTextSize(TypedValue.COMPLEX_UNIT_SP, mFontSizes.getMessageViewCC());
|
||||||
|
|
||||||
setOnClickListener(new OnClickListener() {
|
setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user