1 /* 2 * Copyright (C) 2008 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.email; 18 19 import com.android.emailcommon.mail.MessagingException; 20 21 import android.content.Context; 22 23 import java.util.ArrayList; 24 25 /** 26 * Defines the interface that MessagingController will use to callback to requesters. This class 27 * is defined as non-abstract so that someone who wants to receive only a few messages can 28 * do so without implementing the entire interface. It is highly recommended that users of 29 * this interface use the @Override annotation in their implementations to avoid being caught by 30 * changes in this class. 31 */ 32 public class MessagingListener { 33 public MessagingListener() { 34 } 35 36 public void listFoldersStarted(long accountId) { 37 } 38 39 public void listFoldersFailed(long accountId, String message) { 40 } 41 42 public void listFoldersFinished(long accountId) { 43 } 44 45 public void synchronizeMailboxStarted(long accountId, long mailboxId) { 46 } 47 48 /** 49 * Synchronization of the mailbox finished. The mailbox and/or message databases have been 50 * updated accordingly. 51 * 52 * @param accountId The account that was synchronized 53 * @param mailboxId The mailbox that was synchronized 54 * @param totalMessagesInMailbox The total number of messages in the mailbox 55 * @param numNewMessages The number of new messages 56 * @param addedMessages Message IDs of messages that were added during the synchronization. 57 * These are new, unread messages. Messages that were previously read are not in this list. 58 */ 59 public void synchronizeMailboxFinished(long accountId, long mailboxId, 60 int totalMessagesInMailbox, int numNewMessages, ArrayList<Long> addedMessages) { 61 } 62 63 public void synchronizeMailboxFailed(long accountId, long mailboxId, Exception e) { 64 } 65 66 public void loadMessageForViewStarted(long messageId) { 67 } 68 69 public void loadMessageForViewFinished(long messageId) { 70 } 71 72 public void loadMessageForViewFailed(long messageId, String message) { 73 } 74 75 public void checkMailStarted(Context context, long accountId, long tag) { 76 } 77 78 public void checkMailFinished(Context context, long accountId, long mailboxId, long tag) { 79 } 80 81 public void sendPendingMessagesStarted(long accountId, long messageId) { 82 } 83 84 public void sendPendingMessagesCompleted(long accountId) { 85 } 86 87 public void sendPendingMessagesFailed(long accountId, long messageId, Exception reason) { 88 } 89 90 public void messageUidChanged(long accountId, long mailboxId, String oldUid, String newUid) { 91 } 92 93 public void loadAttachmentStarted( 94 long accountId, 95 long messageId, 96 long attachmentId, 97 boolean requiresDownload) { 98 } 99 100 public void loadAttachmentFinished( 101 long accountId, 102 long messageId, 103 long attachmentId) { 104 } 105 106 public void loadAttachmentFailed( 107 long accountId, 108 long messageId, 109 long attachmentId, 110 MessagingException me, 111 boolean background) { 112 } 113 114 /** 115 * General notification messages subclasses can override to be notified that the controller 116 * has completed a command. This is useful for turning off progress indicators that may have 117 * been left over from previous commands. 118 * @param moreCommandsToRun True if the controller will continue on to another command 119 * immediately. 120 */ 121 public void controllerCommandCompleted(boolean moreCommandsToRun) { 122 123 } 124 } 125