From 2c6634e6e7b0cf82b0e756a6a4dbede5844351f7 Mon Sep 17 00:00:00 2001 From: Philip Whitehouse Date: Sat, 5 Aug 2017 20:27:59 +0100 Subject: [PATCH] Show BCC field in message view if present --- .../src/main/java/com/fsck/k9/FontSizes.java | 13 +++++++++ .../k9/activity/setup/FontSizeSettings.java | 6 +++++ .../java/com/fsck/k9/view/MessageHeader.java | 13 ++++++++- .../main/res/layout/message_view_header.xml | 27 +++++++++++++++++++ k9mail/src/main/res/values/strings.xml | 1 + 5 files changed, 59 insertions(+), 1 deletion(-) diff --git a/k9mail/src/main/java/com/fsck/k9/FontSizes.java b/k9mail/src/main/java/com/fsck/k9/FontSizes.java index 810e8f30f..090949bce 100644 --- a/k9mail/src/main/java/com/fsck/k9/FontSizes.java +++ b/k9mail/src/main/java/com/fsck/k9/FontSizes.java @@ -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; } diff --git a/k9mail/src/main/java/com/fsck/k9/activity/setup/FontSizeSettings.java b/k9mail/src/main/java/com/fsck/k9/activity/setup/FontSizeSettings.java index d5a77e925..c688b6bb1 100644 --- a/k9mail/src/main/java/com/fsck/k9/activity/setup/FontSizeSettings.java +++ b/k9mail/src/main/java/com/fsck/k9/activity/setup/FontSizeSettings.java @@ -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())); diff --git a/k9mail/src/main/java/com/fsck/k9/view/MessageHeader.java b/k9mail/src/main/java/com/fsck/k9/view/MessageHeader.java index ce008876e..1dcb8d117 100644 --- a/k9mail/src/main/java/com/fsck/k9/view/MessageHeader.java +++ b/k9mail/src/main/java/com/fsck/k9/view/MessageHeader.java @@ -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)); diff --git a/k9mail/src/main/res/layout/message_view_header.xml b/k9mail/src/main/res/layout/message_view_header.xml index 8d28ff0cc..4446a0984 100644 --- a/k9mail/src/main/res/layout/message_view_header.xml +++ b/k9mail/src/main/res/layout/message_view_header.xml @@ -179,6 +179,33 @@ android:paddingTop="2dp" android:textColor="?android:attr/textColorSecondary" android:textAppearance="@android:style/TextAppearance.Medium" /> + + + + + From: %s <%s> To: Cc: + Bcc: Open Save Unable to save attachment to SD card.