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        FolderItemView.DropHandler, UndoListener,
34        AnimatedAdapter.Listener, ConversationListFooterView.FooterViewClickListener {
35    /**
36     * Returns the ViewMode the activity is updating.
37     * @see com.android.mail.ui.ViewMode
38     * @return ViewMode.
39     */
40    ViewMode getViewMode();
41
42    /**
43     * Returns the object that handles {@link ConversationListCallbacks} that is associated with
44     * this activity.
45     * @return
46     */
47    ConversationListCallbacks getListHandler();
48
49    /**
50     * Return the folder change listener for this activity
51     * @return
52     */
53    FolderChangeListener getFolderChangeListener();
54
55    /**
56     * Get the set of currently selected conversations. This method returns a non-null value.
57     * In case no conversation is currently selected, it returns an empty selection set.
58     * @return
59     */
60    ConversationSelectionSet getSelectedSet();
61
62    /**
63     * Returns the listener for folder list selection changes in the folder list
64     * fragment so that activity controllers can track the last folder list
65     * pushed for hierarchical folders.
66     */
67    FolderSelector getFolderSelector();
68
69    /**
70     * Get the folder currently being accessed by the activity.
71     */
72    Folder getHierarchyFolder();
73
74    /**
75     * Returns an object that can update conversation state. Holding a reference to the
76     * ConversationUpdater is safe since the ConversationUpdater is guaranteed to persist across
77     * changes to the conversation cursor.
78     * @return
79     */
80    ConversationUpdater getConversationUpdater();
81
82    ErrorListener getErrorListener();
83
84    /**
85     * Returns the {@link FolderController} object associated with this activity, if any.
86     * @return
87     */
88    FolderController getFolderController();
89
90    /**
91     * Returns the {@link AccountController} object associated with this activity, if any.
92     * @return
93     */
94    AccountController getAccountController();
95
96    /**
97     * Returns the {@link RecentFolderController} object associated with this activity, if any.
98     * @return
99     */
100    RecentFolderController getRecentFolderController();
101
102    DrawerController getDrawerController();
103
104    KeyboardNavigationController getKeyboardNavigationController();
105
106    void startDragMode();
107
108    void stopDragMode();
109
110    boolean isAccessibilityEnabled();
111
112    /**
113     * Gets a helper to provide addition features in the conversation list. This may be null.
114     */
115    ConversationListHelper getConversationListHelper();
116
117    /**
118     * Returns the {@link FragmentLauncher} object associated with this activity, if any.
119     */
120    FragmentLauncher getFragmentLauncher();
121
122    ContactLoaderCallbacks getContactLoaderCallbacks();
123
124    ContactResolver getContactResolver(ContentResolver resolver, BitmapCache bitmapCache);
125
126    BitmapCache getSenderImageCache();
127    void resetSenderImageCache();
128
129    /**
130     * Shows help to user, could be in browser or another activity.
131     */
132    void showHelp(Account account, int viewMode);
133}
134