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

Commit 88c9c7d7 authored by Adam Powell's avatar Adam Powell Committed by The Android Automerger
Browse files

Fix action bar tabs collapsing when they shouldn't.

Change-Id: Ib0a91722b580802d2b5e3b07c4e57397665a3394
parent 377fa5ac
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;