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