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

Extracted methods for easier reading

This commit is contained in:
cketti 2012-05-20 03:23:20 +02:00
parent 01c8e84396
commit 71b3b2916e

View File

@ -2284,11 +2284,44 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
/**
* Pull out the parts of the now loaded source message and apply them to the new message
* depending on the type of message being composed.
* @param message Source message
*
* @param message
* The source message used to populate the various text fields.
*/
private void processSourceMessage(Message message) {
try {
if (mAction == Action.REPLY || mAction == Action.REPLY_ALL) {
switch (mAction) {
case REPLY:
case REPLY_ALL: {
processMessageToReplyTo(message);
break;
}
case FORWARD: {
processMessageToForward(message);
break;
}
case EDIT_DRAFT: {
processDraftMessage(message);
break;
}
default: {
Log.w(K9.LOG_TAG, "processSourceMessage() called with unsupported action");
break;
}
}
} catch (MessagingException me) {
/**
* Let the user continue composing their message even if we have a problem processing
* the source message. Log it as an error, though.
*/
Log.e(K9.LOG_TAG, "Error while processing source message: ", me);
} finally {
mSourceMessageProcessed = true;
mDraftNeedsSaving = false;
}
}
private void processMessageToReplyTo(Message message) throws MessagingException {
if (message.getSubject() != null) {
final String subject = PREFIX.matcher(message.getSubject()).replaceFirst("");
@ -2395,7 +2428,9 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
mCcWrapper.setVisibility(View.VISIBLE);
}
}
} else if (mAction == Action.FORWARD) {
}
private void processMessageToForward(Message message) throws MessagingException {
String subject = message.getSubject();
if (subject != null && !subject.toLowerCase(Locale.US).startsWith("fwd:")) {
mSubjectView.setText("Fwd: " + subject);
@ -2412,7 +2447,9 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
mHandler.sendEmptyMessage(MSG_SKIPPED_ATTACHMENTS);
}
}
} else if (mAction == Action.EDIT_DRAFT) {
}
private void processDraftMessage(Message message) throws MessagingException {
String showQuotedTextMode = "NONE";
mDraftId = MessagingController.getInstance(getApplication()).getId(message);
@ -2601,17 +2638,6 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
showOrHideQuotedText(QuotedTextMode.valueOf(showQuotedTextMode));
}
} catch (MessagingException me) {
/**
* Let the user continue composing their message even if we have a problem processing
* the source message. Log it as an error, though.
*/
Log.e(K9.LOG_TAG, "Error while processing source message: ", me);
} finally {
mSourceMessageProcessed = true;
mDraftNeedsSaving = false;
}
}
/*
* Pull out the parts of the now loaded source message and apply them to the new message