Loading core/java/com/android/internal/view/menu/ActionMenuPresenter.java +2 −1 Original line number Diff line number Diff line Loading @@ -173,7 +173,8 @@ public class ActionMenuPresenter extends BaseMenuPresenter { public void updateMenuView(boolean cleared) { super.updateMenuView(cleared); final boolean hasOverflow = mReserveOverflow && mMenu.getNonActionItems().size() > 0; final boolean hasOverflow = mReserveOverflow && mMenu != null && mMenu.getNonActionItems().size() > 0; if (hasOverflow) { if (mOverflowButton == null) { mOverflowButton = new OverflowMenuButton(mContext); Loading core/java/com/android/internal/view/menu/BaseMenuPresenter.java +15 −11 Original line number Diff line number Diff line Loading @@ -74,11 +74,14 @@ public abstract class BaseMenuPresenter implements MenuPresenter { * Reuses item views when it can */ public void updateMenuView(boolean cleared) { final ViewGroup parent = (ViewGroup) mMenuView; if (parent == null) return; int childIndex = 0; if (mMenu != null) { mMenu.flagActionItems(); ArrayList<MenuItemImpl> visibleItems = mMenu.getVisibleItems(); final int itemCount = visibleItems.size(); final ViewGroup parent = (ViewGroup) mMenuView; int childIndex = 0; for (int i = 0; i < itemCount; i++) { MenuItemImpl item = visibleItems.get(i); if (shouldIncludeItem(childIndex, item)) { Loading @@ -90,6 +93,7 @@ public abstract class BaseMenuPresenter implements MenuPresenter { childIndex++; } } } // Remove leftover views. while (childIndex < parent.getChildCount()) { Loading core/java/com/android/internal/widget/ActionBarView.java +23 −10 Original line number Diff line number Diff line Loading @@ -373,8 +373,7 @@ public class ActionBarView extends AbsActionBarView { mActionMenuPresenter.setExpandedActionViewsExclusive( getResources().getBoolean( com.android.internal.R.bool.action_bar_expanded_action_views_exclusive)); builder.addMenuPresenter(mActionMenuPresenter); builder.addMenuPresenter(mExpandedMenuPresenter); configPresenters(builder); menuView = (ActionMenuView) mActionMenuPresenter.getMenuView(this); final ViewGroup oldParent = (ViewGroup) menuView.getParent(); if (oldParent != null && oldParent != this) { Loading @@ -390,8 +389,7 @@ public class ActionBarView extends AbsActionBarView { mActionMenuPresenter.setItemLimit(Integer.MAX_VALUE); // Span the whole width layoutParams.width = LayoutParams.MATCH_PARENT; builder.addMenuPresenter(mActionMenuPresenter); builder.addMenuPresenter(mExpandedMenuPresenter); configPresenters(builder); menuView = (ActionMenuView) mActionMenuPresenter.getMenuView(this); if (mSplitView != null) { final ViewGroup oldParent = (ViewGroup) menuView.getParent(); Loading @@ -407,6 +405,18 @@ public class ActionBarView extends AbsActionBarView { mMenuView = menuView; } private void configPresenters(MenuBuilder builder) { if (builder != null) { builder.addMenuPresenter(mActionMenuPresenter); builder.addMenuPresenter(mExpandedMenuPresenter); } else { mActionMenuPresenter.initForMenu(mContext, null); mExpandedMenuPresenter.initForMenu(mContext, null); mActionMenuPresenter.updateMenuView(true); mExpandedMenuPresenter.updateMenuView(true); } } public boolean hasExpandedActionView() { return mExpandedMenuPresenter != null && mExpandedMenuPresenter.mCurrentExpandedItem != null; Loading Loading @@ -1263,6 +1273,8 @@ public class ActionBarView extends AbsActionBarView { // Make sure the expanded item we have is still there. if (mCurrentExpandedItem != null) { boolean found = false; if (mMenu != null) { final int count = mMenu.size(); for (int i = 0; i < count; i++) { final MenuItem item = mMenu.getItem(i); Loading @@ -1271,6 +1283,7 @@ public class ActionBarView extends AbsActionBarView { break; } } } if (!found) { // The item we had expanded disappeared. Collapse. Loading policy/src/com/android/internal/policy/impl/PhoneWindow.java +6 −0 Original line number Diff line number Diff line Loading @@ -386,6 +386,9 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { // Ditch the menu created above st.menu = null; // Don't show it in the action bar either mActionBar.setMenu(null, mActionMenuPresenterCallback); return false; } Loading @@ -406,6 +409,9 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { } if (!cb.onPreparePanel(st.featureId, st.createdPanelView, st.menu)) { // The app didn't want to show the menu for now but it still exists. // Clear it out of the action bar. mActionBar.setMenu(null, mActionMenuPresenterCallback); st.menu.startDispatchingItemsChanged(); return false; } Loading Loading
core/java/com/android/internal/view/menu/ActionMenuPresenter.java +2 −1 Original line number Diff line number Diff line Loading @@ -173,7 +173,8 @@ public class ActionMenuPresenter extends BaseMenuPresenter { public void updateMenuView(boolean cleared) { super.updateMenuView(cleared); final boolean hasOverflow = mReserveOverflow && mMenu.getNonActionItems().size() > 0; final boolean hasOverflow = mReserveOverflow && mMenu != null && mMenu.getNonActionItems().size() > 0; if (hasOverflow) { if (mOverflowButton == null) { mOverflowButton = new OverflowMenuButton(mContext); Loading
core/java/com/android/internal/view/menu/BaseMenuPresenter.java +15 −11 Original line number Diff line number Diff line Loading @@ -74,11 +74,14 @@ public abstract class BaseMenuPresenter implements MenuPresenter { * Reuses item views when it can */ public void updateMenuView(boolean cleared) { final ViewGroup parent = (ViewGroup) mMenuView; if (parent == null) return; int childIndex = 0; if (mMenu != null) { mMenu.flagActionItems(); ArrayList<MenuItemImpl> visibleItems = mMenu.getVisibleItems(); final int itemCount = visibleItems.size(); final ViewGroup parent = (ViewGroup) mMenuView; int childIndex = 0; for (int i = 0; i < itemCount; i++) { MenuItemImpl item = visibleItems.get(i); if (shouldIncludeItem(childIndex, item)) { Loading @@ -90,6 +93,7 @@ public abstract class BaseMenuPresenter implements MenuPresenter { childIndex++; } } } // Remove leftover views. while (childIndex < parent.getChildCount()) { Loading
core/java/com/android/internal/widget/ActionBarView.java +23 −10 Original line number Diff line number Diff line Loading @@ -373,8 +373,7 @@ public class ActionBarView extends AbsActionBarView { mActionMenuPresenter.setExpandedActionViewsExclusive( getResources().getBoolean( com.android.internal.R.bool.action_bar_expanded_action_views_exclusive)); builder.addMenuPresenter(mActionMenuPresenter); builder.addMenuPresenter(mExpandedMenuPresenter); configPresenters(builder); menuView = (ActionMenuView) mActionMenuPresenter.getMenuView(this); final ViewGroup oldParent = (ViewGroup) menuView.getParent(); if (oldParent != null && oldParent != this) { Loading @@ -390,8 +389,7 @@ public class ActionBarView extends AbsActionBarView { mActionMenuPresenter.setItemLimit(Integer.MAX_VALUE); // Span the whole width layoutParams.width = LayoutParams.MATCH_PARENT; builder.addMenuPresenter(mActionMenuPresenter); builder.addMenuPresenter(mExpandedMenuPresenter); configPresenters(builder); menuView = (ActionMenuView) mActionMenuPresenter.getMenuView(this); if (mSplitView != null) { final ViewGroup oldParent = (ViewGroup) menuView.getParent(); Loading @@ -407,6 +405,18 @@ public class ActionBarView extends AbsActionBarView { mMenuView = menuView; } private void configPresenters(MenuBuilder builder) { if (builder != null) { builder.addMenuPresenter(mActionMenuPresenter); builder.addMenuPresenter(mExpandedMenuPresenter); } else { mActionMenuPresenter.initForMenu(mContext, null); mExpandedMenuPresenter.initForMenu(mContext, null); mActionMenuPresenter.updateMenuView(true); mExpandedMenuPresenter.updateMenuView(true); } } public boolean hasExpandedActionView() { return mExpandedMenuPresenter != null && mExpandedMenuPresenter.mCurrentExpandedItem != null; Loading Loading @@ -1263,6 +1273,8 @@ public class ActionBarView extends AbsActionBarView { // Make sure the expanded item we have is still there. if (mCurrentExpandedItem != null) { boolean found = false; if (mMenu != null) { final int count = mMenu.size(); for (int i = 0; i < count; i++) { final MenuItem item = mMenu.getItem(i); Loading @@ -1271,6 +1283,7 @@ public class ActionBarView extends AbsActionBarView { break; } } } if (!found) { // The item we had expanded disappeared. Collapse. Loading
policy/src/com/android/internal/policy/impl/PhoneWindow.java +6 −0 Original line number Diff line number Diff line Loading @@ -386,6 +386,9 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { // Ditch the menu created above st.menu = null; // Don't show it in the action bar either mActionBar.setMenu(null, mActionMenuPresenterCallback); return false; } Loading @@ -406,6 +409,9 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { } if (!cb.onPreparePanel(st.featureId, st.createdPanelView, st.menu)) { // The app didn't want to show the menu for now but it still exists. // Clear it out of the action bar. mActionBar.setMenu(null, mActionMenuPresenterCallback); st.menu.startDispatchingItemsChanged(); return false; } Loading