Merge "Minor changes to actionbar for message view"

This commit is contained in:
Ben Komalo 2011-08-01 14:38:56 -07:00 committed by Android (Google) Code Review
commit bcd1339610

View File

@ -443,30 +443,40 @@ public class ActionBarController {
mAccountSpinner.setVisibility(View.VISIBLE); mAccountSpinner.setVisibility(View.VISIBLE);
UiUtilities.setVisibilitySafe(mSearchContainer, View.GONE); UiUtilities.setVisibilitySafe(mSearchContainer, View.GONE);
// Get mailbox name if (mTitleMode == Callback.TITLE_MODE_MESSAGE_SUBJECT) {
final String mailboxName; mAccountSpinnerLine1View.setSingleLine(false);
if (mTitleMode == Callback.TITLE_MODE_ACCOUNT_WITH_ALL_FOLDERS_LABEL) { mAccountSpinnerLine1View.setText(mCallback.getMessageSubject());
mailboxName = mAllFoldersLabel;
} else if (mTitleMode == Callback.TITLE_MODE_ACCOUNT_WITH_MAILBOX) {
mailboxName = mCursor.getMailboxDisplayName();
} else if (mTitleMode == Callback.TITLE_MODE_MESSAGE_SUBJECT) {
mailboxName = mCallback.getMessageSubject();
} else {
mailboxName = null;
}
if (TextUtils.isEmpty(mailboxName)) {
mAccountSpinnerLine1View.setText(mCursor.getAccountDisplayName());
// Only here we change the visibility of line 2, so line 1 will be vertically-centered.
mAccountSpinnerLine2View.setVisibility(View.GONE); mAccountSpinnerLine2View.setVisibility(View.GONE);
mAccountSpinnerCountView.setVisibility(View.GONE);
} else { } else {
mAccountSpinnerLine1View.setText(mailboxName); // Get mailbox name
mAccountSpinnerLine2View.setVisibility(View.VISIBLE); // Make sure it's visible again. final String mailboxName;
mAccountSpinnerLine2View.setText(mCursor.getAccountDisplayName()); if (mTitleMode == Callback.TITLE_MODE_ACCOUNT_WITH_ALL_FOLDERS_LABEL) {
mailboxName = mAllFoldersLabel;
} else if (mTitleMode == Callback.TITLE_MODE_ACCOUNT_WITH_MAILBOX) {
mailboxName = mCursor.getMailboxDisplayName();
} else {
mailboxName = null;
}
mAccountSpinnerLine1View.setSingleLine();
if (TextUtils.isEmpty(mailboxName)) {
mAccountSpinnerLine1View.setText(mCursor.getAccountDisplayName());
// Change the visibility of line 2, so line 1 will be vertically-centered.
mAccountSpinnerLine2View.setVisibility(View.GONE);
} else {
mAccountSpinnerLine1View.setText(mailboxName);
mAccountSpinnerLine2View.setVisibility(View.VISIBLE);
mAccountSpinnerLine2View.setText(mCursor.getAccountDisplayName());
}
mAccountSpinnerCountView.setVisibility(View.VISIBLE);
mAccountSpinnerCountView.setText(UiUtilities.getMessageCountForUi(
mContext, mCursor.getMailboxMessageCount(), true));
} }
mAccountSpinnerCountView.setText(UiUtilities.getMessageCountForUi(
mContext, mCursor.getMailboxMessageCount(), true));
boolean spinnerEnabled = boolean spinnerEnabled =
((mTitleMode & TITLE_MODE_SPINNER_ENABLED) != 0) && mCursor.shouldEnableSpinner(); ((mTitleMode & TITLE_MODE_SPINNER_ENABLED) != 0) && mCursor.shouldEnableSpinner();