Merge "More cleanup" into jb-ub-mail-ur10
diff --git a/src/com/android/mail/ui/FolderListFragment.java b/src/com/android/mail/ui/FolderListFragment.java
index 29e4720..9a5c514 100644
--- a/src/com/android/mail/ui/FolderListFragment.java
+++ b/src/com/android/mail/ui/FolderListFragment.java
@@ -250,6 +250,7 @@
         if (! (activity instanceof ControllableActivity)){
             LogUtils.wtf(LOG_TAG, "FolderListFragment expects only a ControllableActivity to" +
                     "create it. Cannot proceed.");
+            return;
         }
         mActivity = (ControllableActivity) activity;
         final FolderController controller = mActivity.getFolderController();
@@ -343,7 +344,7 @@
         if (args == null) {
             return;
         }
-        mParentFolder = (Folder) args.getParcelable(ARG_PARENT_FOLDER);
+        mParentFolder = args.getParcelable(ARG_PARENT_FOLDER);
         final String folderUri = args.getString(ARG_FOLDER_LIST_URI);
         if (folderUri != null) {
             mFolderListUri = Uri.parse(folderUri);
@@ -1062,7 +1063,7 @@
 
     /**
      * Sets the currently selected folder safely.
-     * @param folder
+     * @param folder the folder to change to. It is an error to pass null here.
      */
     private void setSelectedFolder(Folder folder) {
         if (folder == null) {
diff --git a/src/com/android/mail/ui/TwoPaneController.java b/src/com/android/mail/ui/TwoPaneController.java
index a5f653a..ede87fd 100644
--- a/src/com/android/mail/ui/TwoPaneController.java
+++ b/src/com/android/mail/ui/TwoPaneController.java
@@ -92,21 +92,6 @@
         }
     }
 
-    private void createFolderListFragment(Fragment folderList) {
-        // Create a sectioned FolderListFragment.
-        FragmentTransaction fragmentTransaction = mActivity.getFragmentManager().beginTransaction();
-        if (Utils.useFolderListFragmentTransition(mActivity.getActivityContext())) {
-            fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
-        }
-        fragmentTransaction.replace(R.id.content_pane, folderList, TAG_FOLDER_LIST);
-        fragmentTransaction.commitAllowingStateLoss();
-        // We only set the action bar if the viewmode has been set previously. Otherwise, we leave
-        // the action bar in the state it is currently in.
-        if (mViewMode.getMode() != ViewMode.UNKNOWN) {
-            resetActionBarIcon();
-        }
-    }
-
     @Override
     protected boolean isConversationListVisible() {
         return !mLayout.isConversationListCollapsed();
@@ -125,8 +110,9 @@
         mDrawerPullout = mDrawerContainer.findViewById(R.id.content_pane);
         mLayout = (TwoPaneLayout) mActivity.findViewById(R.id.two_pane_activity);
         if (mLayout == null) {
-            // We need the layout for everything. Crash early if it is null.
+            // We need the layout for everything. Crash/Return early if it is null.
             LogUtils.wtf(LOG_TAG, "mLayout is null!");
+            return false;
         }
         mLayout.setController(this, Intent.ACTION_SEARCH.equals(mActivity.getIntent().getAction()));
         mLayout.setDrawerLayout(mDrawerContainer);