blob: 40e75cb96f48bae69add0e166d7e12cbc9ee7c7d [file] [log] [blame]
Vikram Aggarwalb9e1a352012-01-24 15:23:38 -08001/*
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
Andy Huang1ee96b22012-08-24 20:19:53 -070020import android.app.LoaderManager.LoaderCallbacks;
Andy Huang632721e2012-04-11 16:57:26 -070021import android.database.DataSetObserver;
22
Mindy Pereira967ede62012-03-22 09:29:09 -070023import com.android.mail.browse.ConversationCursor;
Mindy Pereira9b875682012-02-15 18:10:54 -080024import com.android.mail.providers.Conversation;
25
Vikram Aggarwalb9e1a352012-01-24 15:23:38 -080026/**
27 * A controller interface that is to receive user initiated events and handle them.
28 */
29public interface ConversationListCallbacks {
30 /**
Andy Huang1ee96b22012-08-24 20:19:53 -070031 * Show the conversation provided here. If the conversation is null, this is a request to pop
32 * <em>out</em> of conversation view mode and head back to conversation list mode, or whatever
33 * should best show in its place.
34 * @param conversation conversation to display, possibly null.
35 * @param inLoaderCallbacks whether we are in the scope of a {@link LoaderCallbacks} method
36 * (when fragment transactions are disallowed)
Vikram Aggarwalb9e1a352012-01-24 15:23:38 -080037 */
Andy Huang1ee96b22012-08-24 20:19:53 -070038 void onConversationSelected(Conversation conversation, boolean inLoaderCallbacks);
Mindy Pereira967ede62012-03-22 09:29:09 -070039
40 ConversationCursor getConversationListCursor();
Andy Huang632721e2012-04-11 16:57:26 -070041
Andy Huang1ee96b22012-08-24 20:19:53 -070042 Conversation getCurrentConversation();
Andy Huang632721e2012-04-11 16:57:26 -070043 void setCurrentConversation(Conversation c);
44
Andy Huang3825f3d2012-08-29 16:44:12 -070045 /**
Andy Huang9d3fd922012-09-26 22:23:58 -070046 * Returns whether the initial conversation has begun but not finished loading. If this returns
47 * true, you can register to be told when the load in progress finishes
48 * ({@link #registerConversationLoadedObserver(DataSetObserver)}).
49 * <p>
50 * This flag only applies to the first conversation in a set (e.g. when using ViewPager).
51 *
52 * @return true if the initial conversation has begun but not finished loading
53 */
54 boolean isInitialConversationLoading();
55 void registerConversationLoadedObserver(DataSetObserver observer);
56 void unregisterConversationLoadedObserver(DataSetObserver observer);
57 /**
Andy Huang3825f3d2012-08-29 16:44:12 -070058 * Coordinates actions that might occur in response to a conversation that has finished loading
59 * and is now user-visible.
60 */
61 void onConversationSeen(Conversation conv);
62
Andy Huang632721e2012-04-11 16:57:26 -070063 void registerConversationListObserver(DataSetObserver observer);
64 void unregisterConversationListObserver(DataSetObserver observer);
mindyp54f120f2012-08-28 13:10:33 -070065
66 /**
67 * Commit any destructive action leave behind items so that it is no longer
68 * possible to undo them.
69 */
70 void commitDestructiveActions(boolean animate);
mindyp6f54e1b2012-10-09 09:54:08 -070071
72 /**
73 * Detect if there are any animations occuring in the conversation list.
74 */
75 boolean isAnimating();
Vikram Aggarwala91d00b2013-01-18 12:00:37 -080076
77 /**
78 * Tell the controller that the conversation view has entered detached mode.
79 */
80 void setDetachedMode();
Vikram Aggarwalb9e1a352012-01-24 15:23:38 -080081}