Lines Matching refs:menu

41 import android.support.v7.internal.view.menu.ListMenuPresenter;
42 import android.support.v7.internal.view.menu.MenuBuilder;
43 import android.support.v7.internal.view.menu.MenuPresenter;
44 import android.support.v7.internal.view.menu.MenuView;
388 // Invalidate if the panel menu hasn't been created before this.
389 // Panel menu invalidation is deferred avoiding application onCreateOptionsMenu
394 if (!isDestroyed() && (st == null || st.menu == null)) {
497 public boolean onCreatePanelMenu(int featureId, Menu menu) {
499 return getWindowCallback().onCreatePanelMenu(featureId, menu);
505 public boolean onPreparePanel(int featureId, View view, Menu menu) {
507 return getWindowCallback().onPreparePanel(featureId, view, menu);
513 public void onPanelClosed(final int featureId, Menu menu) {
522 mActivity.superOnPanelClosed(featureId, menu);
527 boolean onMenuOpened(final int featureId, Menu menu) {
535 return mActivity.superOnMenuOpened(featureId, menu);
540 public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) {
543 final PanelFeatureState panel = findMenuPanel(menu.getRootMenu());
552 public void onMenuModeChange(MenuBuilder menu) {
553 reopenMenu(menu, true);
815 // (The app should be using an action bar for menu items.)
830 if ((cb != null) && (!cb.onMenuOpened(st.featureId, st.menu))) {
831 // Callback doesn't want the menu to open, reset any state
915 private void reopenMenu(MenuBuilder menu, boolean toggleMenuMode) {
924 // If we have a menu invalidation pending, do it now.
933 // If we don't have a menu or we're waiting for a full content refresh,
935 if (st.menu != null && !st.refreshMenuContent &&
936 cb.onPreparePanel(FEATURE_OPTIONS_PANEL, st.createdPanelView, st.menu)) {
937 cb.onMenuOpened(FEATURE_ACTION_BAR, st.menu);
945 cb.onPanelClosed(FEATURE_ACTION_BAR, st.menu);
962 // If we have an action bar, initialize the menu with the right theme.
995 final MenuBuilder menu = new MenuBuilder(context);
996 menu.setCallback(this);
997 st.setMenu(menu);
1008 if (st.menu == null) {
1049 // dispatches menu-related events before the panel is prepared.
1054 // Init the panel state's menu--return false if init failed
1055 if (st.menu == null || st.refreshMenuContent) {
1056 if (st.menu == null) {
1057 if (!initializePanelMenu(st) || (st.menu == null)) {
1066 mDecorContentParent.setMenu(st.menu, mActionMenuPresenterCallback);
1069 // Creating the panel menu will involve a lot of manipulation;
1071 st.menu.stopDispatchingItemsChanged();
1072 if (!getWindowCallback().onCreatePanelMenu(st.featureId, st.menu)) {
1073 // Ditch the menu created above
1087 // Preparing the panel menu can involve a lot of manipulation;
1089 st.menu.stopDispatchingItemsChanged();
1094 st.menu.restoreActionViewStates(st.frozenActionViewState);
1098 // Callback and return if the callback does not want to show the menu
1099 if (!cb.onPreparePanel(FEATURE_OPTIONS_PANEL, st.createdPanelView, st.menu)) {
1101 // The app didn't want to show the menu for now but it still exists.
1105 st.menu.startDispatchingItemsChanged();
1113 st.menu.setQwertyMode(st.qwertyMode);
1114 st.menu.startDispatchingItemsChanged();
1125 private void checkCloseActionMenu(MenuBuilder menu) {
1134 cb.onPanelClosed(FEATURE_ACTION_BAR, menu);
1146 checkCloseActionMenu(st.menu);
1168 // Next time the menu opens, it should not be in expanded mode, so
1208 // Play the sound effect if the user closed an open menu (and not if
1209 // they just released a menu shortcut)
1212 // Close menu
1218 // Something may have invalidated the menu since we prepared it.
1225 // Show menu
1244 private void callOnPanelClosed(int featureId, PanelFeatureState panel, Menu menu) {
1245 // Try to get a menu
1246 if (menu == null) {
1247 // Need a panel to grab the menu, so try to get that
1255 // menu still may be null, which is okay--we tried our best
1256 menu = panel.menu;
1264 getWindowCallback().onPanelClosed(featureId, menu);
1267 private PanelFeatureState findMenuPanel(Menu menu) {
1272 if (panel != null && panel.menu == menu) {
1304 // Only try to perform menu shortcuts if preparePanel returned true (possible false
1305 // return value from application not wanting to show the menu).
1306 if ((st.isPrepared || preparePanel(st, event)) && st.menu != null) {
1307 // The menu is prepared now, perform the shortcut on it
1308 handled = st.menu.performShortcut(keyCode, event, flags);
1312 // Only close down the menu if we don't have an action bar keeping it open.
1333 if (st.menu != null) {
1335 st.menu.saveActionViewStates(savedActionViewStates);
1340 st.menu.stopDispatchingItemsChanged();
1341 st.menu.clear();
1450 public boolean onCreateActionMode(ActionMode mode, Menu menu) {
1451 return mWrapped.onCreateActionMode(mode, menu);
1454 public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
1455 return mWrapped.onPrepareActionMode(mode, menu);
1489 public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
1490 final Menu parentMenu = menu.getRootMenu();
1491 final boolean isSubMenu = parentMenu != menu;
1492 final PanelFeatureState panel = findMenuPanel(isSubMenu ? parentMenu : menu);
1498 // Close the panel and only do the callback if the menu is being
1499 // closed completely, not if opening a sub menu
1529 public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing) {
1530 checkCloseActionMenu(menu);
1559 MenuBuilder menu;
1573 * scenarios (user clicks on menu item), but can also happen with
1574 * chording menu+(shortcut key).
1589 * Contains the state of the menu when told to freeze.
1616 if (menu != null) {
1617 menu.removeMenuPresenter(listMenuPresenter);
1654 void setMenu(MenuBuilder menu) {
1655 if (menu == this.menu) return;
1657 if (this.menu != null) {
1658 this.menu.removeMenuPresenter(listMenuPresenter);
1660 this.menu = menu;
1661 if (menu != null) {
1662 if (listMenuPresenter != null) menu.addMenuPresenter(listMenuPresenter);
1667 if (menu == null) return null;
1673 menu.addMenuPresenter(listMenuPresenter);
1686 if (menu != null) {
1688 menu.savePresenterStates(savedState.menuState);
1705 if (menu != null && frozenMenuState != null) {
1706 menu.restorePresenterStates(frozenMenuState);