Merge pull request #2663 from philipwhiuk/bccView

Show BCC field in message view if present
This commit is contained in:
cketti 2017-08-22 20:24:13 +02:00 committed by GitHub
commit b9c0c92e74
8 changed files with 72 additions and 2 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

@ -291,6 +291,9 @@ public class GlobalSettings {
s.put("openPgpSupportSignOnly", Settings.versions(
new V(47, new BooleanSetting(false))
));
s.put("fontSizeMessageViewBCC", Settings.versions(
new V(48, new FontSizeSetting(FontSizes.FONT_DEFAULT))
));
SETTINGS = Collections.unmodifiableMap(s);

View file

@ -36,7 +36,7 @@ public class Settings {
*
* @see SettingsExporter
*/
public static final int VERSION = 47;
public static final int VERSION = 48;
static Map<String, Object> validate(int version, Map<String, TreeMap<Integer, SettingsDescription>> settings,
Map<String, String> importedSettings, boolean useDefaultValues) {

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.bcc);
mBccLabel = (TextView) findViewById(R.id.bcc_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>
@ -902,6 +903,7 @@ Please submit bug reports, contribute new features and ask questions at
<string name="font_size_message_view_sender">Sender</string>
<string name="font_size_message_view_to">To</string>
<string name="font_size_message_view_cc">Cc</string>
<string name="font_size_message_view_bcc">Bcc</string>
<string name="font_size_message_view_additional_headers">Additional headers</string>
<string name="font_size_message_view_subject">Subject</string>
<string name="font_size_message_view_date">Time and date</string>

View file

@ -121,6 +121,14 @@
android:entryValues="@array/font_values"
android:dialogTitle="@string/font_size_message_view_cc" />
<ListPreference
android:persistent="false"
android:key="message_view_bcc_font"
android:title="@string/font_size_message_view_bcc"
android:entries="@array/font_entries"
android:entryValues="@array/font_values"
android:dialogTitle="@string/font_size_message_view_bcc" />
<ListPreference
android:persistent="false"
android:key="message_view_subject_font"