MessagingListener.java revision 0d1078363581db8caded06cf94e729e88a88761a
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
17package com.android.email;
18
19import com.android.email.mail.Message;
20import com.android.email.provider.EmailContent;
21
22import android.content.Context;
23
24/**
25 * Defines the interface that MessagingController will use to callback to requesters. This class
26 * is defined as non-abstract so that someone who wants to receive only a few messages can
27 * do so without implementing the entire interface. It is highly recommended that users of
28 * this interface use the @Override annotation in their implementations to avoid being caught by
29 * changes in this class.
30 */
31public class MessagingListener {
32    public void listFoldersStarted(EmailContent.Account account) {
33    }
34
35    public void listFoldersFailed(EmailContent.Account account, String message) {
36    }
37
38    public void listFoldersFinished(EmailContent.Account account) {
39    }
40
41    public void synchronizeMailboxStarted(EmailContent.Account account, EmailContent.Mailbox folder)
42            {
43    }
44
45    public void synchronizeMailboxFinished(EmailContent.Account account,
46            EmailContent.Mailbox folder, int totalMessagesInMailbox, int numNewMessages) {
47    }
48
49    public void synchronizeMailboxFailed(EmailContent.Account account, EmailContent.Mailbox folder,
50            Exception e) {
51    }
52
53    public void loadMessageForViewStarted(EmailContent.Account account, String folder, String uid) {
54    }
55
56    public void loadMessageForViewHeadersAvailable(EmailContent.Account account, String folder,
57            String uid, Message message) {
58    }
59
60    public void loadMessageForViewBodyAvailable(EmailContent.Account account, String folder,
61            String uid, Message message) {
62    }
63
64    public void loadMessageForViewFinished(EmailContent.Account account, String folder, String uid,
65            Message message) {
66    }
67
68    public void loadMessageForViewFailed(EmailContent.Account account, String folder, String uid,
69            String message) {
70    }
71
72    public void checkMailStarted(Context context, long accountId, long tag) {
73    }
74
75    public void checkMailFinished(Context context, long accountId, long folderId, long tag) {
76    }
77
78    public void sendPendingMessagesCompleted(EmailContent.Account account) {
79    }
80
81    public void sendPendingMessagesFailed(EmailContent.Account account, Exception reason) {
82    }
83
84    public void sendPendingMessageFailed(EmailContent.Account account, Message message,
85            Exception reason) {
86    }
87
88    public void emptyTrashCompleted(EmailContent.Account account) {
89    }
90
91    public void messageUidChanged(EmailContent.Account account, String folder,
92            String oldUid, String newUid) {
93    }
94
95    public void loadAttachmentStarted(
96            long accountId,
97            long messageId,
98            long attachmentId,
99            boolean requiresDownload) {
100    }
101
102    public void loadAttachmentFinished(
103            long accountId,
104            long messageId,
105            long attachmentId) {
106    }
107
108    public void loadAttachmentFailed(
109            long accountId,
110            long messageId,
111            long attachmentId,
112            String reason) {
113    }
114
115    /**
116     * General notification messages subclasses can override to be notified that the controller
117     * has completed a command. This is useful for turning off progress indicators that may have
118     * been left over from previous commands.
119     * @param moreCommandsToRun True if the controller will continue on to another command
120     * immediately.
121     */
122    public void controllerCommandCompleted(boolean moreCommandsToRun) {
123
124    }
125}
126