Loading core/java/com/android/internal/app/ActionBarImpl.java +6 −1 Original line number Diff line number Diff line Loading @@ -176,6 +176,8 @@ public class ActionBarImpl extends ActionBar { } mActionView.setEmbeddedTabView(mTabScrollView); } mActionView.setCollapsable(!mHasEmbeddedTabs && getNavigationMode() == NAVIGATION_MODE_TABS); TypedArray a = mContext.obtainStyledAttributes(null, R.styleable.ActionBar); mContentHeight = a.getLayoutDimension(R.styleable.ActionBar_height, 0); Loading Loading @@ -307,7 +309,9 @@ public class ActionBarImpl extends ActionBar { selectTab(null); } mTabs.clear(); if (mTabScrollView != null) { mTabScrollView.removeAllTabs(); } mSavedTabPosition = INVALID_POSITION; } Loading Loading @@ -887,6 +891,7 @@ public class ActionBarImpl extends ActionBar { } break; } mActionView.setCollapsable(mode == NAVIGATION_MODE_TABS && !mHasEmbeddedTabs); } @Override Loading core/java/com/android/internal/widget/ActionBarContainer.java +15 −2 Original line number Diff line number Diff line Loading @@ -96,13 +96,26 @@ public class ActionBarContainer extends FrameLayout { @Override public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); int nonTabHeight = 0; final int count = getChildCount(); for (int i = 0; i < count; i++) { final View child = getChildAt(i); if (child == mTabContainer) { continue; } final LayoutParams lp = (LayoutParams) child.getLayoutParams(); nonTabHeight = Math.max(nonTabHeight, child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin); } if (mTabContainer != null && mTabContainer.getVisibility() != GONE) { final int mode = MeasureSpec.getMode(heightMeasureSpec); if (mode == MeasureSpec.AT_MOST) { final int measuredHeight = getMeasuredHeight(); final int maxHeight = MeasureSpec.getSize(heightMeasureSpec); setMeasuredDimension(getMeasuredWidth(), Math.min(measuredHeight + mTabContainer.getMeasuredHeight(), maxHeight)); Math.min(nonTabHeight + mTabContainer.getMeasuredHeight(), maxHeight)); } } } Loading core/java/com/android/internal/widget/ActionBarView.java +29 −2 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ public class ActionBarView extends AbsActionBarView { private boolean mSplitActionBar; private boolean mUserTitle; private boolean mIncludeTabs; private boolean mIsCollapsable; private MenuBuilder mOptionsMenu; Loading Loading @@ -629,8 +630,30 @@ public class ActionBarView extends AbsActionBarView { mContextView = view; } public void setCollapsable(boolean collapsable) { mIsCollapsable = collapsable; } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { final int childCount = getChildCount(); if (mIsCollapsable) { int visibleChildren = 0; for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); if (child.getVisibility() != GONE && !(child == mMenuView && mMenuView.getChildCount() == 0)) { visibleChildren++; } } if (visibleChildren == 0) { // No size for an empty action bar when collapsable. setMeasuredDimension(0, 0); return; } } int widthMode = MeasureSpec.getMode(widthMeasureSpec); if (widthMode != MeasureSpec.EXACTLY) { throw new IllegalStateException(getClass().getSimpleName() + " can only be used " + Loading Loading @@ -761,8 +784,7 @@ public class ActionBarView extends AbsActionBarView { if (mContentHeight <= 0) { int measuredHeight = 0; final int count = getChildCount(); for (int i = 0; i < count; i++) { for (int i = 0; i < childCount; i++) { View v = getChildAt(i); int paddedViewHeight = v.getMeasuredHeight() + verticalPadding; if (paddedViewHeight > measuredHeight) { Loading Loading @@ -791,6 +813,11 @@ public class ActionBarView extends AbsActionBarView { final int y = getPaddingTop(); final int contentHeight = b - t - getPaddingTop() - getPaddingBottom(); if (contentHeight <= 0) { // Nothing to do if we can't see anything. return; } if (mHomeLayout.getVisibility() != GONE) { x += positionChild(mHomeLayout, x, y, contentHeight); } Loading Loading
core/java/com/android/internal/app/ActionBarImpl.java +6 −1 Original line number Diff line number Diff line Loading @@ -176,6 +176,8 @@ public class ActionBarImpl extends ActionBar { } mActionView.setEmbeddedTabView(mTabScrollView); } mActionView.setCollapsable(!mHasEmbeddedTabs && getNavigationMode() == NAVIGATION_MODE_TABS); TypedArray a = mContext.obtainStyledAttributes(null, R.styleable.ActionBar); mContentHeight = a.getLayoutDimension(R.styleable.ActionBar_height, 0); Loading Loading @@ -307,7 +309,9 @@ public class ActionBarImpl extends ActionBar { selectTab(null); } mTabs.clear(); if (mTabScrollView != null) { mTabScrollView.removeAllTabs(); } mSavedTabPosition = INVALID_POSITION; } Loading Loading @@ -887,6 +891,7 @@ public class ActionBarImpl extends ActionBar { } break; } mActionView.setCollapsable(mode == NAVIGATION_MODE_TABS && !mHasEmbeddedTabs); } @Override Loading
core/java/com/android/internal/widget/ActionBarContainer.java +15 −2 Original line number Diff line number Diff line Loading @@ -96,13 +96,26 @@ public class ActionBarContainer extends FrameLayout { @Override public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); int nonTabHeight = 0; final int count = getChildCount(); for (int i = 0; i < count; i++) { final View child = getChildAt(i); if (child == mTabContainer) { continue; } final LayoutParams lp = (LayoutParams) child.getLayoutParams(); nonTabHeight = Math.max(nonTabHeight, child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin); } if (mTabContainer != null && mTabContainer.getVisibility() != GONE) { final int mode = MeasureSpec.getMode(heightMeasureSpec); if (mode == MeasureSpec.AT_MOST) { final int measuredHeight = getMeasuredHeight(); final int maxHeight = MeasureSpec.getSize(heightMeasureSpec); setMeasuredDimension(getMeasuredWidth(), Math.min(measuredHeight + mTabContainer.getMeasuredHeight(), maxHeight)); Math.min(nonTabHeight + mTabContainer.getMeasuredHeight(), maxHeight)); } } } Loading
core/java/com/android/internal/widget/ActionBarView.java +29 −2 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ public class ActionBarView extends AbsActionBarView { private boolean mSplitActionBar; private boolean mUserTitle; private boolean mIncludeTabs; private boolean mIsCollapsable; private MenuBuilder mOptionsMenu; Loading Loading @@ -629,8 +630,30 @@ public class ActionBarView extends AbsActionBarView { mContextView = view; } public void setCollapsable(boolean collapsable) { mIsCollapsable = collapsable; } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { final int childCount = getChildCount(); if (mIsCollapsable) { int visibleChildren = 0; for (int i = 0; i < childCount; i++) { final View child = getChildAt(i); if (child.getVisibility() != GONE && !(child == mMenuView && mMenuView.getChildCount() == 0)) { visibleChildren++; } } if (visibleChildren == 0) { // No size for an empty action bar when collapsable. setMeasuredDimension(0, 0); return; } } int widthMode = MeasureSpec.getMode(widthMeasureSpec); if (widthMode != MeasureSpec.EXACTLY) { throw new IllegalStateException(getClass().getSimpleName() + " can only be used " + Loading Loading @@ -761,8 +784,7 @@ public class ActionBarView extends AbsActionBarView { if (mContentHeight <= 0) { int measuredHeight = 0; final int count = getChildCount(); for (int i = 0; i < count; i++) { for (int i = 0; i < childCount; i++) { View v = getChildAt(i); int paddedViewHeight = v.getMeasuredHeight() + verticalPadding; if (paddedViewHeight > measuredHeight) { Loading Loading @@ -791,6 +813,11 @@ public class ActionBarView extends AbsActionBarView { final int y = getPaddingTop(); final int contentHeight = b - t - getPaddingTop() - getPaddingBottom(); if (contentHeight <= 0) { // Nothing to do if we can't see anything. return; } if (mHomeLayout.getVisibility() != GONE) { x += positionChild(mHomeLayout, x, y, contentHeight); } Loading