mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-10 11:35:11 -05:00
Code cleanup / fixed lots of warnings
This commit is contained in:
parent
45faad041e
commit
4bbc5de1ba
@ -140,7 +140,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
* Currently:
|
* Currently:
|
||||||
* - "Aw:" (german: abbreviation for "Antwort")
|
* - "Aw:" (german: abbreviation for "Antwort")
|
||||||
*/
|
*/
|
||||||
private static final Pattern prefix = Pattern.compile("^AW[:\\s]\\s*", Pattern.CASE_INSENSITIVE);
|
private static final Pattern PREFIX = Pattern.compile("^AW[:\\s]\\s*", Pattern.CASE_INSENSITIVE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The account used for message composition.
|
* The account used for message composition.
|
||||||
@ -226,7 +226,10 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
private boolean mDraftNeedsSaving = false;
|
private boolean mDraftNeedsSaving = false;
|
||||||
private boolean mPreventDraftSaving = false;
|
private boolean mPreventDraftSaving = false;
|
||||||
|
|
||||||
private boolean mIgnoreOnStop = false;
|
/**
|
||||||
|
* If this is {@code true} we don't save the message as a draft in {@link #onPause()}.
|
||||||
|
*/
|
||||||
|
private boolean mIgnoreOnPause = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The database ID of this message's draft. This is used when saving drafts so the message in
|
* The database ID of this message's draft. This is used when saving drafts so the message in
|
||||||
@ -295,11 +298,12 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
* @param account
|
* @param account
|
||||||
*/
|
*/
|
||||||
public static void actionCompose(Context context, Account account) {
|
public static void actionCompose(Context context, Account account) {
|
||||||
if (account == null) {
|
String accountUuid = (account == null) ?
|
||||||
account = Preferences.getPreferences(context).getDefaultAccount();
|
Preferences.getPreferences(context).getDefaultAccount().getUuid() :
|
||||||
}
|
account.getUuid();
|
||||||
|
|
||||||
Intent i = new Intent(context, MessageCompose.class);
|
Intent i = new Intent(context, MessageCompose.class);
|
||||||
i.putExtra(EXTRA_ACCOUNT, account.getUuid());
|
i.putExtra(EXTRA_ACCOUNT, accountUuid);
|
||||||
i.setAction(ACTION_COMPOSE);
|
i.setAction(ACTION_COMPOSE);
|
||||||
context.startActivity(i);
|
context.startActivity(i);
|
||||||
}
|
}
|
||||||
@ -443,26 +447,34 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
});
|
});
|
||||||
|
|
||||||
TextWatcher watcher = new TextWatcher() {
|
TextWatcher watcher = new TextWatcher() {
|
||||||
public void beforeTextChanged(CharSequence s, int start,
|
@Override
|
||||||
int before, int after) { }
|
public void beforeTextChanged(CharSequence s, int start, int before, int after) {
|
||||||
|
/* do nothing */
|
||||||
|
}
|
||||||
|
|
||||||
public void onTextChanged(CharSequence s, int start,
|
@Override
|
||||||
int before, int count) {
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
mDraftNeedsSaving = true;
|
mDraftNeedsSaving = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void afterTextChanged(android.text.Editable s) { }
|
@Override
|
||||||
|
public void afterTextChanged(android.text.Editable s) { /* do nothing */ }
|
||||||
};
|
};
|
||||||
|
|
||||||
// For watching changes to the To:, Cc:, and Bcc: fields for auto-encryption on a matching
|
// For watching changes to the To:, Cc:, and Bcc: fields for auto-encryption on a matching
|
||||||
// address.
|
// address.
|
||||||
TextWatcher recipientWatcher = new TextWatcher() {
|
TextWatcher recipientWatcher = new TextWatcher() {
|
||||||
public void beforeTextChanged(CharSequence s, int start, int before, int after) { }
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int before, int after) {
|
||||||
|
/* do nothing */
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
mDraftNeedsSaving = true;
|
mDraftNeedsSaving = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void afterTextChanged(android.text.Editable s) {
|
public void afterTextChanged(android.text.Editable s) {
|
||||||
final CryptoProvider crypto = mAccount.getCryptoProvider();
|
final CryptoProvider crypto = mAccount.getCryptoProvider();
|
||||||
if (mAutoEncrypt && crypto.isAvailable(getApplicationContext())) {
|
if (mAutoEncrypt && crypto.isAvailable(getApplicationContext())) {
|
||||||
@ -479,16 +491,19 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
};
|
};
|
||||||
|
|
||||||
TextWatcher sigwatcher = new TextWatcher() {
|
TextWatcher sigwatcher = new TextWatcher() {
|
||||||
public void beforeTextChanged(CharSequence s, int start,
|
@Override
|
||||||
int before, int after) { }
|
public void beforeTextChanged(CharSequence s, int start, int before, int after) {
|
||||||
|
/* do nothing */
|
||||||
|
}
|
||||||
|
|
||||||
public void onTextChanged(CharSequence s, int start,
|
@Override
|
||||||
int before, int count) {
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
mDraftNeedsSaving = true;
|
mDraftNeedsSaving = true;
|
||||||
mSignatureChanged = true;
|
mSignatureChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void afterTextChanged(android.text.Editable s) { }
|
@Override
|
||||||
|
public void afterTextChanged(android.text.Editable s) { /* do nothing */ }
|
||||||
};
|
};
|
||||||
|
|
||||||
mToView.addTextChangedListener(recipientWatcher);
|
mToView.addTextChangedListener(recipientWatcher);
|
||||||
@ -854,7 +869,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
mIgnoreOnStop = false;
|
mIgnoreOnPause = false;
|
||||||
MessagingController.getInstance(getApplication()).addListener(mListener);
|
MessagingController.getInstance(getApplication()).addListener(mListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -864,7 +879,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
MessagingController.getInstance(getApplication()).removeListener(mListener);
|
MessagingController.getInstance(getApplication()).removeListener(mListener);
|
||||||
// Save email as draft when activity is changed (go to home screen, call received) or screen locked
|
// Save email as draft when activity is changed (go to home screen, call received) or screen locked
|
||||||
// don't do this if only changing orientations
|
// don't do this if only changing orientations
|
||||||
if (!mIgnoreOnStop && (getChangingConfigurations() & ActivityInfo.CONFIG_ORIENTATION) == 0) {
|
if (!mIgnoreOnPause && (getChangingConfigurations() & ActivityInfo.CONFIG_ORIENTATION) == 0) {
|
||||||
saveIfNeeded();
|
saveIfNeeded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -951,6 +966,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onFocusChange(View view, boolean focused) {
|
public void onFocusChange(View view, boolean focused) {
|
||||||
if (!focused) {
|
if (!focused) {
|
||||||
updateTitle();
|
updateTitle();
|
||||||
@ -1318,9 +1334,13 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the list of IdentityFields that should be integer values. These values are sanity
|
* Get the list of IdentityFields that should be integer values.
|
||||||
* checked for integer-ness during decoding.
|
*
|
||||||
* @return
|
* <p>
|
||||||
|
* These values are sanity checked for integer-ness during decoding.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @return The list of integer {@link IdentityField}s.
|
||||||
*/
|
*/
|
||||||
public static IdentityField[] getIntegerFields() {
|
public static IdentityField[] getIntegerFields() {
|
||||||
return new IdentityField[] { LENGTH, OFFSET, FOOTER_OFFSET, PLAIN_LENGTH, PLAIN_OFFSET };
|
return new IdentityField[] { LENGTH, OFFSET, FOOTER_OFFSET, PLAIN_LENGTH, PLAIN_OFFSET };
|
||||||
@ -1331,19 +1351,6 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
// use that to determine which version we're in.
|
// use that to determine which version we're in.
|
||||||
private static final String IDENTITY_VERSION_1 = "!";
|
private static final String IDENTITY_VERSION_1 = "!";
|
||||||
|
|
||||||
/**
|
|
||||||
* Build the identity header string. This string contains metadata about a draft message to be
|
|
||||||
* used upon loading a draft for composition. This should be generated at the time of saving a
|
|
||||||
* draft.<br>
|
|
||||||
* <br>
|
|
||||||
* This is a URL-encoded key/value pair string. The list of possible values are in {@link IdentityField}.
|
|
||||||
* @param body {@link TextBody} to analyze for body length and offset.
|
|
||||||
* @return Identity string.
|
|
||||||
*/
|
|
||||||
private String buildIdentityHeader(final TextBody body) {
|
|
||||||
return buildIdentityHeader(body, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the identity header string. This string contains metadata about a draft message to be
|
* Build the identity header string. This string contains metadata about a draft message to be
|
||||||
* used upon loading a draft for composition. This should be generated at the time of saving a
|
* used upon loading a draft for composition. This should be generated at the time of saving a
|
||||||
@ -1415,8 +1422,11 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse an identity string. Handles both legacy and new (!) style identities.
|
* Parse an identity string. Handles both legacy and new (!) style identities.
|
||||||
|
*
|
||||||
* @param identityString
|
* @param identityString
|
||||||
* @return
|
* The encoded identity string that was saved in a drafts header.
|
||||||
|
*
|
||||||
|
* @return A map containing the value for each {@link IdentityField} in the identity string.
|
||||||
*/
|
*/
|
||||||
private Map<IdentityField, String> parseIdentityHeader(final String identityString) {
|
private Map<IdentityField, String> parseIdentityHeader(final String identityString) {
|
||||||
Map<IdentityField, String> identity = new HashMap<IdentityField, String>();
|
Map<IdentityField, String> identity = new HashMap<IdentityField, String>();
|
||||||
@ -1487,7 +1497,8 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private String appendSignature(String text) {
|
private String appendSignature(String originalText) {
|
||||||
|
String text = originalText;
|
||||||
if (mIdentity.getSignatureUse()) {
|
if (mIdentity.getSignatureUse()) {
|
||||||
String signature = mSignatureView.getText().toString();
|
String signature = mSignatureView.getText().toString();
|
||||||
|
|
||||||
@ -1660,6 +1671,9 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Kick off a picker for the specified MIME type and let Android take over.
|
* Kick off a picker for the specified MIME type and let Android take over.
|
||||||
|
*
|
||||||
|
* @param mime_type
|
||||||
|
* The MIME type we want our attachment to have.
|
||||||
*/
|
*/
|
||||||
private void onAddAttachment2(final String mime_type) {
|
private void onAddAttachment2(final String mime_type) {
|
||||||
if (mAccount.getCryptoProvider().isAvailable(this)) {
|
if (mAccount.getCryptoProvider().isAvailable(this)) {
|
||||||
@ -1668,7 +1682,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
|
Intent i = new Intent(Intent.ACTION_GET_CONTENT);
|
||||||
i.addCategory(Intent.CATEGORY_OPENABLE);
|
i.addCategory(Intent.CATEGORY_OPENABLE);
|
||||||
i.setType(mime_type);
|
i.setType(mime_type);
|
||||||
mIgnoreOnStop = true;
|
mIgnoreOnPause = true;
|
||||||
startActivityForResult(Intent.createChooser(i, null), ACTIVITY_REQUEST_PICK_ATTACHMENT);
|
startActivityForResult(Intent.createChooser(i, null), ACTIVITY_REQUEST_PICK_ATTACHMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1704,11 +1718,12 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
name = uri.getLastPathSegment();
|
name = uri.getLastPathSegment();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((contentType == null) || (contentType.indexOf('*') != -1)) {
|
String usableContentType = contentType;
|
||||||
contentType = contentResolver.getType(uri);
|
if ((usableContentType == null) || (usableContentType.indexOf('*') != -1)) {
|
||||||
|
usableContentType = contentResolver.getType(uri);
|
||||||
}
|
}
|
||||||
if (contentType == null) {
|
if (usableContentType == null) {
|
||||||
contentType = MimeUtility.getMimeTypeByExtension(name);
|
usableContentType = MimeUtility.getMimeTypeByExtension(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size <= 0) {
|
if (size <= 0) {
|
||||||
@ -1727,7 +1742,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
|
|
||||||
Attachment attachment = new Attachment();
|
Attachment attachment = new Attachment();
|
||||||
attachment.uri = uri;
|
attachment.uri = uri;
|
||||||
attachment.contentType = contentType;
|
attachment.contentType = usableContentType;
|
||||||
attachment.name = name;
|
attachment.name = name;
|
||||||
attachment.size = size;
|
attachment.size = size;
|
||||||
|
|
||||||
@ -1791,7 +1806,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void doLaunchContactPicker(int resultId) {
|
public void doLaunchContactPicker(int resultId) {
|
||||||
mIgnoreOnStop = true;
|
mIgnoreOnPause = true;
|
||||||
startActivityForResult(mContacts.contactPickerIntent(), resultId);
|
startActivityForResult(mContacts.contactPickerIntent(), resultId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1876,6 +1891,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
switch (view.getId()) {
|
switch (view.getId()) {
|
||||||
case R.id.attachment_delete:
|
case R.id.attachment_delete:
|
||||||
@ -1986,7 +2002,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
private void onChooseIdentity() {
|
private void onChooseIdentity() {
|
||||||
// keep things simple: trigger account choice only if there are more
|
// keep things simple: trigger account choice only if there are more
|
||||||
// than 1 account
|
// than 1 account
|
||||||
mIgnoreOnStop = true;
|
mIgnoreOnPause = true;
|
||||||
if (Preferences.getPreferences(this).getAvailableAccounts().size() > 1) {
|
if (Preferences.getPreferences(this).getAvailableAccounts().size() > 1) {
|
||||||
final Intent intent = new Intent(this, ChooseAccount.class);
|
final Intent intent = new Intent(this, ChooseAccount.class);
|
||||||
intent.putExtra(ChooseAccount.EXTRA_ACCOUNT, mAccount.getUuid());
|
intent.putExtra(ChooseAccount.EXTRA_ACCOUNT, mAccount.getUuid());
|
||||||
@ -2057,12 +2073,14 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
.setTitle(R.string.save_or_discard_draft_message_dlg_title)
|
.setTitle(R.string.save_or_discard_draft_message_dlg_title)
|
||||||
.setMessage(R.string.save_or_discard_draft_message_instructions_fmt)
|
.setMessage(R.string.save_or_discard_draft_message_instructions_fmt)
|
||||||
.setPositiveButton(R.string.save_draft_action, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.save_draft_action, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int whichButton) {
|
public void onClick(DialogInterface dialog, int whichButton) {
|
||||||
dismissDialog(DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE);
|
dismissDialog(DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE);
|
||||||
onSave();
|
onSave();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(R.string.discard_action, new DialogInterface.OnClickListener() {
|
.setNegativeButton(R.string.discard_action, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int whichButton) {
|
public void onClick(DialogInterface dialog, int whichButton) {
|
||||||
dismissDialog(DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE);
|
dismissDialog(DIALOG_SAVE_OR_DISCARD_DRAFT_MESSAGE);
|
||||||
onDiscard();
|
onDiscard();
|
||||||
@ -2074,6 +2092,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
.setTitle(R.string.refuse_to_save_draft_marked_encrypted_dlg_title)
|
.setTitle(R.string.refuse_to_save_draft_marked_encrypted_dlg_title)
|
||||||
.setMessage(R.string.refuse_to_save_draft_marked_encrypted_instructions_fmt)
|
.setMessage(R.string.refuse_to_save_draft_marked_encrypted_instructions_fmt)
|
||||||
.setNeutralButton(R.string.okay_action, new DialogInterface.OnClickListener() {
|
.setNeutralButton(R.string.okay_action, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int whichButton) {
|
public void onClick(DialogInterface dialog, int whichButton) {
|
||||||
dismissDialog(DIALOG_REFUSE_TO_SAVE_DRAFT_MARKED_ENCRYPTED);
|
dismissDialog(DIALOG_REFUSE_TO_SAVE_DRAFT_MARKED_ENCRYPTED);
|
||||||
}
|
}
|
||||||
@ -2084,6 +2103,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
.setTitle(R.string.continue_without_public_key_dlg_title)
|
.setTitle(R.string.continue_without_public_key_dlg_title)
|
||||||
.setMessage(R.string.continue_without_public_key_instructions_fmt)
|
.setMessage(R.string.continue_without_public_key_instructions_fmt)
|
||||||
.setPositiveButton(R.string.continue_action, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.continue_action, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int whichButton) {
|
public void onClick(DialogInterface dialog, int whichButton) {
|
||||||
dismissDialog(DIALOG_CONTINUE_WITHOUT_PUBLIC_KEY);
|
dismissDialog(DIALOG_CONTINUE_WITHOUT_PUBLIC_KEY);
|
||||||
mContinueWithoutPublicKey = true;
|
mContinueWithoutPublicKey = true;
|
||||||
@ -2091,6 +2111,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(R.string.back_action, new DialogInterface.OnClickListener() {
|
.setNegativeButton(R.string.back_action, new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int whichButton) {
|
public void onClick(DialogInterface dialog, int whichButton) {
|
||||||
dismissDialog(DIALOG_CONTINUE_WITHOUT_PUBLIC_KEY);
|
dismissDialog(DIALOG_CONTINUE_WITHOUT_PUBLIC_KEY);
|
||||||
mContinueWithoutPublicKey = false;
|
mContinueWithoutPublicKey = false;
|
||||||
@ -2102,7 +2123,18 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if all attachments were able to be attached, otherwise returns false.
|
* Add all attachments of an existing message as if they were added by hand.
|
||||||
|
*
|
||||||
|
* @param part
|
||||||
|
* The message part to check for being an attachment. This method will recurse if it's
|
||||||
|
* a multipart part.
|
||||||
|
* @param depth
|
||||||
|
* The recursion depth. Currently unused.
|
||||||
|
*
|
||||||
|
* @return {@code true} if all attachments were able to be attached, {@code false} otherwise.
|
||||||
|
*
|
||||||
|
* @throws MessagingException
|
||||||
|
* In case of an error
|
||||||
*/
|
*/
|
||||||
private boolean loadAttachments(Part part, int depth) throws MessagingException {
|
private boolean loadAttachments(Part part, int depth) throws MessagingException {
|
||||||
if (part.getBody() instanceof Multipart) {
|
if (part.getBody() instanceof Multipart) {
|
||||||
@ -2114,7 +2146,8 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
String contentType = MimeUtility.unfoldAndDecode(part.getContentType());
|
String contentType = MimeUtility.unfoldAndDecode(part.getContentType());
|
||||||
String name = MimeUtility.getHeaderParameter(contentType, "name");
|
String name = MimeUtility.getHeaderParameter(contentType, "name");
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
@ -2122,6 +2155,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
if (body != null && body instanceof LocalAttachmentBody) {
|
if (body != null && body instanceof LocalAttachmentBody) {
|
||||||
final Uri uri = ((LocalAttachmentBody) body).getContentUri();
|
final Uri uri = ((LocalAttachmentBody) body).getContentUri();
|
||||||
mHandler.post(new Runnable() {
|
mHandler.post(new Runnable() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
addAttachment(uri);
|
addAttachment(uri);
|
||||||
}
|
}
|
||||||
@ -2132,7 +2166,6 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pull out the parts of the now loaded source message and apply them to the new message
|
* Pull out the parts of the now loaded source message and apply them to the new message
|
||||||
@ -2144,7 +2177,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
try {
|
try {
|
||||||
if (ACTION_REPLY.equals(action) || ACTION_REPLY_ALL.equals(action)) {
|
if (ACTION_REPLY.equals(action) || ACTION_REPLY_ALL.equals(action)) {
|
||||||
if (message.getSubject() != null) {
|
if (message.getSubject() != null) {
|
||||||
final String subject = prefix.matcher(message.getSubject()).replaceFirst("");
|
final String subject = PREFIX.matcher(message.getSubject()).replaceFirst("");
|
||||||
|
|
||||||
if (!subject.toLowerCase(Locale.US).startsWith("re:")) {
|
if (!subject.toLowerCase(Locale.US).startsWith("re:")) {
|
||||||
mSubjectView.setText("Re: " + subject);
|
mSubjectView.setText("Re: " + subject);
|
||||||
@ -2505,9 +2538,13 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Build and populate the UI with the quoted message.
|
* Build and populate the UI with the quoted message.
|
||||||
|
*
|
||||||
|
* @param showQuotedText
|
||||||
|
* {@code true} if the quoted text should be shown, {@code false} otherwise.
|
||||||
|
*
|
||||||
* @throws MessagingException
|
* @throws MessagingException
|
||||||
*/
|
*/
|
||||||
private void populateUIWithQuotedMessage(boolean shown) throws MessagingException {
|
private void populateUIWithQuotedMessage(boolean showQuotedText) throws MessagingException {
|
||||||
if (mMessageFormat == MessageFormat.AUTO) {
|
if (mMessageFormat == MessageFormat.AUTO) {
|
||||||
mMessageFormat = MimeUtility.findFirstPartByMimeType(mSourceMessage, "text/html") == null
|
mMessageFormat = MimeUtility.findFirstPartByMimeType(mSourceMessage, "text/html") == null
|
||||||
? MessageFormat.TEXT
|
? MessageFormat.TEXT
|
||||||
@ -2612,7 +2649,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
mQuotedText.setText(quoteOriginalTextMessage(mSourceMessage, content, mQuoteStyle));
|
mQuotedText.setText(quoteOriginalTextMessage(mSourceMessage, content, mQuoteStyle));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shown) {
|
if (showQuotedText) {
|
||||||
showOrHideQuotedText(QuotedTextMode.SHOW);
|
showOrHideQuotedText(QuotedTextMode.SHOW);
|
||||||
} else {
|
} else {
|
||||||
showOrHideQuotedText(QuotedTextMode.HIDE);
|
showOrHideQuotedText(QuotedTextMode.HIDE);
|
||||||
@ -2820,6 +2857,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
|
|
||||||
mSourceMessage = message;
|
mSourceMessage = message;
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
// We check to see if we've previously processed the source message since this
|
// We check to see if we've previously processed the source message since this
|
||||||
// could be called when switching from HTML to text replies. If that happens, we
|
// could be called when switching from HTML to text replies. If that happens, we
|
||||||
@ -2873,6 +2911,9 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
/**
|
/**
|
||||||
* When we are launched with an intent that includes a mailto: URI, we can actually
|
* When we are launched with an intent that includes a mailto: URI, we can actually
|
||||||
* gather quite a few of our message fields from it.
|
* gather quite a few of our message fields from it.
|
||||||
|
*
|
||||||
|
* @param mailtoUri
|
||||||
|
* The mailto: URI we use to initialize the message fields.
|
||||||
*/
|
*/
|
||||||
private void initializeFromMailto(Uri mailtoUri) {
|
private void initializeFromMailto(Uri mailtoUri) {
|
||||||
String schemaSpecific = mailtoUri.getSchemeSpecificPart();
|
String schemaSpecific = mailtoUri.getSchemeSpecificPart();
|
||||||
|
Loading…
Reference in New Issue
Block a user