public abstract class ActionMenuActivity
extends DynamicThemeActivity
Constructor and Description |
---|
ActionMenuActivity() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
alwaysShowActionMenu()
Determines if the action menu is shown always or only after user
interaction.
|
protected void |
closeActionMenu(boolean animate)
Programmatically closes the action menu.
|
boolean |
dispatchKeyEvent(android.view.KeyEvent event) |
boolean |
dispatchTouchEvent(android.view.MotionEvent ev) |
protected int |
getActionMenuGravity()
Determines the gravity of the action menu.
|
android.content.Context |
getContext() |
protected int |
getCurrentMenuIndex()
Retrieve the index in the menu for the currently selected MenuItem.
|
protected int |
getDefaultAction()
Determines the default action item that will be selected when the action
menu displays.
|
protected int |
getDefaultActionId()
Allows subclasses to specify the default item in the menu based on id.
|
protected int |
getMenuItemIndex(android.view.MenuItem item,
boolean visibleOnly)
Retrieve the index in the menu for a specific MenuItem.
|
protected boolean |
interceptAllTouches()
Determines if all touch events in the activity will be intercepted by the action menu.
|
protected void |
invalidateActionMenu()
Declare that the action menu has changed, so should be recreated.
|
protected void |
onActionItemFocused(android.view.MenuItem item)
This hook is called whenever the focused item in your action menu changes.
|
protected boolean |
onActionItemSelected(android.view.MenuItem item)
This hook is called whenever an item in your action menu is selected.
|
protected void |
onActionMenuClosed()
Called when the action menu is dismissed via a two-finger tap gesture.
|
boolean |
onActionMenuItemSelected(android.view.MenuItem item) |
void |
onAttachedToWindow() |
protected void |
onCreate(android.os.Bundle savedInstanceState) |
protected boolean |
onCreateActionMenu(android.view.Menu menu)
Initialize the contents of the Activity's action menu.
|
void |
onDetachedFromWindow() |
boolean |
onKeyUp(int keyCode,
android.view.KeyEvent event) |
protected void |
onPause() |
protected boolean |
onPrepareActionMenu(android.view.Menu menu)
Prepare the Screen's action menu to be displayed.
|
protected void |
onResume() |
protected void |
onSaveInstanceState(android.os.Bundle outState) |
protected void |
openActionMenu()
Programmatically opens the action menu.
|
protected void |
openActionMenu(boolean animate)
Programmatically opens the action menu.
|
protected void |
setCurrentMenuIndex(int index,
boolean animate)
Programmatically set a specific index to be the currently selected
item.
|
protected void |
setCurrentMenuItem(android.view.MenuItem item,
boolean animate)
Programmatically set a specific MenuItem to be the currently selected
item.
|
protected void |
setSpeechEnabled(boolean enable)
Sets whether action menu items will automatically be registered with the speech recognition
service.
|
protected void onCreate(android.os.Bundle savedInstanceState)
public android.content.Context getContext()
public void onAttachedToWindow()
public void onDetachedFromWindow()
protected void onSaveInstanceState(android.os.Bundle outState)
protected void onResume()
protected void onPause()
public final boolean onActionMenuItemSelected(android.view.MenuItem item)
protected void setSpeechEnabled(boolean enable)
enable
- true to enable automatic speech recognition registration, false otherwiseprotected boolean alwaysShowActionMenu()
protected void invalidateActionMenu()
onCreateActionMenu(Menu)
method will be called the next
time it needs to be displayed. If the action menu is currently being
displayed, the menu will be rebuilt immediately.protected boolean onCreateActionMenu(android.view.Menu menu)
This is only called once, the first time the action menu is
displayed. To update the menu every time it is displayed, see
onPrepareActionMenu(android.view.Menu)
.
The default implementation populates the menu with a back menu item. Deriving classes should always call through to the base implementation.
You can safely hold on to menu (and any items created from it), making modifications to it as desired, until the next time onCreateOptionsMenu() is called.
When you add items to the menu, you can implement the Activity's
onActionItemSelected(android.view.MenuItem)
method to handle them there.
menu
- The action menu in which you place your items.onPrepareActionMenu(android.view.Menu)
,
onActionItemSelected(android.view.MenuItem)
protected int getDefaultAction()
protected int getDefaultActionId()
protected boolean onPrepareActionMenu(android.view.Menu menu)
menu
- The options menu as last shown or first initialized by
onCreateActionMenu().onCreateActionMenu(android.view.Menu)
protected void onActionItemFocused(android.view.MenuItem item)
item
- The menu item that has focus.protected boolean onActionItemSelected(android.view.MenuItem item)
Derived classes should call through to the base class for it to perform the default menu handling.
You will need to call this super method in a derived class before checking the state of a checkable ActionMenuItem within this function. This ensures the ActionMenuItem properly animates.
item
- The menu item that was selected.onCreateActionMenu(android.view.Menu)
protected void onActionMenuClosed()
protected void setCurrentMenuItem(android.view.MenuItem item, boolean animate)
item
- The MenuItem to selectanimate
- whether or not to animate the selection changeprotected void setCurrentMenuIndex(int index, boolean animate)
index
- The index of a MenuItem to selectanimate
- whether or not to animate the selection changeprotected int getCurrentMenuIndex()
protected int getMenuItemIndex(android.view.MenuItem item, boolean visibleOnly)
item
- The MenuItem to look forvisibleOnly
- if true, only the currently visible menu items
will be searchedprotected void openActionMenu()
protected void openActionMenu(boolean animate)
animate
- true to animate the menu, false to show it without animationprotected int getActionMenuGravity()
protected void closeActionMenu(boolean animate)
animate
- true to animate the menu, false to show it without animationpublic boolean onKeyUp(int keyCode, android.view.KeyEvent event)
public boolean dispatchTouchEvent(android.view.MotionEvent ev)
protected boolean interceptAllTouches()
public boolean dispatchKeyEvent(android.view.KeyEvent event)