mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-30 05:02:26 -05:00
Code style
No functional changes
This commit is contained in:
parent
3a02bfb0a9
commit
a9cfa9ae68
@ -562,8 +562,9 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
mMessageReference = intent.getParcelableExtra(EXTRA_MESSAGE_REFERENCE);
|
||||
mSourceMessageBody = intent.getStringExtra(EXTRA_MESSAGE_BODY);
|
||||
|
||||
if (K9.DEBUG && mSourceMessageBody != null)
|
||||
if (K9.DEBUG && mSourceMessageBody != null) {
|
||||
Log.d(K9.LOG_TAG, "Composing message with explicitly specified message body.");
|
||||
}
|
||||
|
||||
final String accountUuid = (mMessageReference != null) ?
|
||||
mMessageReference.accountUuid :
|
||||
@ -1390,16 +1391,14 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
textBodyBuilder.setAppendSignature(true);
|
||||
textBodyBuilder.setSignature(mSignatureView.getCharacters());
|
||||
textBodyBuilder.setSignatureBeforeQuotedText(mAccount.isSignatureBeforeQuotedText());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
textBodyBuilder.setAppendSignature(false);
|
||||
}
|
||||
|
||||
TextBody body;
|
||||
if (messageFormat == SimpleMessageFormat.HTML) {
|
||||
body = textBodyBuilder.buildTextHtml();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
body = textBodyBuilder.buildTextPlain();
|
||||
}
|
||||
return body;
|
||||
@ -1686,8 +1685,9 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
private Map<IdentityField, String> parseIdentityHeader(final String identityString) {
|
||||
Map<IdentityField, String> identity = new HashMap<IdentityField, String>();
|
||||
|
||||
if (K9.DEBUG)
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Decoding identity: " + identityString);
|
||||
}
|
||||
|
||||
if (identityString == null || identityString.length() < 1) {
|
||||
return identity;
|
||||
@ -1705,8 +1705,9 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
}
|
||||
}
|
||||
|
||||
if (K9.DEBUG)
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Decoded identity: " + identity.toString());
|
||||
}
|
||||
|
||||
// Sanity check our Integers so that recipients of this result don't have to.
|
||||
for (IdentityField key : IdentityField.getIntegerFields()) {
|
||||
@ -1721,8 +1722,9 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
} else {
|
||||
// Legacy identity
|
||||
|
||||
if (K9.DEBUG)
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Got a saved legacy identity: " + identityString);
|
||||
}
|
||||
StringTokenizer tokenizer = new StringTokenizer(identityString, ":", false);
|
||||
|
||||
// First item is the body length. We use this to separate the composed reply from the quoted text.
|
||||
@ -1884,8 +1886,9 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
sendMessage();
|
||||
|
||||
if (mMessageReference != null && mMessageReference.flag != null) {
|
||||
if (K9.DEBUG)
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Setting referenced message (" + mMessageReference.folderName + ", " + mMessageReference.uid + ") flag to " + mMessageReference.flag);
|
||||
}
|
||||
|
||||
final Account account = Preferences.getPreferences(this).getAccount(mMessageReference.accountUuid);
|
||||
final String folderName = mMessageReference.folderName;
|
||||
@ -1945,8 +1948,8 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
final String output = os.toString("UTF-8");
|
||||
|
||||
if (K9.DEBUG)
|
||||
Log.d(OpenPgpApi.TAG, "result: " + os.toByteArray().length
|
||||
+ " str=" + output);
|
||||
Log.d(OpenPgpApi.TAG, "result: " + os.toByteArray().length +
|
||||
" str=" + output);
|
||||
|
||||
mPgpData.setEncryptedData(output);
|
||||
onSend();
|
||||
@ -2278,8 +2281,9 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
return;
|
||||
}
|
||||
|
||||
if (resultCode != RESULT_OK)
|
||||
if (resultCode != RESULT_OK) {
|
||||
return;
|
||||
}
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
@ -2889,9 +2893,10 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
}
|
||||
|
||||
} else {
|
||||
if (K9.DEBUG)
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "could not get Message-ID.");
|
||||
}
|
||||
}
|
||||
|
||||
// Quote the message and setup the UI.
|
||||
populateUIWithQuotedMessage(mAccount.isDefaultQuotedTextShown());
|
||||
@ -3283,10 +3288,10 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
List<Integer> start = new ArrayList<Integer>();
|
||||
List<Integer> end = new ArrayList<Integer>();
|
||||
|
||||
while(blockquoteStart.find()) {
|
||||
while (blockquoteStart.find()) {
|
||||
start.add(blockquoteStart.start());
|
||||
}
|
||||
while(blockquoteEnd.find()) {
|
||||
while (blockquoteEnd.find()) {
|
||||
end.add(blockquoteEnd.start());
|
||||
}
|
||||
if (start.size() != end.size()) {
|
||||
@ -3301,8 +3306,8 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
} else {
|
||||
for (int i = 0; i < start.size() - 1; i++) {
|
||||
// within blockquotes.
|
||||
if (end.get(i) < start.get(i+1)) {
|
||||
dashSignatureHtml.region(end.get(i), start.get(i+1));
|
||||
if (end.get(i) < start.get(i + 1)) {
|
||||
dashSignatureHtml.region(end.get(i), start.get(i + 1));
|
||||
if (dashSignatureHtml.find()) {
|
||||
content = content.substring(0, dashSignatureHtml.start());
|
||||
break;
|
||||
@ -3389,30 +3394,34 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
// HTML takes precedence, then text.
|
||||
part = MimeUtility.findFirstPartByMimeType(message, "text/html");
|
||||
if (part != null) {
|
||||
if (K9.DEBUG)
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "getBodyTextFromMessage: HTML requested, HTML found.");
|
||||
}
|
||||
return MimeUtility.getTextFromPart(part);
|
||||
}
|
||||
|
||||
part = MimeUtility.findFirstPartByMimeType(message, "text/plain");
|
||||
if (part != null) {
|
||||
if (K9.DEBUG)
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "getBodyTextFromMessage: HTML requested, text found.");
|
||||
}
|
||||
return HtmlConverter.textToHtml(MimeUtility.getTextFromPart(part));
|
||||
}
|
||||
} else if (format == SimpleMessageFormat.TEXT) {
|
||||
// Text takes precedence, then html.
|
||||
part = MimeUtility.findFirstPartByMimeType(message, "text/plain");
|
||||
if (part != null) {
|
||||
if (K9.DEBUG)
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "getBodyTextFromMessage: Text requested, text found.");
|
||||
}
|
||||
return MimeUtility.getTextFromPart(part);
|
||||
}
|
||||
|
||||
part = MimeUtility.findFirstPartByMimeType(message, "text/html");
|
||||
if (part != null) {
|
||||
if (K9.DEBUG)
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "getBodyTextFromMessage: Text requested, HTML found.");
|
||||
}
|
||||
return HtmlConverter.htmlToText(MimeUtility.getTextFromPart(part));
|
||||
}
|
||||
}
|
||||
@ -3479,8 +3488,9 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
hasBodyTag = true;
|
||||
}
|
||||
|
||||
if (K9.DEBUG)
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Open: hasHtmlTag:" + hasHtmlTag + " hasHeadTag:" + hasHeadTag + " hasBodyTag:" + hasBodyTag);
|
||||
}
|
||||
|
||||
// Given our inspections, let's figure out where to start our content.
|
||||
// This is the ideal case -- there's a BODY tag and we insert ourselves just after it.
|
||||
@ -3531,8 +3541,9 @@ public class MessageCompose extends K9Activity implements OnClickListener,
|
||||
hasBodyEndTag = true;
|
||||
}
|
||||
|
||||
if (K9.DEBUG)
|
||||
if (K9.DEBUG) {
|
||||
Log.d(K9.LOG_TAG, "Close: hasHtmlEndTag:" + hasHtmlEndTag + " hasBodyEndTag:" + hasBodyEndTag);
|
||||
}
|
||||
|
||||
// Now figure out where to put our footer.
|
||||
// This is the ideal case -- there's a BODY tag and we insert ourselves just before it.
|
||||
|
@ -56,7 +56,7 @@ public class TextBodyBuilderTest {
|
||||
public static boolean[] BOOLEANS = { true, false };
|
||||
|
||||
@DataPoints
|
||||
public static QuoteStyle[] QUOTESTYLES = {QuoteStyle.PREFIX, QuoteStyle.HEADER};
|
||||
public static QuoteStyle[] QUOTESTYLES = { QuoteStyle.PREFIX, QuoteStyle.HEADER };
|
||||
|
||||
@Theory
|
||||
public void testBuildTextPlain(boolean includeQuotedText,
|
||||
@ -163,7 +163,8 @@ public class TextBodyBuilderTest {
|
||||
*
|
||||
* @see InsertableHtmlContent#toDebugString()
|
||||
*/
|
||||
public String makeExpectedHtmlContent(String expectedText, String quotedContent, int footerInsertionPoint, boolean isBefore,
|
||||
public String makeExpectedHtmlContent(String expectedText, String quotedContent,
|
||||
int footerInsertionPoint, boolean isBefore,
|
||||
String userContent, String compiledResult) {
|
||||
String expectedHtmlContent = "InsertableHtmlContent{"
|
||||
+ "headerInsertionPoint=0,"
|
||||
|
Loading…
Reference in New Issue
Block a user