public class MenuDialogHelper extends Object implements MenuHelper, DialogInterface.OnKeyListener, DialogInterface.OnClickListener, DialogInterface.OnDismissListener, MenuPresenter.Callback
Constructor and Description |
---|
MenuDialogHelper(MenuBuilder menu) |
Modifier and Type | Method and Description |
---|---|
void |
dismiss()
Dismisses the menu's dialog.
|
void |
onClick(DialogInterface dialog,
int which)
This method will be invoked when a button in the dialog is clicked.
|
void |
onCloseMenu(MenuBuilder menu,
boolean allMenusAreClosing)
Called when a menu is closing.
|
void |
onDismiss(DialogInterface dialog)
This method will be invoked when the dialog is dismissed.
|
boolean |
onKey(DialogInterface dialog,
int keyCode,
KeyEvent event)
Called when a key is dispatched to a dialog.
|
boolean |
onOpenSubMenu(MenuBuilder subMenu)
Called when a submenu opens.
|
void |
setPresenterCallback(MenuPresenter.Callback cb) |
void |
show(IBinder windowToken)
Shows menu as a dialog.
|
public MenuDialogHelper(MenuBuilder menu)
public void show(IBinder windowToken)
windowToken
- Optional token to assign to the window.public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event)
DialogInterface.OnKeyListener
onKey
in interface DialogInterface.OnKeyListener
dialog
- The dialog the key has been dispatched to.keyCode
- The code for the physical key that was pressedevent
- The KeyEvent object containing full information about
the event.public void setPresenterCallback(MenuPresenter.Callback cb)
setPresenterCallback
in interface MenuHelper
public void dismiss()
dismiss
in interface MenuHelper
Dialog.dismiss()
public void onDismiss(DialogInterface dialog)
DialogInterface.OnDismissListener
onDismiss
in interface DialogInterface.OnDismissListener
dialog
- The dialog that was dismissed will be passed into the
method.public void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing)
MenuPresenter.Callback
onCloseMenu
in interface MenuPresenter.Callback
public boolean onOpenSubMenu(MenuBuilder subMenu)
MenuPresenter.Callback
onOpenSubMenu
in interface MenuPresenter.Callback
subMenu
- Submenu currently being openedpublic void onClick(DialogInterface dialog, int which)
DialogInterface.OnClickListener
onClick
in interface DialogInterface.OnClickListener
dialog
- The dialog that received the click.which
- The button that was clicked (e.g.
DialogInterface.BUTTON1
) or the position
of the item clicked.