Merge "Hide the entire tab section if no tabs are visible." into honeycomb

This commit is contained in:
Makoto Onuki 2011-01-17 10:38:09 -08:00 committed by Android (Google) Code Review
commit f944b6f0aa
1 changed files with 8 additions and 4 deletions

View File

@ -564,15 +564,15 @@ public abstract class MessageViewFragmentBase extends Fragment implements View.O
v.setVisibility(visible ? View.VISIBLE : View.GONE); v.setVisibility(visible ? View.VISIBLE : View.GONE);
} }
private static boolean isVisible(View v) {
return v.getVisibility() == View.VISIBLE;
}
/** /**
* Update the visual of the tabs. (visibility, text, etc) * Update the visual of the tabs. (visibility, text, etc)
*/ */
private void updateTabFlags(int tabFlags) { private void updateTabFlags(int tabFlags) {
mTabFlags = tabFlags; mTabFlags = tabFlags;
mTabSection.setVisibility(tabFlags == 0 ? View.GONE : View.VISIBLE);
if (tabFlags == 0) {
return;
}
boolean messageTabVisible = (tabFlags & (TAB_FLAGS_HAS_INVITE | TAB_FLAGS_HAS_ATTACHMENT)) boolean messageTabVisible = (tabFlags & (TAB_FLAGS_HAS_INVITE | TAB_FLAGS_HAS_ATTACHMENT))
!= 0; != 0;
makeVisible(mMessageTab, messageTabVisible); makeVisible(mMessageTab, messageTabVisible);
@ -586,6 +586,10 @@ public abstract class MessageViewFragmentBase extends Fragment implements View.O
mAttachmentTab.setText(mContext.getResources().getQuantityString( mAttachmentTab.setText(mContext.getResources().getQuantityString(
R.plurals.message_view_show_attachments_action, R.plurals.message_view_show_attachments_action,
mAttachmentCount, mAttachmentCount)); mAttachmentCount, mAttachmentCount));
// Hide the entire section if no tabs are visible.
makeVisible(mTabSection, isVisible(mMessageTab) || isVisible(mInviteTab)
|| isVisible(mAttachmentTab) || isVisible(mShowPicturesTab));
} }
/** /**