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

Commit b187cd9c authored by Adam Powell's avatar Adam Powell
Browse files

Fix bug 5038368 - Rules for collapsing action views.

Make collapsing action views exclusive on small screens with unsplit
action bars.

Change-Id: I11cc220acc7b6acddd25f2500404b47bfb405d5c
parent eac3503d
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ public class ActionMenuPresenter extends BaseMenuPresenter {
    private boolean mMaxItemsSet;
    private boolean mStrictWidthLimit;
    private boolean mWidthLimitSet;
    private boolean mExpandedActionViewsExclusive;

    private int mMinCellSize;

@@ -124,6 +125,10 @@ public class ActionMenuPresenter extends BaseMenuPresenter {
        mMaxItemsSet = true;
    }

    public void setExpandedActionViewsExclusive(boolean isExclusive) {
        mExpandedActionViewsExclusive = isExclusive;
    }

    @Override
    public MenuView getMenuView(ViewGroup root) {
        MenuView result = super.getMenuView(root);
@@ -326,6 +331,11 @@ public class ActionMenuPresenter extends BaseMenuPresenter {
            } else {
                hasOverflow = true;
            }
            if (mExpandedActionViewsExclusive && item.isActionViewExpanded()) {
                // Overflow everything if we have an expanded action view and we're
                // space constrained.
                maxActions = 0;
            }
        }

        // Reserve a spot for the overflow item if needed.
+4 −0
Original line number Diff line number Diff line
@@ -345,11 +345,15 @@ public class ActionBarView extends AbsActionBarView {
        final LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.MATCH_PARENT);
        if (!mSplitActionBar) {
            mActionMenuPresenter.setExpandedActionViewsExclusive(
                    getResources().getBoolean(
                    com.android.internal.R.bool.action_bar_expanded_action_views_exclusive));
            builder.addMenuPresenter(mActionMenuPresenter);
            builder.addMenuPresenter(mExpandedMenuPresenter);
            menuView = (ActionMenuView) mActionMenuPresenter.getMenuView(this);
            addView(menuView, layoutParams);
        } else {
            mActionMenuPresenter.setExpandedActionViewsExclusive(false);
            // Allow full screen width in split mode.
            mActionMenuPresenter.setWidthLimit(
                    getContext().getResources().getDisplayMetrics().widthPixels, true);
+1 −0
Original line number Diff line number Diff line
@@ -17,4 +17,5 @@
<resources>
    <bool name="preferences_prefer_dual_pane">true</bool>
    <bool name="show_ongoing_ime_switcher">false</bool>
    <bool name="action_bar_expanded_action_views_exclusive">false</bool>
</resources>
+1 −0
Original line number Diff line number Diff line
@@ -19,4 +19,5 @@
    <bool name="split_action_bar_is_narrow">true</bool>
    <bool name="preferences_prefer_dual_pane">false</bool>
    <bool name="show_ongoing_ime_switcher">true</bool>
    <bool name="action_bar_expanded_action_views_exclusive">true</bool>
</resources>