Merge "Don\'t show icons in overlay popup menus." into nyc-dev
am: 203222e
* commit '203222ea6077c1e0155971fee1cb6917b8055117':
Don't show icons in overlay popup menus.
Change-Id: I7abab9b6fb52ca17a811a0917f4955db9c9393e7
This commit is contained in:
@@ -347,14 +347,21 @@ final class CascadingMenuPopup extends MenuPopup implements MenuPresenter, OnKey
|
|||||||
final LayoutInflater inflater = LayoutInflater.from(mContext);
|
final LayoutInflater inflater = LayoutInflater.from(mContext);
|
||||||
final MenuAdapter adapter = new MenuAdapter(menu, inflater, mOverflowOnly);
|
final MenuAdapter adapter = new MenuAdapter(menu, inflater, mOverflowOnly);
|
||||||
|
|
||||||
// Apply "force show icon" setting; if the menu being shown is the top level menu, apply the
|
// Apply "force show icon" setting. There are 4 cases:
|
||||||
// setting set on this CascadingMenuPopup by its creating code. If it's a submenu, or if no
|
// (1) This is the top level menu. Only add spacing for icons if forced.
|
||||||
// "force" setting was explicitly set, determine the setting by examining the items.
|
// (2) This is a submenu. Add spacing if any of the visible menu items has an icon.
|
||||||
|
// (3) This is a top level menu that is not an overflow menu. Add spacing if any of the
|
||||||
|
// visible menu items has an icon.
|
||||||
|
// (4) This is an overflow menu or a top level menu that doesn't have "force" set.
|
||||||
|
// Don't allow spacing.
|
||||||
if (!isShowing() && mForceShowIcon) {
|
if (!isShowing() && mForceShowIcon) {
|
||||||
adapter.setForceShowIcon(mForceShowIcon);
|
// Case 1
|
||||||
} else {
|
adapter.setForceShowIcon(true);
|
||||||
adapter.setForceShowIcon(MenuPopup.shouldPreserveIconSpacing(menu));
|
} else if (isShowing() || !isShowing() && !mForceShowIcon && !mOverflowOnly) {
|
||||||
|
// Case 2 or 3
|
||||||
|
adapter.setForceShowIcon(MenuPopup.shouldPreserveIconSpacing(menu));
|
||||||
}
|
}
|
||||||
|
// Case 4: Else, don't allow spacing for icons.
|
||||||
|
|
||||||
final int menuWidth = measureIndividualMenuWidth(adapter, null, mContext, mMenuMaxWidth);
|
final int menuWidth = measureIndividualMenuWidth(adapter, null, mContext, mMenuMaxWidth);
|
||||||
final MenuPopupWindow popupWindow = createPopupWindow();
|
final MenuPopupWindow popupWindow = createPopupWindow();
|
||||||
@@ -734,4 +741,4 @@ final class CascadingMenuPopup extends MenuPopup implements MenuPresenter, OnKey
|
|||||||
return window.getListView();
|
return window.getListView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -187,6 +187,11 @@ public abstract class MenuPopup implements ShowableListMenu, MenuPresenter,
|
|||||||
/**
|
/**
|
||||||
* Returns whether icon spacing needs to be preserved for the given menu, based on whether any
|
* Returns whether icon spacing needs to be preserved for the given menu, based on whether any
|
||||||
* of its items contains an icon.
|
* of its items contains an icon.
|
||||||
|
*
|
||||||
|
* NOTE: This should only be used for non-overflow-only menus, because this method does not
|
||||||
|
* take into account whether the menu items are being shown as part of the popup or or being
|
||||||
|
* shown as actions in the action bar.
|
||||||
|
*
|
||||||
* @param menu
|
* @param menu
|
||||||
* @return Whether to preserve icon spacing.
|
* @return Whether to preserve icon spacing.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user