Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a900677a authored by Adam Powell's avatar Adam Powell Committed by Android (Google) Code Review
Browse files

Merge "Fix measurement regression in ActionBarContainer" into lmp-dev

parents 6dbe512e 635c21b0
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -268,16 +268,21 @@ public class ActionBarContainer extends FrameLayout {

        if (mActionBarView == null) return;

        final LayoutParams lp = (LayoutParams) mActionBarView.getLayoutParams();
        final int actionBarViewHeight = isCollapsed(mActionBarView) ? 0 :
                mActionBarView.getMeasuredHeight() + lp.topMargin + lp.bottomMargin;
        int nonTabMaxHeight = 0;
        final int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            final View child = getChildAt(i);
            final LayoutParams lp = (LayoutParams) child.getLayoutParams();
            nonTabMaxHeight = isCollapsed(child) ? 0 :
                    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 maxHeight = MeasureSpec.getSize(heightMeasureSpec);
                setMeasuredDimension(getMeasuredWidth(),
                        Math.min(actionBarViewHeight + mTabContainer.getMeasuredHeight(),
                        Math.min(nonTabMaxHeight + mTabContainer.getMeasuredHeight(),
                                maxHeight));
            }
        }