MessagingListener.java revision df86adf87328a439347260331592509787020420
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(long messageId) {
54    }
55
56    public void loadMessageForViewFinished(long messageId) {
57    }
58
59    public void loadMessageForViewFailed(long messageId, String message) {
60    }
61
62    public void checkMailStarted(Context context, long accountId, long tag) {
63    }
64
65    public void checkMailFinished(Context context, long accountId, long folderId, long tag) {
66    }
67
68    public void sendPendingMessagesStarted(long accountId, long messageId) {
69    }
70
71    public void sendPendingMessagesCompleted(long accountId) {
72    }
73
74    public void sendPendingMessagesFailed(long accountId, long messageId, Exception reason) {
75    }
76
77    public void emptyTrashCompleted(EmailContent.Account account) {
78    }
79
80    public void messageUidChanged(EmailContent.Account account, String folder,
81            String oldUid, String newUid) {
82    }
83
84    public void loadAttachmentStarted(
85            long accountId,
86            long messageId,
87            long attachmentId,
88            boolean requiresDownload) {
89    }
90
91    public void loadAttachmentFinished(
92            long accountId,
93            long messageId,
94            long attachmentId) {
95    }
96
97    public void loadAttachmentFailed(
98            long accountId,
99            long messageId,
100            long attachmentId,
101            String reason) {
102    }
103
104    /**
105     * General notification messages subclasses can override to be notified that the controller
106     * has completed a command. This is useful for turning off progress indicators that may have
107     * been left over from previous commands.
108     * @param moreCommandsToRun True if the controller will continue on to another command
109     * immediately.
110     */
111    public void controllerCommandCompleted(boolean moreCommandsToRun) {
112
113    }
114}
115