Home | History | Annotate | Download | only in ui
      1 /*
      2  * Copyright (C) 2013 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 
     18 package com.android.mail.ui;
     19 
     20 import android.widget.ListView;
     21 
     22 /**
     23  * A drawer that is shown in one pane mode, as a pull-out from the left.  All the
     24  * implementation is inherited from the FolderListFragment.
     25  *
     26  * The drawer shows a list of accounts, the recent folders, and a list of top-level folders for
     27  * the given account. This fragment is created using no arguments, it gets all its state from the
     28  * controller in {@link #onActivityCreated(android.os.Bundle)}. In particular, it gets the current
     29  * account, the list of accounts, and the current folder from the {@link ControllableActivity}.
     30  *
     31  * Once it has this information, the drawer sets itself up to observe for changes and allows the
     32  * user to change folders and accounts.
     33  *
     34  * The drawer is always instantiated through XML resources: in one_pane_activity.xml and in
     35  * two_pane_activity.xml
     36  */
     37 public class DrawerFragment extends FolderListFragment {
     38     /**
     39      * The only way a drawer is constructed is through XML layouts, and so it needs no constructor
     40      * like {@link FolderListFragment#ofTopLevelTree(android.net.Uri, java.util.ArrayList}
     41      */
     42     public DrawerFragment() {
     43         super();
     44         // Drawer is always divided: it shows groups for inboxes, recent folders and all other
     45         // folders.
     46         mIsDivided = true;
     47         // The drawer shows the footer.
     48         mIsFolderSelectionActivity = false;
     49     }
     50 
     51     @Override
     52     protected int getListViewChoiceMode() {
     53         // Always let one item be selected
     54         return ListView.CHOICE_MODE_SINGLE;
     55     }
     56 }
     57