1/*******************************************************************************
2 *      Copyright (C) 2012 Google Inc.
3 *      Licensed to The Android Open Source Project.
4 *
5 *      Licensed under the Apache License, Version 2.0 (the "License");
6 *      you may not use this file except in compliance with the License.
7 *      You may obtain a copy of the License at
8 *
9 *           http://www.apache.org/licenses/LICENSE-2.0
10 *
11 *      Unless required by applicable law or agreed to in writing, software
12 *      distributed under the License is distributed on an "AS IS" BASIS,
13 *      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 *      See the License for the specific language governing permissions and
15 *      limitations under the License.
16 *******************************************************************************/
17
18package com.android.mail.ui;
19
20import android.content.ContentResolver;
21
22import com.android.bitmap.BitmapCache;
23import com.android.mail.bitmap.ContactResolver;
24import com.android.mail.browse.ConversationListFooterView;
25import com.android.mail.providers.Account;
26import com.android.mail.providers.Folder;
27
28/**
29 * A controllable activity is an Activity that has a Controller attached. This activity must be
30 * able to attach the various view fragments and delegate the method calls between them.
31 */
32public interface ControllableActivity extends RestrictedActivity,
33        UndoListener, AnimatedAdapter.Listener, ConversationListFooterView.FooterViewClickListener {
34    /**
35     * Returns the ViewMode the activity is updating.
36     * @see com.android.mail.ui.ViewMode
37     * @return ViewMode.
38     */
39    ViewMode getViewMode();
40
41    /**
42     * Returns the object that handles {@link ConversationListCallbacks} that is associated with
43     * this activity.
44     * @return
45     */
46    ConversationListCallbacks getListHandler();
47
48    /**
49     * Get the set of currently selected conversations. This method returns a non-null value.
50     * In case no conversation is currently selected, it returns an empty selection set.
51     * @return
52     */
53    ConversationCheckedSet getCheckedSet();
54
55    /**
56     * Returns the listener for folder list selection changes in the folder list
57     * fragment so that activity controllers can track the last folder list
58     * pushed for hierarchical folders.
59     */
60    FolderSelector getFolderSelector();
61
62    /**
63     * Get the folder currently being accessed by the activity.
64     */
65    Folder getHierarchyFolder();
66
67    /**
68     * Returns an object that can update conversation state. Holding a reference to the
69     * ConversationUpdater is safe since the ConversationUpdater is guaranteed to persist across
70     * changes to the conversation cursor.
71     * @return
72     */
73    ConversationUpdater getConversationUpdater();
74
75    ErrorListener getErrorListener();
76
77    /**
78     * Returns the {@link FolderController} object associated with this activity, if any.
79     * @return
80     */
81    FolderController getFolderController();
82
83    /**
84     * Returns the {@link AccountController} object associated with this activity, if any.
85     * @return
86     */
87    AccountController getAccountController();
88
89    /**
90     * Returns the {@link RecentFolderController} object associated with this activity, if any.
91     * @return
92     */
93    RecentFolderController getRecentFolderController();
94
95    DrawerController getDrawerController();
96
97    KeyboardNavigationController getKeyboardNavigationController();
98
99    boolean isAccessibilityEnabled();
100
101    /**
102     * Gets a helper to provide addition features in the conversation list. This may be null.
103     */
104    ConversationListHelper getConversationListHelper();
105
106    /**
107     * Returns the {@link FragmentLauncher} object associated with this activity, if any.
108     */
109    FragmentLauncher getFragmentLauncher();
110
111    ContactLoaderCallbacks getContactLoaderCallbacks();
112
113    ContactResolver getContactResolver(ContentResolver resolver, BitmapCache bitmapCache);
114
115    BitmapCache getSenderImageCache();
116    void resetSenderImageCache();
117
118    /**
119     * Shows help to user, could be in browser or another activity.
120     */
121    void showHelp(Account account, int viewMode);
122}
123