diff options
| author | Adam Powell <adamp@google.com> | 2014-05-23 17:27:24 -0700 |
|---|---|---|
| committer | Adam Powell <adamp@google.com> | 2014-05-28 12:36:38 -0700 |
| commit | e021e6ed8931a0a8296af182fc9b0c76b64fb0c4 (patch) | |
| tree | 8bf85bb26b93d8f44d42fcf36c63091a2174b851 /core/java/android/widget/ActionMenuView.java | |
| parent | 560ce61c598d9912c4adbd9c602f1a870fb478f4 (diff) | |
Toolbar factoring and ActionBar functionality integration
Toolbars now can act in the role of ActionBar with the exception of
navigation modes. Expandable action views are now supported as well as
populating menu items from a host window.
Change-Id: If477db9c7ad9f95723f28cf73cbf03a07ce9d6ad
Diffstat (limited to 'core/java/android/widget/ActionMenuView.java')
| -rw-r--r-- | core/java/android/widget/ActionMenuView.java | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/core/java/android/widget/ActionMenuView.java b/core/java/android/widget/ActionMenuView.java index 3975edf002b4..a9a5eae45266 100644 --- a/core/java/android/widget/ActionMenuView.java +++ b/core/java/android/widget/ActionMenuView.java @@ -69,6 +69,7 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo /** @hide */ public void setPresenter(ActionMenuPresenter presenter) { mPresenter = presenter; + mPresenter.setMenuView(this); } @Override @@ -488,7 +489,7 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo @Override public void onDetachedFromWindow() { super.onDetachedFromWindow(); - mPresenter.dismissPopupMenus(); + dismissPopupMenus(); } /** @hide */ @@ -578,6 +579,56 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo } /** + * Returns the current menu or null if one has not yet been configured. + * @hide Internal use only for action bar integration + */ + public MenuBuilder peekMenu() { + return mMenu; + } + + /** + * Show the overflow items from the associated menu. + * + * @return true if the menu was able to be shown, false otherwise + */ + public boolean showOverflowMenu() { + return mPresenter != null && mPresenter.showOverflowMenu(); + } + + /** + * Hide the overflow items from the associated menu. + * + * @return true if the menu was able to be hidden, false otherwise + */ + public boolean hideOverflowMenu() { + return mPresenter != null && mPresenter.hideOverflowMenu(); + } + + /** + * Check whether the overflow menu is currently showing. This may not reflect + * a pending show operation in progress. + * + * @return true if the overflow menu is currently showing + */ + public boolean isOverflowMenuShowing() { + return mPresenter != null && mPresenter.isOverflowMenuShowing(); + } + + /** @hide */ + public boolean isOverflowMenuShowPending() { + return mPresenter != null && mPresenter.isOverflowMenuShowPending(); + } + + /** + * Dismiss any popups associated with this menu view. + */ + public void dismissPopupMenus() { + if (mPresenter != null) { + mPresenter.dismissPopupMenus(); + } + } + + /** * @hide Private LinearLayout (superclass) API. Un-hide if LinearLayout API is made public. */ @Override |
