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

Commit 0e382005 authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "Fix action bar tabs collapsing when they shouldn't."

parents 2859e2b7 af6b97eb
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.util.AttributeSet;
import android.view.ActionMode;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;

/**
@@ -109,7 +110,9 @@ public class ActionBarContainer extends FrameLayout {
        mTabContainer = tabView;
        if (tabView != null) {
            addView(tabView);
            tabView.getLayoutParams().width = LayoutParams.MATCH_PARENT;
            final ViewGroup.LayoutParams lp = tabView.getLayoutParams();
            lp.width = LayoutParams.MATCH_PARENT;
            lp.height = LayoutParams.WRAP_CONTENT;
            tabView.setAllowCollapse(false);
        }
    }
+6 −10
Original line number Diff line number Diff line
@@ -68,6 +68,11 @@ public class ScrollingTabContainerView extends HorizontalScrollView
        super(context);
        setHorizontalScrollBarEnabled(false);

        TypedArray a = getContext().obtainStyledAttributes(null, R.styleable.ActionBar,
                com.android.internal.R.attr.actionBarStyle, 0);
        setContentHeight(a.getLayoutDimension(R.styleable.ActionBar_height, 0));
        a.recycle();

        mTabLayout = createTabLayout();
        addView(mTabLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.MATCH_PARENT));
@@ -91,16 +96,7 @@ public class ScrollingTabContainerView extends HorizontalScrollView
            mMaxTabWidth = -1;
        }

        int heightMode = MeasureSpec.getMode(heightMeasureSpec);
        int heightSize = MeasureSpec.getSize(heightMeasureSpec);
        if (heightMode != MeasureSpec.UNSPECIFIED) {
            if (mContentHeight == 0 && heightMode == MeasureSpec.EXACTLY) {
                // Use this as our content height.
                mContentHeight = heightSize;
            }
            heightSize = Math.min(heightSize, mContentHeight);
            heightMeasureSpec = MeasureSpec.makeMeasureSpec(heightSize, heightMode);
        }
        heightMeasureSpec = MeasureSpec.makeMeasureSpec(mContentHeight, MeasureSpec.EXACTLY);

        final boolean canCollapse = !lockedExpanded && mAllowCollapse;