Show BCC field in message view if present

This commit is contained in:
Philip Whitehouse 2017-08-05 20:27:59 +01:00
parent 228441bfd6
commit 2c6634e6e7
5 changed files with 59 additions and 1 deletions

View file

@ -24,6 +24,7 @@ public class FontSizes {
private static final String MESSAGE_VIEW_SENDER = "fontSizeMessageViewSender";
private static final String MESSAGE_VIEW_TO = "fontSizeMessageViewTo";
private static final String MESSAGE_VIEW_CC = "fontSizeMessageViewCC";
private static final String MESSAGE_VIEW_BCC = "fontSizeMessageViewBCC";
private static final String MESSAGE_VIEW_ADDITIONAL_HEADERS = "fontSizeMessageViewAdditionalHeaders";
private static final String MESSAGE_VIEW_SUBJECT = "fontSizeMessageViewSubject";
private static final String MESSAGE_VIEW_DATE = "fontSizeMessageViewDate";
@ -53,6 +54,7 @@ public class FontSizes {
private int messageViewSender;
private int messageViewTo;
private int messageViewCC;
private int messageViewBCC;
private int messageViewAdditionalHeaders;
private int messageViewSubject;
private int messageViewDate;
@ -75,6 +77,7 @@ public class FontSizes {
messageViewSender = FONT_DEFAULT;
messageViewTo = FONT_DEFAULT;
messageViewCC = FONT_DEFAULT;
messageViewBCC = FONT_DEFAULT;
messageViewAdditionalHeaders = FONT_DEFAULT;
messageViewSubject = FONT_DEFAULT;
messageViewDate = FONT_DEFAULT;
@ -98,6 +101,7 @@ public class FontSizes {
editor.putInt(MESSAGE_VIEW_SENDER, messageViewSender);
editor.putInt(MESSAGE_VIEW_TO, messageViewTo);
editor.putInt(MESSAGE_VIEW_CC, messageViewCC);
editor.putInt(MESSAGE_VIEW_BCC, messageViewBCC);
editor.putInt(MESSAGE_VIEW_ADDITIONAL_HEADERS, messageViewAdditionalHeaders);
editor.putInt(MESSAGE_VIEW_SUBJECT, messageViewSubject);
editor.putInt(MESSAGE_VIEW_DATE, messageViewDate);
@ -121,6 +125,7 @@ public class FontSizes {
messageViewSender = storage.getInt(MESSAGE_VIEW_SENDER, messageViewSender);
messageViewTo = storage.getInt(MESSAGE_VIEW_TO, messageViewTo);
messageViewCC = storage.getInt(MESSAGE_VIEW_CC, messageViewCC);
messageViewBCC = storage.getInt(MESSAGE_VIEW_BCC, messageViewBCC);
messageViewAdditionalHeaders = storage.getInt(MESSAGE_VIEW_ADDITIONAL_HEADERS, messageViewAdditionalHeaders);
messageViewSubject = storage.getInt(MESSAGE_VIEW_SUBJECT, messageViewSubject);
messageViewDate = storage.getInt(MESSAGE_VIEW_DATE, messageViewDate);
@ -228,6 +233,14 @@ public class FontSizes {
this.messageViewCC = messageViewCC;
}
public int getMessageViewBCC() {
return messageViewBCC;
}
public void setMessageViewBCC(int messageViewBCC) {
this.messageViewBCC = messageViewBCC;
}
public int getMessageViewAdditionalHeaders() {
return messageViewAdditionalHeaders;
}

View file

@ -31,6 +31,7 @@ public class FontSizeSettings extends K9PreferenceActivity {
private static final String PREFERENCE_MESSAGE_VIEW_SENDER_FONT = "message_view_sender_font";
private static final String PREFERENCE_MESSAGE_VIEW_TO_FONT = "message_view_to_font";
private static final String PREFERENCE_MESSAGE_VIEW_CC_FONT = "message_view_cc_font";
private static final String PREFERENCE_MESSAGE_VIEW_BCC_FONT = "message_view_bcc_font";
private static final String PREFERENCE_MESSAGE_VIEW_ADDITIONAL_HEADERS_FONT = "message_view_additional_headers_font";
private static final String PREFERENCE_MESSAGE_VIEW_SUBJECT_FONT = "message_view_subject_font";
private static final String PREFERENCE_MESSAGE_VIEW_DATE_FONT = "message_view_date_font";
@ -48,6 +49,7 @@ public class FontSizeSettings extends K9PreferenceActivity {
private ListPreference mMessageViewSender;
private ListPreference mMessageViewTo;
private ListPreference mMessageViewCC;
private ListPreference mMessageViewBCC;
private ListPreference mMessageViewAdditionalHeaders;
private ListPreference mMessageViewSubject;
private ListPreference mMessageViewDate;
@ -110,6 +112,9 @@ public class FontSizeSettings extends K9PreferenceActivity {
mMessageViewCC = setupListPreference(
PREFERENCE_MESSAGE_VIEW_CC_FONT,
Integer.toString(fontSizes.getMessageViewCC()));
mMessageViewBCC = setupListPreference(
PREFERENCE_MESSAGE_VIEW_BCC_FONT,
Integer.toString(fontSizes.getMessageViewBCC()));
mMessageViewAdditionalHeaders = setupListPreference(
PREFERENCE_MESSAGE_VIEW_ADDITIONAL_HEADERS_FONT,
Integer.toString(fontSizes.getMessageViewAdditionalHeaders()));
@ -172,6 +177,7 @@ public class FontSizeSettings extends K9PreferenceActivity {
fontSizes.setMessageViewSender(Integer.parseInt(mMessageViewSender.getValue()));
fontSizes.setMessageViewTo(Integer.parseInt(mMessageViewTo.getValue()));
fontSizes.setMessageViewCC(Integer.parseInt(mMessageViewCC.getValue()));
fontSizes.setMessageViewBCC(Integer.parseInt(mMessageViewBCC.getValue()));
fontSizes.setMessageViewAdditionalHeaders(Integer.parseInt(mMessageViewAdditionalHeaders.getValue()));
fontSizes.setMessageViewSubject(Integer.parseInt(mMessageViewSubject.getValue()));
fontSizes.setMessageViewDate(Integer.parseInt(mMessageViewDate.getValue()));

View file

@ -55,6 +55,8 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo
private TextView mToLabel;
private TextView mCcView;
private TextView mCcLabel;
private TextView mBccView;
private TextView mBccLabel;
private TextView mSubjectView;
private MessageCryptoStatusView mCryptoStatusIcon;
@ -109,6 +111,8 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo
mToLabel = (TextView) findViewById(R.id.to_label);
mCcView = (TextView) findViewById(R.id.cc);
mCcLabel = (TextView) findViewById(R.id.cc_label);
mBccView = (TextView) findViewById(R.id.cc);
mBccLabel = (TextView) findViewById(R.id.cc_label);
mContactBadge = (ContactBadge) findViewById(R.id.contact_badge);
@ -128,14 +132,18 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo
mFontSizes.setViewTextSize(mToLabel, mFontSizes.getMessageViewTo());
mFontSizes.setViewTextSize(mCcView, mFontSizes.getMessageViewCC());
mFontSizes.setViewTextSize(mCcLabel, mFontSizes.getMessageViewCC());
mFontSizes.setViewTextSize(mBccView, mFontSizes.getMessageViewBCC());
mFontSizes.setViewTextSize(mBccLabel, mFontSizes.getMessageViewBCC());
mFromView.setOnClickListener(this);
mToView.setOnClickListener(this);
mCcView.setOnClickListener(this);
mBccView.setOnClickListener(this);
mFromView.setOnLongClickListener(this);
mToView.setOnLongClickListener(this);
mCcView.setOnLongClickListener(this);
mBccView.setOnLongClickListener(this);
mCryptoStatusIcon = (MessageCryptoStatusView) findViewById(R.id.crypto_status_icon);
mCryptoStatusIcon.setOnClickListener(this);
@ -153,7 +161,8 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo
break;
}
case R.id.to:
case R.id.cc: {
case R.id.cc:
case R.id.bcc: {
expand((TextView)view, ((TextView)view).getEllipsize() != null);
layoutChanged();
break;
@ -264,6 +273,7 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo
final CharSequence from = MessageHelper.toFriendly(message.getFrom(), contacts);
final CharSequence to = MessageHelper.toFriendly(message.getRecipients(Message.RecipientType.TO), contacts);
final CharSequence cc = MessageHelper.toFriendly(message.getRecipients(Message.RecipientType.CC), contacts);
final CharSequence bcc = MessageHelper.toFriendly(message.getRecipients(Message.RecipientType.BCC), contacts);
Address[] fromAddrs = message.getFrom();
Address[] toAddrs = message.getRecipients(Message.RecipientType.TO);
@ -336,6 +346,7 @@ public class MessageHeader extends LinearLayout implements OnClickListener, OnLo
updateAddressField(mToView, to, mToLabel);
updateAddressField(mCcView, cc, mCcLabel);
updateAddressField(mBccView, bcc, mBccLabel);
mAnsweredIcon.setVisibility(message.isSet(Flag.ANSWERED) ? View.VISIBLE : View.GONE);
mForwardedIcon.setVisibility(message.isSet(Flag.FORWARDED) ? View.VISIBLE : View.GONE);
mFlagged.setChecked(message.isSet(Flag.FLAGGED));

View file

@ -179,6 +179,33 @@
android:paddingTop="2dp"
android:textColor="?android:attr/textColorSecondary"
android:textAppearance="@android:style/TextAppearance.Medium" />
<!-- BCC -->
<TextView
android:id="@+id/bcc_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/cc_label"
android:layout_alignLeft="@+id/cc_label"
android:layout_alignBaseline="@+id/bcc"
android:paddingTop="2dp"
android:paddingRight="4dp"
android:text="@string/message_view_bcc_label"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
android:textAppearance="@android:style/TextAppearance.Medium" />
<TextView
android:id="@+id/bcc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/bcc_label"
android:layout_below="@+id/cc"
android:maxLines="2"
android:ellipsize="end"
android:paddingTop="2dp"
android:textColor="?android:attr/textColorSecondary"
android:textAppearance="@android:style/TextAppearance.Medium" />
<!-- Date -->
<TextView

View file

@ -282,6 +282,7 @@ Please submit bug reports, contribute new features and ask questions at
<string name="message_view_from_format">From: <xliff:g id="name">%s</xliff:g> &lt;<xliff:g id="email">%s</xliff:g>&gt;</string>
<string name="message_to_label">To:</string>
<string name="message_view_cc_label">Cc:</string>
<string name="message_view_bcc_label">Bcc:</string>
<string name="message_view_attachment_view_action">Open</string>
<string name="message_view_attachment_download_action">Save</string>
<string name="message_view_status_attachment_not_saved">Unable to save attachment to SD card.</string>