MenuBuilder

Implementation of the androidx.core.internal.view.SupportMenu interface for creating a standard menu UI.

Inheritors

Constructors

Link copied to clipboard
constructor(context: Context)

Types

Link copied to clipboard
Called by menu to notify of close and selection changes.
Link copied to clipboard
Called by menu items to execute their associated action

Functions

Link copied to clipboard
open fun add(titleRes: Int): MenuItem
open fun add(title: CharSequence): MenuItem
open fun add(group: Int, id: Int, categoryOrder: Int, title: Int): MenuItem
open fun add(group: Int, id: Int, categoryOrder: Int, title: CharSequence): MenuItem
Link copied to clipboard
open fun addIntentOptions(group: Int, id: Int, categoryOrder: Int, caller: ComponentName, specifics: Array<Intent>, intent: Intent, flags: Int, outSpecificItems: Array<MenuItem>): Int
Link copied to clipboard
open fun addMenuPresenter(presenter: MenuPresenter)
Add a presenter to this menu.
open fun addMenuPresenter(presenter: MenuPresenter, menuContext: Context)
Add a presenter to this menu that uses an alternate context for inflating menu items.
Link copied to clipboard
open fun addSubMenu(titleRes: Int): SubMenu
open fun addSubMenu(title: CharSequence): SubMenu
open fun addSubMenu(group: Int, id: Int, categoryOrder: Int, title: Int): SubMenu
open fun addSubMenu(group: Int, id: Int, categoryOrder: Int, title: CharSequence): SubMenu
Link copied to clipboard
open fun changeMenuMode()
Dispatch a mode change event to this menu's callback.
Link copied to clipboard
open fun clear()
Link copied to clipboard
open fun clearAll()
Link copied to clipboard
open fun clearHeader()
Link copied to clipboard
open fun close()

fun close(closeAllMenus: Boolean)
Closes the menu.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun findGroupIndex(group: Int): Int
open fun findGroupIndex(group: Int, start: Int): Int
Link copied to clipboard
open fun findItem(id: Int): MenuItem
Link copied to clipboard
open fun findItemIndex(id: Int): Int
Link copied to clipboard
open fun flagActionItems()
This method determines which menu items get to be 'action items' that will appear in an action bar and which items should be 'overflow items' in a secondary menu.
Link copied to clipboard
Link copied to clipboard
open fun getContext(): Context
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getHeaderView(): View
Link copied to clipboard
open fun getItem(index: Int): MenuItem
Link copied to clipboard
Link copied to clipboard
Gets the root menu (if this is a submenu, find its root menu).
Link copied to clipboard
@NonNull
open fun getVisibleItems(): @NonNull ArrayList<MenuItemImpl>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun isShortcutKey(keyCode: Int, event: KeyEvent): Boolean
Link copied to clipboard
Link copied to clipboard
open fun onItemsChanged(structureChanged: Boolean)
Called when an item is added or removed.
Link copied to clipboard
open fun performIdentifierAction(id: Int, flags: Int): Boolean
Link copied to clipboard
open fun performItemAction(item: MenuItem, flags: Int): Boolean
open fun performItemAction(item: MenuItem, preferredPresenter: MenuPresenter, flags: Int): Boolean
Link copied to clipboard
open fun performShortcut(keyCode: Int, event: KeyEvent, flags: Int): Boolean
Link copied to clipboard
open fun removeGroup(group: Int)
Link copied to clipboard
open fun removeItem(id: Int)
Link copied to clipboard
open fun removeItemAt(index: Int)
Link copied to clipboard
open fun removeMenuPresenter(presenter: MenuPresenter)
Remove a presenter from this menu.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun saveActionViewStates(outStates: Bundle)
Link copied to clipboard
open fun savePresenterStates(outState: Bundle)
Link copied to clipboard
Link copied to clipboard
Sets the current menu info that is set on all items added to this menu (until this is called again with different menu info, in which case that one will be added to all subsequent item additions).
Link copied to clipboard
open fun setDefaultShowAsAction(defaultShowAsAction: Int): MenuBuilder
Link copied to clipboard
open fun setGroupCheckable(group: Int, checkable: Boolean, exclusive: Boolean)
Link copied to clipboard
open fun setGroupDividerEnabled(enabled: Boolean)
Link copied to clipboard
open fun setGroupEnabled(group: Int, enabled: Boolean)
Link copied to clipboard
open fun setGroupVisible(group: Int, visible: Boolean)
Link copied to clipboard
open fun setOptionalIconsVisible(visible: Boolean)
Link copied to clipboard
open fun setOverrideVisibleItems(override: Boolean)
Allows us to override the value of hasVisibleItems and make it always return true.
Link copied to clipboard
open fun setQwertyMode(isQwerty: Boolean)
Link copied to clipboard
open fun setShortcutsVisible(shortcutsVisible: Boolean)
Sets whether the shortcuts should be visible on menus.
Link copied to clipboard
open fun size(): Int
Link copied to clipboard
Link copied to clipboard
Stop dispatching item changed events to presenters until startDispatchingItemsChanged is called.