1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -05:00

set signature parameter when it is only necessary

This commit is contained in:
Koji Arai 2014-05-02 09:06:23 +09:00
parent 00fb83e1b3
commit e163fb87e1
2 changed files with 17 additions and 11 deletions

View File

@ -1353,9 +1353,8 @@ public class MessageCompose extends K9Activity implements OnClickListener,
*/
private TextBody buildText(boolean isDraft, SimpleMessageFormat messageFormat) {
String messageText = mMessageContentView.getText().toString();
String signatureText = mIdentity.getSignatureUse() ? mSignatureView.getCharacters() : null;
TextBodyBuilder textBodyBuilder = new TextBodyBuilder(messageText, signatureText);
TextBodyBuilder textBodyBuilder = new TextBodyBuilder(messageText);
/*
* Find out if we need to include the original message as quoted text.
@ -1368,14 +1367,22 @@ public class MessageCompose extends K9Activity implements OnClickListener,
boolean includeQuotedText = (isDraft || mQuotedTextMode == QuotedTextMode.SHOW);
textBodyBuilder.setIncludeQuotedText(includeQuotedText);
textBodyBuilder.setAppendSignature(!isDraft);
textBodyBuilder.setInsertSeparator(!isDraft);
textBodyBuilder.setSignatureBeforeQuotedText(mAccount.isSignatureBeforeQuotedText());
boolean isReplyAfterQuote = (mQuoteStyle == QuoteStyle.PREFIX && mAccount.isReplyAfterQuote());
textBodyBuilder.setReplyAfterQuote(isReplyAfterQuote);
boolean useSignature = (!isDraft && mIdentity.getSignatureUse());
if (useSignature) {
textBodyBuilder.setAppendSignature(true);
textBodyBuilder.setSignature(mSignatureView.getCharacters());
textBodyBuilder.setSignatureBeforeQuotedText(mAccount.isSignatureBeforeQuotedText());
}
else {
textBodyBuilder.setAppendSignature(false);
}
TextBody body;
if (messageFormat == SimpleMessageFormat.HTML) {
body = textBodyBuilder.buildTextHtml(mQuotedHtmlContent);

View File

@ -13,7 +13,6 @@ public class TextBodyBuilder {
private boolean mIncludeQuotedText = true;
private boolean mReplyAfterQuote = false;
private boolean mSignatureBeforeQuotedText = false;
private boolean mInsertSeparator = false;
private boolean mAppendSignature = true;
@ -21,12 +20,8 @@ public class TextBodyBuilder {
private String mMessageContent;
private String mSignature;
public TextBodyBuilder(
String messageContent,
String signature
) {
public TextBodyBuilder(String messageContent) {
mMessageContent = messageContent;
mSignature = signature;
}
/**
@ -220,6 +215,10 @@ public class TextBodyBuilder {
// setter
public void setSignature(String signature) {
mSignature = signature;
}
public void setIncludeQuotedText(boolean includeQuotedText) {
mIncludeQuotedText = includeQuotedText;
}