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