use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class MessageViewFragment method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Bundle arguments = getArguments();
String messageReferenceString = arguments.getString(ARG_REFERENCE);
MessageReference messageReference = MessageReference.parse(messageReferenceString);
displayMessage(messageReference);
}
use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class MessageViewFragment method refileMessage.
private void refileMessage(long dstFolderId) {
long srcFolderId = mMessageReference.getFolderId();
MessageReference messageToMove = mMessageReference;
mFragmentListener.showNextMessageOrReturn();
mController.moveMessage(mAccount, srcFolderId, messageToMove, dstFolderId);
}
use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class MessageListHandler method handleMessage.
@Override
public void handleMessage(android.os.Message msg) {
MessageListFragment fragment = mFragment.get();
if (fragment == null) {
return;
}
// The following messages don't need an attached activity.
switch(msg.what) {
case ACTION_REMOTE_SEARCH_FINISHED:
{
fragment.remoteSearchFinished();
return;
}
}
// Discard messages if the fragment isn't attached to an activity anymore.
Activity activity = fragment.getActivity();
if (activity == null) {
return;
}
switch(msg.what) {
case ACTION_FOLDER_LOADING:
{
long folderId = (Long) msg.obj;
boolean loading = (msg.arg1 == 1);
fragment.folderLoading(folderId, loading);
break;
}
case ACTION_REFRESH_TITLE:
{
fragment.updateTitle();
break;
}
case ACTION_PROGRESS:
{
boolean progress = (msg.arg1 == 1);
fragment.progress(progress);
break;
}
case ACTION_GO_BACK:
{
fragment.goBack();
break;
}
case ACTION_RESTORE_LIST_POSITION:
{
Parcelable savedListState = (Parcelable) msg.obj;
fragment.restoreListState(savedListState);
break;
}
case ACTION_OPEN_MESSAGE:
{
MessageReference messageReference = (MessageReference) msg.obj;
fragment.openMessage(messageReference);
break;
}
}
}
use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class MessagingController method actOnMessagesGroupedByAccountAndFolder.
private void actOnMessagesGroupedByAccountAndFolder(List<MessageReference> messages, MessageActor actor) {
Map<String, Map<Long, List<MessageReference>>> accountMap = groupMessagesByAccountAndFolder(messages);
for (Map.Entry<String, Map<Long, List<MessageReference>>> entry : accountMap.entrySet()) {
String accountUuid = entry.getKey();
Account account = preferences.getAccount(accountUuid);
Map<Long, List<MessageReference>> folderMap = entry.getValue();
for (Map.Entry<Long, List<MessageReference>> folderEntry : folderMap.entrySet()) {
long folderId = folderEntry.getKey();
List<MessageReference> messageList = folderEntry.getValue();
actOnMessageGroup(account, folderId, messageList, actor);
}
}
}
use of com.fsck.k9.controller.MessageReference in project k-9 by k9mail.
the class MessagingController method moveToDraftsFolderInBackground.
private void moveToDraftsFolderInBackground(Account account, long folderId, List<MessageReference> messages) {
for (MessageReference messageReference : messages) {
try {
Message message = loadMessage(account, folderId, messageReference.getUid());
Long draftMessageId = saveDraft(account, message, null, message.getSubject());
boolean draftSavedSuccessfully = draftMessageId != null;
if (draftSavedSuccessfully) {
message.destroy();
}
for (MessagingListener listener : getListeners()) {
listener.folderStatusChanged(account, folderId);
}
} catch (MessagingException e) {
Timber.e(e, "Error loading message. Draft was not saved.");
}
}
}
Aggregations