123b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal/* 223b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal * Copyright (C) 2013 The Android Open Source Project 323b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal * 423b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal * Licensed under the Apache License, Version 2.0 (the "License"); 523b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal * you may not use this file except in compliance with the License. 623b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal * You may obtain a copy of the License at 723b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal * 823b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal * http://www.apache.org/licenses/LICENSE-2.0 923b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal * 1023b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal * Unless required by applicable law or agreed to in writing, software 1123b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal * distributed under the License is distributed on an "AS IS" BASIS, 1223b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1323b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal * See the License for the specific language governing permissions and 1423b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal * limitations under the License. 1523b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal */ 1623b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal 1723b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal 1823b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwalpackage com.android.mail.ui; 1923b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal 20feb5b1ef0c9489c1ea727177f8bd423250b64990Scott Kennedyimport android.widget.ListView; 21feb5b1ef0c9489c1ea727177f8bd423250b64990Scott Kennedy 2223b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal/** 2323b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal * A drawer that is shown in one pane mode, as a pull-out from the left. All the 2423b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal * implementation is inherited from the FolderListFragment. 250128cf16c5a300f14d976711ab55e7d0e7e36201Vikram Aggarwal * 260128cf16c5a300f14d976711ab55e7d0e7e36201Vikram Aggarwal * The drawer shows a list of accounts, the recent folders, and a list of top-level folders for 270128cf16c5a300f14d976711ab55e7d0e7e36201Vikram Aggarwal * the given account. This fragment is created using no arguments, it gets all its state from the 280128cf16c5a300f14d976711ab55e7d0e7e36201Vikram Aggarwal * controller in {@link #onActivityCreated(android.os.Bundle)}. In particular, it gets the current 290128cf16c5a300f14d976711ab55e7d0e7e36201Vikram Aggarwal * account, the list of accounts, and the current folder from the {@link ControllableActivity}. 300128cf16c5a300f14d976711ab55e7d0e7e36201Vikram Aggarwal * 310128cf16c5a300f14d976711ab55e7d0e7e36201Vikram Aggarwal * Once it has this information, the drawer sets itself up to observe for changes and allows the 320128cf16c5a300f14d976711ab55e7d0e7e36201Vikram Aggarwal * user to change folders and accounts. 330128cf16c5a300f14d976711ab55e7d0e7e36201Vikram Aggarwal * 340128cf16c5a300f14d976711ab55e7d0e7e36201Vikram Aggarwal * The drawer is always instantiated through XML resources: in one_pane_activity.xml and in 350128cf16c5a300f14d976711ab55e7d0e7e36201Vikram Aggarwal * two_pane_activity.xml 3623b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal */ 3723b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwalpublic class DrawerFragment extends FolderListFragment { 38a3abeed709c97fb4c4611adf24d7789c0e6964dcVikram Aggarwal /** 39a3abeed709c97fb4c4611adf24d7789c0e6964dcVikram Aggarwal * The only way a drawer is constructed is through XML layouts, and so it needs no constructor 4083df39e24ae6369dc5065f3e5372b4756861f8b9Vikram Aggarwal * like {@link FolderListFragment#ofTopLevelTree(android.net.Uri, java.util.ArrayList} 41a3abeed709c97fb4c4611adf24d7789c0e6964dcVikram Aggarwal */ 4223b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal public DrawerFragment() { 4323b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal super(); 440128cf16c5a300f14d976711ab55e7d0e7e36201Vikram Aggarwal // Drawer is always divided: it shows groups for inboxes, recent folders and all other 450128cf16c5a300f14d976711ab55e7d0e7e36201Vikram Aggarwal // folders. 460128cf16c5a300f14d976711ab55e7d0e7e36201Vikram Aggarwal mIsDivided = true; 4716027b7fabaf488f10fe90a41af4ece25cf1ef10Andrew Sapperstein // The drawer shows the footer. 4816027b7fabaf488f10fe90a41af4ece25cf1ef10Andrew Sapperstein mIsFolderSelectionActivity = false; 4923b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal } 50feb5b1ef0c9489c1ea727177f8bd423250b64990Scott Kennedy 51feb5b1ef0c9489c1ea727177f8bd423250b64990Scott Kennedy @Override 52feb5b1ef0c9489c1ea727177f8bd423250b64990Scott Kennedy protected int getListViewChoiceMode() { 53feb5b1ef0c9489c1ea727177f8bd423250b64990Scott Kennedy // Always let one item be selected 54feb5b1ef0c9489c1ea727177f8bd423250b64990Scott Kennedy return ListView.CHOICE_MODE_SINGLE; 55feb5b1ef0c9489c1ea727177f8bd423250b64990Scott Kennedy } 5623b528f182f14ef7ec1f1a4eb8d8ee9b8f04a2f2Vikram Aggarwal} 57