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

Commit 266b1008 authored by Adam Powell's avatar Adam Powell
Browse files

Fix some ActionBar bugs.

* Fix a bug where the options panel would not open on non-xlarge
  screens to show overflow menu items.

* Fix a bug where ActionBarView would try to add a custom nav view
  twice.

* Fix a bug where ActionBarView would expand too far in wrap_content mode

Change-Id: I433ea56524aad885d813ae8743fe2fcefa9649fa
parent 93af2e48
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -163,7 +163,6 @@ public class ActionBarView extends ViewGroup {
            LayoutInflater inflater = LayoutInflater.from(context);
            mCustomNavView = (View) inflater.inflate(customNavId, null);
            mNavigationMode = ActionBar.NAVIGATION_MODE_CUSTOM;
            addView(mCustomNavView);
        }

        mContentHeight = a.getLayoutDimension(R.styleable.ActionBar_height, 0);
@@ -553,7 +552,7 @@ public class ActionBarView extends ViewGroup {
            if (mSpinner != null) {
                mSpinner.measure(
                        MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST),
                        MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
                        MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST));
            }
            break;
        case ActionBar.NAVIGATION_MODE_CUSTOM:
@@ -563,8 +562,16 @@ public class ActionBarView extends ViewGroup {
                        MeasureSpec.EXACTLY : MeasureSpec.AT_MOST;
                final int customNavWidth = lp.width >= 0 ?
                        Math.min(lp.width, availableWidth) : availableWidth;
                final int customNavHeightMode = lp.height != LayoutParams.WRAP_CONTENT ?

                // If the action bar is wrapping to its content height, don't allow a custom
                // view to MATCH_PARENT.
                int customNavHeightMode;
                if (mContentHeight <= 0) {
                    customNavHeightMode = MeasureSpec.AT_MOST;
                } else {
                    customNavHeightMode = lp.height != LayoutParams.WRAP_CONTENT ?
                            MeasureSpec.EXACTLY : MeasureSpec.AT_MOST;
                }
                final int customNavHeight = lp.height >= 0 ?
                        Math.min(lp.height, height) : height;
                mCustomNavView.measure(
@@ -576,7 +583,7 @@ public class ActionBarView extends ViewGroup {
            if (mTabLayout != null) {
                mTabLayout.measure(
                        MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST),
                        MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
                        MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST));
            }
            break;
        }
+9 −10
Original line number Diff line number Diff line
@@ -643,8 +643,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
            
            boolean playSoundEffect = false;
            final PanelFeatureState st = getPanelState(featureId, true);
            if (featureId == FEATURE_OPTIONS_PANEL && mActionBar != null) {
                if (mActionBar.isOverflowReserved()) {
            if (featureId == FEATURE_OPTIONS_PANEL && mActionBar != null &&
                    mActionBar.isOverflowReserved()) {
                if (!mActionBar.isOverflowMenuShowing()) {
                    final Callback cb = getCallback();
                    if (cb != null &&
@@ -654,7 +654,6 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
                } else {
                    playSoundEffect = mActionBar.hideOverflowMenu();
                }
                }
            } else {
                if (st.isOpen || st.isHandled) {