Vikram Aggarwal | b9e1a35 | 2012-01-24 15:23:38 -0800 | [diff] [blame] | 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 | |
| 18 | package com.android.mail.ui; |
| 19 | |
Andy Huang | 1ee96b2 | 2012-08-24 20:19:53 -0700 | [diff] [blame] | 20 | import android.app.LoaderManager.LoaderCallbacks; |
Andy Huang | 632721e | 2012-04-11 16:57:26 -0700 | [diff] [blame] | 21 | import android.database.DataSetObserver; |
| 22 | |
Mindy Pereira | 967ede6 | 2012-03-22 09:29:09 -0700 | [diff] [blame] | 23 | import com.android.mail.browse.ConversationCursor; |
Mindy Pereira | 9b87568 | 2012-02-15 18:10:54 -0800 | [diff] [blame] | 24 | import com.android.mail.providers.Conversation; |
| 25 | |
Vikram Aggarwal | b9e1a35 | 2012-01-24 15:23:38 -0800 | [diff] [blame] | 26 | /** |
| 27 | * A controller interface that is to receive user initiated events and handle them. |
| 28 | */ |
| 29 | public interface ConversationListCallbacks { |
| 30 | /** |
Andy Huang | 1ee96b2 | 2012-08-24 20:19:53 -0700 | [diff] [blame] | 31 | * 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 Aggarwal | b9e1a35 | 2012-01-24 15:23:38 -0800 | [diff] [blame] | 37 | */ |
Andy Huang | 1ee96b2 | 2012-08-24 20:19:53 -0700 | [diff] [blame] | 38 | void onConversationSelected(Conversation conversation, boolean inLoaderCallbacks); |
Mindy Pereira | 967ede6 | 2012-03-22 09:29:09 -0700 | [diff] [blame] | 39 | |
| 40 | ConversationCursor getConversationListCursor(); |
Andy Huang | 632721e | 2012-04-11 16:57:26 -0700 | [diff] [blame] | 41 | |
Andy Huang | 1ee96b2 | 2012-08-24 20:19:53 -0700 | [diff] [blame] | 42 | Conversation getCurrentConversation(); |
Andy Huang | 632721e | 2012-04-11 16:57:26 -0700 | [diff] [blame] | 43 | void setCurrentConversation(Conversation c); |
| 44 | |
Andy Huang | 3825f3d | 2012-08-29 16:44:12 -0700 | [diff] [blame] | 45 | /** |
Andy Huang | 9d3fd92 | 2012-09-26 22:23:58 -0700 | [diff] [blame] | 46 | * 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 Huang | 3825f3d | 2012-08-29 16:44:12 -0700 | [diff] [blame] | 58 | * 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 Huang | 632721e | 2012-04-11 16:57:26 -0700 | [diff] [blame] | 63 | void registerConversationListObserver(DataSetObserver observer); |
| 64 | void unregisterConversationListObserver(DataSetObserver observer); |
mindyp | 54f120f | 2012-08-28 13:10:33 -0700 | [diff] [blame] | 65 | |
| 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); |
mindyp | 6f54e1b | 2012-10-09 09:54:08 -0700 | [diff] [blame] | 71 | |
| 72 | /** |
| 73 | * Detect if there are any animations occuring in the conversation list. |
| 74 | */ |
| 75 | boolean isAnimating(); |
Vikram Aggarwal | b9e1a35 | 2012-01-24 15:23:38 -0800 | [diff] [blame] | 76 | } |