am 09a09623: Use standard actionbar when possible

# Via Paul Westbrook
* commit '09a09623952011e72b28d0fd3e6b9845477a6a52':
  Use standard actionbar when possible
diff --git a/src/com/android/email/activity/ActionBarController.java b/src/com/android/email/activity/ActionBarController.java
index ce5888a..7ff1ee8 100644
--- a/src/com/android/email/activity/ActionBarController.java
+++ b/src/com/android/email/activity/ActionBarController.java
@@ -62,6 +62,13 @@
     private static final int LOADER_ID_ACCOUNT_LIST
             = EmailActivity.ACTION_BAR_CONTROLLER_LOADER_ID_BASE + 0;
 
+    private static final int DISPLAY_TITLE_MULTIPLE_LINES = 0x20;
+    private static final int ACTION_BAR_MASK =
+            ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_CUSTOM
+                    | ActionBar.DISPLAY_SHOW_TITLE | DISPLAY_TITLE_MULTIPLE_LINES;
+    private static final int CUSTOM_ACTION_BAR_OPTIONS =
+            ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_CUSTOM;
+
     private final Context mContext;
     private final LoaderManager mLoaderManager;
     private final ActionBar mActionBar;
@@ -210,7 +217,7 @@
         mAccountsSelectorAdapter = new AccountSelectorAdapter(mContext);
 
         // Configure action bar.
-        mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_CUSTOM);
+        enterCustomActionBarMode();
 
         // Prepare the custom view
         mActionBar.setCustomView(R.layout.action_bar_custom_view);
@@ -422,6 +429,7 @@
     private void updateTitle() {
         mAccountsSelectorAdapter.swapCursor(mCursor);
 
+        enterCustomActionBarMode();
         if (mCursor == null) {
             // Initial load not finished.
             mActionBarCustomView.setVisibility(View.GONE);
@@ -461,19 +469,18 @@
         UiUtilities.setVisibilitySafe(mSearchContainer, View.GONE);
 
         if (mTitleMode == Callback.TITLE_MODE_MESSAGE_SUBJECT) {
-            mAccountSpinnerLine1View.setSingleLine(false);
-            mAccountSpinnerLine1View.setMaxLines(2);
-            mAccountSpinnerLine1View.setText(mCallback.getMessageSubject());
-            mAccountSpinnerLine2View.setVisibility(View.GONE);
-
-            mAccountSpinnerCountView.setVisibility(View.GONE);
-
+            // Use two line title action bar mode
+            enterMultiLineTitleActionBarMode();
+            mActionBar.setTitle(mCallback.getMessageSubject());
+            mActionBar.setSubtitle(null);
+        } else if (mTitleMode == Callback.TITLE_MODE_ACCOUNT_WITH_ALL_FOLDERS_LABEL) {
+            enterSingleLineTitleActionBarMode();
+            mActionBar.setTitle(mAllFoldersLabel);
+            mActionBar.setSubtitle(mCursor.getAccountDisplayName());
         } else {
             // Get mailbox name
             final String mailboxName;
-            if (mTitleMode == Callback.TITLE_MODE_ACCOUNT_WITH_ALL_FOLDERS_LABEL) {
-                mailboxName = mAllFoldersLabel;
-            } else if (mTitleMode == Callback.TITLE_MODE_ACCOUNT_WITH_MAILBOX) {
+            if (mTitleMode == Callback.TITLE_MODE_ACCOUNT_WITH_MAILBOX) {
                 mailboxName = mCursor.getMailboxDisplayName();
             } else {
                 mailboxName = null;
@@ -502,10 +509,23 @@
         boolean spinnerEnabled =
             ((mTitleMode & TITLE_MODE_SPINNER_ENABLED) != 0) && mCursor.shouldEnableSpinner();
 
-
         setSpinnerEnabled(spinnerEnabled);
     }
 
+    private void enterCustomActionBarMode() {
+        mActionBar.setDisplayOptions(CUSTOM_ACTION_BAR_OPTIONS, ACTION_BAR_MASK);
+    }
+
+    private void enterMultiLineTitleActionBarMode() {
+        mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE
+                | DISPLAY_TITLE_MULTIPLE_LINES, ACTION_BAR_MASK);
+    }
+
+    private void enterSingleLineTitleActionBarMode() {
+        mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE,
+                ACTION_BAR_MASK);
+    }
+
     private void setSpinnerEnabled(boolean enabled) {
         if (enabled == mAccountSpinner.isEnabled()) {
             return;