public class AppMenuButtonHelper
extends AccessibilityDelegate
Simply construct this class and pass the class instance to a menu button as TouchListener. Then this class will handle everything regarding showing app menu for you.
| 构造器和说明 |
|---|
AppMenuButtonHelper(AppMenuHandler menuHandler) |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
isAppMenuActive() |
boolean |
onEnterKeyPress(View view)
Handle the key press event on a menu button.
|
boolean |
onTouch(View view,
MotionEvent event) |
boolean |
performAccessibilityAction(View host,
int action,
Bundle args) |
void |
setMenuShowsFromBottom(boolean showsFromBottom) |
void |
setOnAppMenuShownListener(java.lang.Runnable onAppMenuShownListener) |
void |
setOnClickRunnable(java.lang.Runnable clickRunnable)
Set a runnable for click events on the menu button.
|
void |
setShowMenuOnUp(boolean showMenuOnUp) |
public AppMenuButtonHelper(AppMenuHandler menuHandler)
menuHandler - MenuHandler implementation that can show and get the app menu.public void setMenuShowsFromBottom(boolean showsFromBottom)
showsFromBottom - Whether the menu shows from the bottom by default.public void setOnAppMenuShownListener(java.lang.Runnable onAppMenuShownListener)
onAppMenuShownListener - This is called when the app menu is shown by this class.public void setShowMenuOnUp(boolean showMenuOnUp)
showMenuOnUp - Whether app menu should show on the up action.
If false, the app menu will be shown on the down action.public boolean isAppMenuActive()
public boolean onEnterKeyPress(View view)
view - View that received the enter key press event.public void setOnClickRunnable(java.lang.Runnable clickRunnable)
clickRunnable - The Runnable to be executed on a down event.public boolean onTouch(View view,
MotionEvent event)
public boolean performAccessibilityAction(View host,
int action,
Bundle args)