MessagingListener.java revision 687f9962d7095e18ef994cd0e64337f02ed1a5bd
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 checkMailStarted(Context context, Account account) { 92 } 93 94 public void checkMailFinished(Context context, Account account) { 95 } 96 97 public void checkMailFailed(Context context, Account account, String reason) { 98 } 99 100 public void sendPendingMessagesCompleted(Account account) { 101 } 102 103 public void emptyTrashCompleted(Account account) { 104 } 105 106 public void messageUidChanged(Account account, String folder, String oldUid, String newUid) { 107 108 } 109 110 public void loadAttachmentStarted( 111 Account account, 112 Message message, 113 Part part, 114 Object tag, 115 boolean requiresDownload) 116 { 117 } 118 119 public void loadAttachmentFinished( 120 Account account, 121 Message message, 122 Part part, 123 Object tag) 124 { 125 } 126 127 public void loadAttachmentFailed( 128 Account account, 129 Message message, 130 Part part, 131 Object tag, 132 String reason) 133 { 134 } 135 136 /** 137 * General notification messages subclasses can override to be notified that the controller 138 * has completed a command. This is useful for turning off progress indicators that may have 139 * been left over from previous commands. 140 * @param moreCommandsToRun True if the controller will continue on to another command 141 * immediately. 142 */ 143 public void controllerCommandCompleted(boolean moreCommandsToRun) { 144 145 } 146} 147