1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
/*
* Copyright (C) 2012 Google Inc.
* Licensed to The Android Open Source Project.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.mail.ui;
import android.database.DataSetObservable;
import android.database.DataSetObserver;
import android.widget.ListView;
import com.android.mail.providers.Account;
import com.android.mail.providers.AccountObserver;
import com.android.mail.providers.Folder;
import com.android.mail.providers.FolderWatcher;
import com.android.mail.utils.VeiledAddressMatcher;
/**
* This class consolidates account-specific actions taken by a mail activity.
*/
public interface AccountController {
/**
* Registers to receive changes to the current account, and obtain the current account.
*/
void registerAccountObserver(DataSetObserver observer);
/**
* Removes a listener from receiving current account changes.
*/
void unregisterAccountObserver(DataSetObserver observer);
/**
* Returns the current account in use by the controller. Instead of calling this method,
* consider registering for account changes using
* {@link AccountObserver#initialize(AccountController)}, which not only provides the current
* account, but also updates to the account, in case of settings changes.
*/
Account getAccount();
/**
* Registers to receive changes to the list of accounts, and obtain the current list.
*/
void registerAllAccountObserver(DataSetObserver observer);
/**
* Removes a listener from receiving account list changes.
*/
void unregisterAllAccountObserver(DataSetObserver observer);
/** Returns a list of all accounts currently known. */
Account[] getAllAccounts();
/**
* Returns an object that can check veiled addresses.
* @return
*/
VeiledAddressMatcher getVeiledAddressMatcher();
/**
* Handles selecting the currently active account from within
* the {@link FolderListFragment}.
*/
void switchToDefaultInboxOrChangeAccount(Account account);
/**
* Registers to receive changes upon drawer closing when a changeAccount is called.
*/
void registerFolderOrAccountChangedObserver(final DataSetObserver observer);
/**
* Removes a listener from receiving current account changes.
*/
void unregisterFolderOrAccountChangedObserver(final DataSetObserver observer);
/**
* When the {@link FolderListFragment} has a new account ready for changing to,
* close the drawer and then wait for {@link DataSetObservable#notifyChanged()}.
* @param hasNewFolderOrAccount true if we need to load conversations for a different folder
* or account, false otherwise.
*/
void closeDrawer(boolean hasNewFolderOrAccount, Account nextAccount, Folder nextFolder);
/**
* Set the folderWatcher
*/
void setFolderWatcher(FolderWatcher watcher);
/**
* @return <code>true</code> if the drawer pull action is enabled, <code>false</code> otherwise
*/
boolean isDrawerPullEnabled();
/**
* @return the choice mode to use in the {@link ListView} in the default folder list (subclasses
* of {@link FolderListFragment} may override this
*/
int getFolderListViewChoiceMode();
}
|