MessagingListener.java revision 4b41bae270ea4c49ec8403084db43ee9b37cdda4
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 sendPendingMessagesStarted(long accountId, long messageId) {
79    }
80
81    public void sendPendingMessagesCompleted(long accountId) {
82    }
83
84    public void sendPendingMessagesFailed(long accountId, long messageId, Exception reason) {
85    }
86
87    public void emptyTrashCompleted(EmailContent.Account account) {
88    }
89
90    public void messageUidChanged(EmailContent.Account account, String folder,
91            String oldUid, String newUid) {
92    }
93
94    public void loadAttachmentStarted(
95            long accountId,
96            long messageId,
97            long attachmentId,
98            boolean requiresDownload) {
99    }
100
101    public void loadAttachmentFinished(
102            long accountId,
103            long messageId,
104            long attachmentId) {
105    }
106
107    public void loadAttachmentFailed(
108            long accountId,
109            long messageId,
110            long attachmentId,
111            String reason) {
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