1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 03:32:16 -05:00

Updating other classes to use new constructor and getters of

MessageReference
This commit is contained in:
Valentin CAULIER 2015-03-16 16:30:28 +01:00
parent bf0333ba31
commit 3e84c20c9b
8 changed files with 70 additions and 89 deletions

View File

@ -71,7 +71,8 @@ public class MessageReferenceTest {
@Test @Test
public void equalsWithAnObjectShouldReturnFalse() { public void equalsWithAnObjectShouldReturnFalse() {
MessageReference messageReference = new MessageReference(); // null : creating a new empty MessageReference
MessageReference messageReference = new MessageReference(null, null, null, null);
Object object = new Object(); Object object = new Object();
assertFalse(messageReference.equals(object)); assertFalse(messageReference.equals(object));
@ -125,21 +126,14 @@ public class MessageReferenceTest {
} }
private MessageReference createMessageReference(String accountUuid, String folderName, String uid) { private MessageReference createMessageReference(String accountUuid, String folderName, String uid) {
MessageReference messageReference = new MessageReference(); MessageReference messageReference = new MessageReference(accountUuid, folderName, uid, null);
messageReference.accountUuid = accountUuid;
messageReference.folderName = folderName;
messageReference.uid = uid;
return messageReference; return messageReference;
} }
private MessageReference createMessageReferenceWithFlag(String accountUuid, String folderName, String uid, private MessageReference createMessageReferenceWithFlag(String accountUuid, String folderName, String uid,
Flag flag) { Flag flag) {
MessageReference messageReference = new MessageReference(); MessageReference messageReference = new MessageReference(accountUuid, folderName, uid, flag);
messageReference.accountUuid = accountUuid;
messageReference.folderName = folderName;
messageReference.uid = uid;
messageReference.flag = flag;
return messageReference; return messageReference;
} }

View File

@ -544,7 +544,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
} }
final String accountUuid = (mMessageReference != null) ? final String accountUuid = (mMessageReference != null) ?
mMessageReference.accountUuid : mMessageReference.getAccountUuid() :
intent.getStringExtra(EXTRA_ACCOUNT); intent.getStringExtra(EXTRA_ACCOUNT);
mAccount = Preferences.getPreferences(this).getAccount(accountUuid); mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
@ -786,9 +786,9 @@ public class MessageCompose extends K9Activity implements OnClickListener,
*/ */
MessagingController.getInstance(getApplication()).addListener(mListener); MessagingController.getInstance(getApplication()).addListener(mListener);
final Account account = Preferences.getPreferences(this).getAccount(mMessageReference.accountUuid); final Account account = Preferences.getPreferences(this).getAccount(mMessageReference.getAccountUuid());
final String folderName = mMessageReference.folderName; final String folderName = mMessageReference.getFolderName();
final String sourceMessageUid = mMessageReference.uid; final String sourceMessageUid = mMessageReference.getUid();
MessagingController.getInstance(getApplication()).loadMessageForView(account, folderName, sourceMessageUid, null); MessagingController.getInstance(getApplication()).loadMessageForView(account, folderName, sourceMessageUid, null);
} }
@ -798,7 +798,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
} }
if (mAction == Action.REPLY || mAction == Action.REPLY_ALL) { if (mAction == Action.REPLY || mAction == Action.REPLY_ALL) {
mMessageReference.flag = Flag.ANSWERED; mMessageReference = mMessageReference.withModifiedFlag(Flag.ANSWERED);
} }
if (mAction == Action.REPLY || mAction == Action.REPLY_ALL || if (mAction == Action.REPLY || mAction == Action.REPLY_ALL ||
@ -811,7 +811,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
} }
if (mAction == Action.FORWARD) { if (mAction == Action.FORWARD) {
mMessageReference.flag = Flag.FORWARDED; mMessageReference = mMessageReference.withModifiedFlag(Flag.FORWARDED);
} }
mEncryptLayout = findViewById(R.id.layout_encrypt); mEncryptLayout = findViewById(R.id.layout_encrypt);
@ -1771,15 +1771,15 @@ public class MessageCompose extends K9Activity implements OnClickListener,
} }
sendMessage(); sendMessage();
if (mMessageReference != null && mMessageReference.flag != null) { if (mMessageReference != null && mMessageReference.getFlag() != null) {
if (K9.DEBUG) { if (K9.DEBUG) {
Log.d(K9.LOG_TAG, "Setting referenced message (" + mMessageReference.folderName + ", " + mMessageReference.uid + ") flag to " + mMessageReference.flag); Log.d(K9.LOG_TAG, "Setting referenced message (" + mMessageReference.getFolderName() + ", " + mMessageReference.getUid() + ") flag to " + mMessageReference.getFlag());
} }
final Account account = Preferences.getPreferences(this).getAccount(mMessageReference.accountUuid); final Account account = Preferences.getPreferences(this).getAccount(mMessageReference.getAccountUuid());
final String folderName = mMessageReference.folderName; final String folderName = mMessageReference.getFolderName();
final String sourceMessageUid = mMessageReference.uid; final String sourceMessageUid = mMessageReference.getUid();
MessagingController.getInstance(getApplication()).setFlag(account, folderName, sourceMessageUid, mMessageReference.flag, true); MessagingController.getInstance(getApplication()).setFlag(account, folderName, sourceMessageUid, mMessageReference.getFlag(), true);
} }
mDraftNeedsSaving = false; mDraftNeedsSaving = false;
@ -2351,9 +2351,9 @@ public class MessageCompose extends K9Activity implements OnClickListener,
if (mMessageReference != null) { // shouldn't happen... if (mMessageReference != null) { // shouldn't happen...
// TODO - Should we check if mSourceMessageBody is already present and bypass the MessagingController call? // TODO - Should we check if mSourceMessageBody is already present and bypass the MessagingController call?
MessagingController.getInstance(getApplication()).addListener(mListener); MessagingController.getInstance(getApplication()).addListener(mListener);
final Account account = Preferences.getPreferences(this).getAccount(mMessageReference.accountUuid); final Account account = Preferences.getPreferences(this).getAccount(mMessageReference.getAccountUuid());
final String folderName = mMessageReference.folderName; final String folderName = mMessageReference.getFolderName();
final String sourceMessageUid = mMessageReference.uid; final String sourceMessageUid = mMessageReference.getUid();
MessagingController.getInstance(getApplication()).loadMessageForView(account, folderName, sourceMessageUid, null); MessagingController.getInstance(getApplication()).loadMessageForView(account, folderName, sourceMessageUid, null);
} }
break; break;
@ -2876,7 +2876,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
// Check if this is a valid account in our database // Check if this is a valid account in our database
Preferences prefs = Preferences.getPreferences(getApplicationContext()); Preferences prefs = Preferences.getPreferences(getApplicationContext());
Account account = prefs.getAccount(messageReference.accountUuid); Account account = prefs.getAccount(messageReference.getAccountUuid());
if (account != null) { if (account != null) {
mMessageReference = messageReference; mMessageReference = messageReference;
} }
@ -3392,7 +3392,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
class Listener extends MessagingListener { class Listener extends MessagingListener {
@Override @Override
public void loadMessageForViewStarted(Account account, String folder, String uid) { public void loadMessageForViewStarted(Account account, String folder, String uid) {
if ((mMessageReference == null) || !mMessageReference.uid.equals(uid)) { if ((mMessageReference == null) || !mMessageReference.getUid().equals(uid)) {
return; return;
} }
@ -3401,7 +3401,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
@Override @Override
public void loadMessageForViewFinished(Account account, String folder, String uid, Message message) { public void loadMessageForViewFinished(Account account, String folder, String uid, Message message) {
if ((mMessageReference == null) || !mMessageReference.uid.equals(uid)) { if ((mMessageReference == null) || !mMessageReference.getUid().equals(uid)) {
return; return;
} }
@ -3410,7 +3410,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
@Override @Override
public void loadMessageForViewBodyAvailable(Account account, String folder, String uid, final Message message) { public void loadMessageForViewBodyAvailable(Account account, String folder, String uid, final Message message) {
if ((mMessageReference == null) || !mMessageReference.uid.equals(uid)) { if ((mMessageReference == null) || !mMessageReference.getUid().equals(uid)) {
return; return;
} }
@ -3441,7 +3441,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
@Override @Override
public void loadMessageForViewFailed(Account account, String folder, String uid, Throwable t) { public void loadMessageForViewFailed(Account account, String folder, String uid, Throwable t) {
if ((mMessageReference == null) || !mMessageReference.uid.equals(uid)) { if ((mMessageReference == null) || !mMessageReference.getUid().equals(uid)) {
return; return;
} }
mHandler.sendEmptyMessage(MSG_PROGRESS_OFF); mHandler.sendEmptyMessage(MSG_PROGRESS_OFF);
@ -3452,13 +3452,13 @@ public class MessageCompose extends K9Activity implements OnClickListener,
public void messageUidChanged(Account account, String folder, String oldUid, String newUid) { public void messageUidChanged(Account account, String folder, String oldUid, String newUid) {
// Track UID changes of the source message // Track UID changes of the source message
if (mMessageReference != null) { if (mMessageReference != null) {
final Account sourceAccount = Preferences.getPreferences(MessageCompose.this).getAccount(mMessageReference.accountUuid); final Account sourceAccount = Preferences.getPreferences(MessageCompose.this).getAccount(mMessageReference.getAccountUuid());
final String sourceFolder = mMessageReference.folderName; final String sourceFolder = mMessageReference.getFolderName();
final String sourceMessageUid = mMessageReference.uid; final String sourceMessageUid = mMessageReference.getUid();
if (account.equals(sourceAccount) && (folder.equals(sourceFolder))) { if (account.equals(sourceAccount) && (folder.equals(sourceFolder))) {
if (oldUid.equals(sourceMessageUid)) { if (oldUid.equals(sourceMessageUid)) {
mMessageReference.uid = newUid; mMessageReference = mMessageReference.withModifiedUid(newUid);
} }
if ((mSourceMessage != null) && (oldUid.equals(mSourceMessage.getUid()))) { if ((mSourceMessage != null) && (oldUid.equals(mSourceMessage.getUid()))) {
mSourceMessage.setUid(newUid); mSourceMessage.setUid(newUid);
@ -3602,7 +3602,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
* to the old message's uid. * to the old message's uid.
*/ */
if (mMessageReference != null) { if (mMessageReference != null) {
message.setUid(mMessageReference.uid); message.setUid(mMessageReference.getUid());
} }
} }

View File

@ -379,10 +379,7 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
Collection<Account> accounts = Preferences.getPreferences(this).getAvailableAccounts(); Collection<Account> accounts = Preferences.getPreferences(this).getAvailableAccounts();
for (Account account : accounts) { for (Account account : accounts) {
if (String.valueOf(account.getAccountNumber()).equals(accountId)) { if (String.valueOf(account.getAccountNumber()).equals(accountId)) {
mMessageReference = new MessageReference(); mMessageReference = new MessageReference(account.getUuid(), segmentList.get(1), segmentList.get(2), null);
mMessageReference.accountUuid = account.getUuid();
mMessageReference.folderName = segmentList.get(1);
mMessageReference.uid = segmentList.get(2);
break; break;
} }
} }
@ -431,8 +428,8 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
if (mMessageReference != null) { if (mMessageReference != null) {
mSearch = new LocalSearch(); mSearch = new LocalSearch();
mSearch.addAccountUuid(mMessageReference.accountUuid); mSearch.addAccountUuid(mMessageReference.getAccountUuid());
mSearch.addAllowedFolder(mMessageReference.folderName); mSearch.addAllowedFolder(mMessageReference.getFolderName());
} }
if (mSearch == null) { if (mSearch == null) {
@ -1168,8 +1165,8 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
@Override @Override
public void openMessage(MessageReference messageReference) { public void openMessage(MessageReference messageReference) {
Preferences prefs = Preferences.getPreferences(getApplicationContext()); Preferences prefs = Preferences.getPreferences(getApplicationContext());
Account account = prefs.getAccount(messageReference.accountUuid); Account account = prefs.getAccount(messageReference.getAccountUuid());
String folderName = messageReference.folderName; String folderName = messageReference.getFolderName();
if (folderName.equals(account.getDraftsFolderName())) { if (folderName.equals(account.getDraftsFolderName())) {
MessageCompose.actionEditDraft(this, messageReference); MessageCompose.actionEditDraft(this, messageReference);

View File

@ -4936,7 +4936,7 @@ public class MessagingController implements Runnable {
String initialFolder = message.getFolder().getName(); String initialFolder = message.getFolder().getName();
/* only go to folder if all messages are in the same folder, else go to folder list */ /* only go to folder if all messages are in the same folder, else go to folder list */
for (MessageReference ref : allRefs) { for (MessageReference ref : allRefs) {
if (!TextUtils.equals(initialFolder, ref.folderName)) { if (!TextUtils.equals(initialFolder, ref.getFolderName())) {
initialFolder = null; initialFolder = null;
break; break;
} }
@ -5008,8 +5008,8 @@ public class MessagingController implements Runnable {
} }
private TaskStackBuilder buildMessageViewBackStack(Context context, MessageReference message) { private TaskStackBuilder buildMessageViewBackStack(Context context, MessageReference message) {
Account account = Preferences.getPreferences(context).getAccount(message.accountUuid); Account account = Preferences.getPreferences(context).getAccount(message.getAccountUuid());
TaskStackBuilder stack = buildMessageListBackStack(context, account, message.folderName); TaskStackBuilder stack = buildMessageListBackStack(context, account, message.getFolderName());
stack.addNextIntent(MessageList.actionDisplayMessageIntent(context, message)); stack.addNextIntent(MessageList.actionDisplayMessageIntent(context, message));
return stack; return stack;
} }

View File

@ -2007,9 +2007,9 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
String uid = cursor.getString(UID_COLUMN); String uid = cursor.getString(UID_COLUMN);
String folderName = cursor.getString(FOLDER_NAME_COLUMN); String folderName = cursor.getString(FOLDER_NAME_COLUMN);
if (account.getUuid().equals(mActiveMessage.accountUuid) && if (account.getUuid().equals(mActiveMessage.getAccountUuid()) &&
folderName.equals(mActiveMessage.folderName) && folderName.equals(mActiveMessage.getFolderName()) &&
uid.equals(mActiveMessage.uid)) { uid.equals(mActiveMessage.getUid())) {
int res = R.attr.messageListActiveItemBackgroundColor; int res = R.attr.messageListActiveItemBackgroundColor;
TypedValue outValue = new TypedValue(); TypedValue outValue = new TypedValue();
@ -2992,11 +2992,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
for (int i = 0, len = mAdapter.getCount(); i < len; i++) { for (int i = 0, len = mAdapter.getCount(); i < len; i++) {
Cursor cursor = (Cursor) mAdapter.getItem(i); Cursor cursor = (Cursor) mAdapter.getItem(i);
MessageReference ref = new MessageReference(); MessageReference ref = new MessageReference(cursor.getString(ACCOUNT_UUID_COLUMN), cursor.getString(FOLDER_NAME_COLUMN), cursor.getString(UID_COLUMN), null);
ref.accountUuid = cursor.getString(ACCOUNT_UUID_COLUMN);
ref.folderName = cursor.getString(FOLDER_NAME_COLUMN);
ref.uid = cursor.getString(UID_COLUMN);
messageRefs.add(ref); messageRefs.add(ref);
} }
@ -3058,10 +3054,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
private MessageReference getReferenceForPosition(int position) { private MessageReference getReferenceForPosition(int position) {
Cursor cursor = (Cursor) mAdapter.getItem(position); Cursor cursor = (Cursor) mAdapter.getItem(position);
MessageReference ref = new MessageReference(); MessageReference ref = new MessageReference(cursor.getString(ACCOUNT_UUID_COLUMN), cursor.getString(FOLDER_NAME_COLUMN), cursor.getString(UID_COLUMN), null);
ref.accountUuid = cursor.getString(ACCOUNT_UUID_COLUMN);
ref.folderName = cursor.getString(FOLDER_NAME_COLUMN);
ref.uid = cursor.getString(UID_COLUMN);
return ref; return ref;
} }
@ -3091,9 +3084,9 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
String folderName = cursor.getString(FOLDER_NAME_COLUMN); String folderName = cursor.getString(FOLDER_NAME_COLUMN);
String uid = cursor.getString(UID_COLUMN); String uid = cursor.getString(UID_COLUMN);
if (accountUuid.equals(messageReference.accountUuid) && if (accountUuid.equals(messageReference.getAccountUuid()) &&
folderName.equals(messageReference.folderName) && folderName.equals(messageReference.getFolderName()) &&
uid.equals(messageReference.uid)) { uid.equals(messageReference.getUid())) {
return i; return i;
} }
} }
@ -3330,12 +3323,12 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
StringBuilder query = new StringBuilder(); StringBuilder query = new StringBuilder();
List<String> queryArgs = new ArrayList<String>(); List<String> queryArgs = new ArrayList<String>();
if (needConditions) { if (needConditions) {
boolean selectActive = mActiveMessage != null && mActiveMessage.accountUuid.equals(accountUuid); boolean selectActive = mActiveMessage != null && mActiveMessage.getAccountUuid().equals(accountUuid);
if (selectActive) { if (selectActive) {
query.append("(" + MessageColumns.UID + " = ? AND " + SpecialColumns.FOLDER_NAME + " = ?) OR ("); query.append("(" + MessageColumns.UID + " = ? AND " + SpecialColumns.FOLDER_NAME + " = ?) OR (");
queryArgs.add(mActiveMessage.uid); queryArgs.add(mActiveMessage.getUid());
queryArgs.add(mActiveMessage.folderName); queryArgs.add(mActiveMessage.getFolderName());
} }
SqlQueryBuilder.buildWhereClause(account, mSearch.getConditions(), query, queryArgs); SqlQueryBuilder.buildWhereClause(account, mSearch.getConditions(), query, queryArgs);

View File

@ -271,7 +271,7 @@ public class MessageViewFragment extends Fragment implements OnClickListener,
} }
Context appContext = getActivity().getApplicationContext(); Context appContext = getActivity().getApplicationContext();
mAccount = Preferences.getPreferences(appContext).getAccount(mMessageReference.accountUuid); mAccount = Preferences.getPreferences(appContext).getAccount(mMessageReference.getAccountUuid());
if (resetPgpData) { if (resetPgpData) {
// start with fresh, empty PGP data // start with fresh, empty PGP data
@ -282,7 +282,7 @@ public class MessageViewFragment extends Fragment implements OnClickListener,
mMessageView.resetView(); mMessageView.resetView();
mMessageView.resetHeaderView(); mMessageView.resetHeaderView();
mController.loadMessageForView(mAccount, mMessageReference.folderName, mMessageReference.uid, mListener); mController.loadMessageForView(mAccount, mMessageReference.getFolderName(), mMessageReference.getUid(), mListener);
mFragmentListener.updateMenu(); mFragmentListener.updateMenu();
} }
@ -340,7 +340,7 @@ public class MessageViewFragment extends Fragment implements OnClickListener,
} }
private void refileMessage(String dstFolder) { private void refileMessage(String dstFolder) {
String srcFolder = mMessageReference.folderName; String srcFolder = mMessageReference.getFolderName();
LocalMessage messageToMove = mMessage; LocalMessage messageToMove = mMessage;
mFragmentListener.showNextMessageOrReturn(); mFragmentListener.showNextMessageOrReturn();
mController.moveMessage(mAccount, srcFolder, messageToMove, dstFolder, null); mController.moveMessage(mAccount, srcFolder, messageToMove, dstFolder, null);
@ -417,7 +417,7 @@ public class MessageViewFragment extends Fragment implements OnClickListener,
private void startRefileActivity(int activity) { private void startRefileActivity(int activity) {
Intent intent = new Intent(getActivity(), ChooseFolder.class); Intent intent = new Intent(getActivity(), ChooseFolder.class);
intent.putExtra(ChooseFolder.EXTRA_ACCOUNT, mAccount.getUuid()); intent.putExtra(ChooseFolder.EXTRA_ACCOUNT, mAccount.getUuid());
intent.putExtra(ChooseFolder.EXTRA_CUR_FOLDER, mMessageReference.folderName); intent.putExtra(ChooseFolder.EXTRA_CUR_FOLDER, mMessageReference.getFolderName());
intent.putExtra(ChooseFolder.EXTRA_SEL_FOLDER, mAccount.getLastSelectedFolderName()); intent.putExtra(ChooseFolder.EXTRA_SEL_FOLDER, mAccount.getLastSelectedFolderName());
intent.putExtra(ChooseFolder.EXTRA_MESSAGE, mMessageReference); intent.putExtra(ChooseFolder.EXTRA_MESSAGE, mMessageReference);
startActivityForResult(intent, activity); startActivityForResult(intent, activity);
@ -493,7 +493,7 @@ public class MessageViewFragment extends Fragment implements OnClickListener,
return; return;
} }
mMessageView.downloadRemainderButton().setEnabled(false); mMessageView.downloadRemainderButton().setEnabled(false);
mController.loadMessageForViewRemote(mAccount, mMessageReference.folderName, mMessageReference.uid, mListener); mController.loadMessageForViewRemote(mAccount, mMessageReference.getFolderName(), mMessageReference.getUid(), mListener);
} }
@Override @Override
@ -516,12 +516,12 @@ public class MessageViewFragment extends Fragment implements OnClickListener,
} }
public void moveMessage(MessageReference reference, String destFolderName) { public void moveMessage(MessageReference reference, String destFolderName) {
mController.moveMessage(mAccount, mMessageReference.folderName, mMessage, mController.moveMessage(mAccount, mMessageReference.getFolderName(), mMessage,
destFolderName, null); destFolderName, null);
} }
public void copyMessage(MessageReference reference, String destFolderName) { public void copyMessage(MessageReference reference, String destFolderName) {
mController.copyMessage(mAccount, mMessageReference.folderName, mMessage, mController.copyMessage(mAccount, mMessageReference.getFolderName(), mMessage,
destFolderName, null); destFolderName, null);
} }
@ -529,8 +529,8 @@ public class MessageViewFragment extends Fragment implements OnClickListener,
@Override @Override
public void loadMessageForViewHeadersAvailable(final Account account, String folder, String uid, public void loadMessageForViewHeadersAvailable(final Account account, String folder, String uid,
final Message message) { final Message message) {
if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder) if (!mMessageReference.getUid().equals(uid) || !mMessageReference.getFolderName().equals(folder)
|| !mMessageReference.accountUuid.equals(account.getUuid())) { || !mMessageReference.getAccountUuid().equals(account.getUuid())) {
return; return;
} }
@ -577,9 +577,9 @@ public class MessageViewFragment extends Fragment implements OnClickListener,
public void loadMessageForViewBodyAvailable(final Account account, String folder, public void loadMessageForViewBodyAvailable(final Account account, String folder,
String uid, final Message message) { String uid, final Message message) {
if (!(message instanceof LocalMessage) || if (!(message instanceof LocalMessage) ||
!mMessageReference.uid.equals(uid) || !mMessageReference.getUid().equals(uid) ||
!mMessageReference.folderName.equals(folder) || !mMessageReference.getFolderName().equals(folder) ||
!mMessageReference.accountUuid.equals(account.getUuid())) { !mMessageReference.getAccountUuid().equals(account.getUuid())) {
return; return;
} }
@ -601,8 +601,8 @@ public class MessageViewFragment extends Fragment implements OnClickListener,
@Override @Override
public void loadMessageForViewFailed(Account account, String folder, String uid, final Throwable t) { public void loadMessageForViewFailed(Account account, String folder, String uid, final Throwable t) {
if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder) if (!mMessageReference.getUid().equals(uid) || !mMessageReference.getFolderName().equals(folder)
|| !mMessageReference.accountUuid.equals(account.getUuid())) { || !mMessageReference.getAccountUuid().equals(account.getUuid())) {
return; return;
} }
mHandler.post(new Runnable() { mHandler.post(new Runnable() {
@ -624,8 +624,8 @@ public class MessageViewFragment extends Fragment implements OnClickListener,
@Override @Override
public void loadMessageForViewFinished(Account account, String folder, String uid, final Message message) { public void loadMessageForViewFinished(Account account, String folder, String uid, final Message message) {
if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder) if (!mMessageReference.getUid().equals(uid) || !mMessageReference.getFolderName().equals(folder)
|| !mMessageReference.accountUuid.equals(account.getUuid())) { || !mMessageReference.getAccountUuid().equals(account.getUuid())) {
return; return;
} }
mHandler.post(new Runnable() { mHandler.post(new Runnable() {
@ -639,8 +639,8 @@ public class MessageViewFragment extends Fragment implements OnClickListener,
@Override @Override
public void loadMessageForViewStarted(Account account, String folder, String uid) { public void loadMessageForViewStarted(Account account, String folder, String uid) {
if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder) if (!mMessageReference.getUid().equals(uid) || !mMessageReference.getFolderName().equals(folder)
|| !mMessageReference.accountUuid.equals(account.getUuid())) { || !mMessageReference.getAccountUuid().equals(account.getUuid())) {
return; return;
} }
mHandler.post(new Runnable() { mHandler.post(new Runnable() {
@ -830,12 +830,12 @@ public class MessageViewFragment extends Fragment implements OnClickListener,
} }
public boolean canMessageBeArchived() { public boolean canMessageBeArchived() {
return (!mMessageReference.folderName.equals(mAccount.getArchiveFolderName()) return (!mMessageReference.getFolderName().equals(mAccount.getArchiveFolderName())
&& mAccount.hasArchiveFolder()); && mAccount.hasArchiveFolder());
} }
public boolean canMessageBeMovedToSpam() { public boolean canMessageBeMovedToSpam() {
return (!mMessageReference.folderName.equals(mAccount.getSpamFolderName()) return (!mMessageReference.getFolderName().equals(mAccount.getSpamFolderName())
&& mAccount.hasSpamFolder()); && mAccount.hasSpamFolder());
} }

View File

@ -576,10 +576,7 @@ public class LocalMessage extends MimeMessage {
public MessageReference makeMessageReference() { public MessageReference makeMessageReference() {
if (mReference == null) { if (mReference == null) {
mReference = new MessageReference(); mReference = new MessageReference(getFolder().getAccountUuid(), getFolder().getName(), mUid, null);
mReference.folderName = getFolder().getName();
mReference.uid = mUid;
mReference.accountUuid = getFolder().getAccountUuid();
} }
return mReference; return mReference;
} }

View File

@ -80,7 +80,7 @@ public class NotificationActionService extends CoreService {
List<MessageReference> refs = List<MessageReference> refs =
intent.getParcelableArrayListExtra(EXTRA_MESSAGE_LIST); intent.getParcelableArrayListExtra(EXTRA_MESSAGE_LIST);
for (MessageReference ref : refs) { for (MessageReference ref : refs) {
controller.setFlag(account, ref.folderName, ref.uid, Flag.SEEN, true); controller.setFlag(account, ref.getFolderName(), ref.getUid(), Flag.SEEN, true);
} }
} else if (DELETE_ALL_ACTION.equals(action)) { } else if (DELETE_ALL_ACTION.equals(action)) {
if (K9.DEBUG) if (K9.DEBUG)