MessagingListener.java revision 0dff228dc769e141ec2a27d951963a0d705ddabb
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 android.content.Context;
20
21import com.android.email.mail.Folder;
22import com.android.email.mail.Message;
23import com.android.email.mail.Part;
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 */
32public class MessagingListener {
33    public void listFoldersStarted(Account account) {
34    }
35
36    public void listFolders(Account account, Folder[] folders) {
37    }
38
39    public void listFoldersFailed(Account account, String message) {
40    }
41
42    public void listFoldersFinished(Account account) {
43    }
44
45    public void listLocalMessagesStarted(Account account, String folder) {
46    }
47
48    public void listLocalMessages(Account account, String folder, Message[] messages) {
49    }
50
51    public void listLocalMessagesFailed(Account account, String folder, String message) {
52    }
53
54    public void listLocalMessagesFinished(Account account, String folder) {
55    }
56
57    public void synchronizeMailboxStarted(Account account, String folder) {
58    }
59
60    public void synchronizeMailboxNewMessage(Account account, String folder, Message message) {
61    }
62
63    public void synchronizeMailboxRemovedMessage(Account account, String folder,Message message) {
64    }
65
66    public void synchronizeMailboxFinished(Account account, String folder,
67            int totalMessagesInMailbox, int numNewMessages) {
68    }
69
70    public void synchronizeMailboxFailed(Account account, String folder, Exception e) {
71    }
72
73    public void loadMessageForViewStarted(Account account, String folder, String uid) {
74    }
75
76    public void loadMessageForViewHeadersAvailable(Account account, String folder, String uid,
77            Message message) {
78    }
79
80    public void loadMessageForViewBodyAvailable(Account account, String folder, String uid,
81            Message message) {
82    }
83
84    public void loadMessageForViewFinished(Account account, String folder, String uid,
85            Message message) {
86    }
87
88    public void loadMessageForViewFailed(Account account, String folder, String uid, String message) {
89    }
90
91    public void loadInlineImagesForViewStarted(Account account, Message message) {
92    }
93
94    public void loadInlineImagesForViewOneAvailable(Account account, Message message, Part part) {
95    }
96
97    public void loadInlineImagesForViewFinished(Account account, Message message) {
98    }
99
100    public void loadInlineImagesForViewFailed(Account account, Message message) {
101    }
102
103    public void checkMailStarted(Context context, Account account) {
104    }
105
106    public void checkMailFinished(Context context, Account account) {
107    }
108
109    public void checkMailFailed(Context context, Account account, String reason) {
110    }
111
112    public void sendPendingMessagesCompleted(Account account) {
113    }
114
115    public void sendPendingMessagesFailed(Account account, Exception reason) {
116    }
117
118    public void sendPendingMessageFailed(Account account, Message message, Exception reason) {
119    }
120
121    public void emptyTrashCompleted(Account account) {
122    }
123
124    public void messageUidChanged(Account account, String folder, String oldUid, String newUid) {
125
126    }
127
128    public void loadAttachmentStarted(
129            Account account,
130            Message message,
131            Part part,
132            Object tag,
133            boolean requiresDownload)
134    {
135    }
136
137    public void loadAttachmentFinished(
138            Account account,
139            Message message,
140            Part part,
141            Object tag)
142    {
143    }
144
145    public void loadAttachmentFailed(
146            Account account,
147            Message message,
148            Part part,
149            Object tag,
150            String reason)
151    {
152    }
153
154    /**
155     * General notification messages subclasses can override to be notified that the controller
156     * has completed a command. This is useful for turning off progress indicators that may have
157     * been left over from previous commands.
158     * @param moreCommandsToRun True if the controller will continue on to another command
159     * immediately.
160     */
161    public void controllerCommandCompleted(boolean moreCommandsToRun) {
162
163    }
164}
165