com.actionbarsherlock.internal.view.menu
Class SubMenuBuilder

java.lang.Object
  extended by com.actionbarsherlock.internal.view.menu.MenuBuilder
      extended by com.actionbarsherlock.internal.view.menu.SubMenuBuilder
All Implemented Interfaces:
Menu, SubMenu

public class SubMenuBuilder
extends MenuBuilder
implements SubMenu

The model for a sub menu, which is an extension of the menu. Most methods are proxied to the parent menu.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.actionbarsherlock.internal.view.menu.MenuBuilder
MenuBuilder.Callback, MenuBuilder.ItemInvoker
 
Field Summary
 
Fields inherited from interface com.actionbarsherlock.view.Menu
CATEGORY_ALTERNATIVE, CATEGORY_CONTAINER, CATEGORY_MASK, CATEGORY_SECONDARY, CATEGORY_SHIFT, CATEGORY_SYSTEM, FIRST, FLAG_ALWAYS_PERFORM_CLOSE, FLAG_APPEND_TO_GROUP, FLAG_PERFORM_NO_CLOSE, NONE, USER_MASK, USER_SHIFT
 
Constructor Summary
SubMenuBuilder(android.content.Context context, MenuBuilder parentMenu, MenuItemImpl item)
           
 
Method Summary
 boolean collapseItemActionView(MenuItemImpl item)
           
 boolean expandItemActionView(MenuItemImpl item)
           
 String getActionViewStatesKey()
           
 MenuItem getItem()
          Gets the MenuItem that represents this submenu in the parent menu.
 Menu getParentMenu()
           
 MenuBuilder getRootMenu()
          Gets the root menu (if this is a submenu, find its root menu).
 boolean isQwertyMode()
           
 boolean isShortcutsVisible()
           
 void setCallback(MenuBuilder.Callback callback)
           
 SubMenu setHeaderIcon(android.graphics.drawable.Drawable icon)
          Sets the submenu header's icon to the icon given in icon Drawable.
 SubMenu setHeaderIcon(int iconRes)
          Sets the submenu header's icon to the icon given in iconRes resource id.
 SubMenu setHeaderTitle(CharSequence title)
          Sets the submenu header's title to the title given in title.
 SubMenu setHeaderTitle(int titleRes)
          Sets the submenu header's title to the title given in titleRes resource identifier.
 SubMenu setHeaderView(android.view.View view)
          Sets the header of the submenu to the View given in view.
 SubMenu setIcon(android.graphics.drawable.Drawable icon)
          Change the icon associated with this submenu's item in its parent menu.
 SubMenu setIcon(int iconRes)
          Change the icon associated with this submenu's item in its parent menu.
 void setQwertyMode(boolean isQwerty)
          Control whether the menu should be running in qwerty mode (alphabetic shortcuts) or 12-key mode (numeric shortcuts).
 void setShortcutsVisible(boolean shortcutsVisible)
          Sets whether the shortcuts should be visible on menus.
 
Methods inherited from class com.actionbarsherlock.internal.view.menu.MenuBuilder
add, add, add, add, addIntentOptions, addMenuPresenter, addSubMenu, addSubMenu, addSubMenu, addSubMenu, bindNativeOverflow, changeMenuMode, clear, clearAll, clearHeader, close, findGroupIndex, findGroupIndex, findItem, findItemIndex, flagActionItems, getContext, getExpandedItem, getHeaderIcon, getHeaderTitle, getHeaderView, getItem, hasVisibleItems, isShortcutKey, performIdentifierAction, performItemAction, performShortcut, removeGroup, removeItem, removeItemAt, removeMenuPresenter, restoreActionViewStates, restorePresenterStates, saveActionViewStates, savePresenterStates, setCurrentMenuInfo, setDefaultShowAsAction, setGroupCheckable, setGroupEnabled, setGroupVisible, setHeaderIconInt, setHeaderIconInt, setHeaderTitleInt, setHeaderTitleInt, setHeaderViewInt, size, startDispatchingItemsChanged, stopDispatchingItemsChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.actionbarsherlock.view.SubMenu
clearHeader
 
Methods inherited from interface com.actionbarsherlock.view.Menu
add, add, add, add, addIntentOptions, addSubMenu, addSubMenu, addSubMenu, addSubMenu, clear, close, findItem, getItem, hasVisibleItems, isShortcutKey, performIdentifierAction, performShortcut, removeGroup, removeItem, setGroupCheckable, setGroupEnabled, setGroupVisible, size
 

Constructor Detail

SubMenuBuilder

public SubMenuBuilder(android.content.Context context,
                      MenuBuilder parentMenu,
                      MenuItemImpl item)
Method Detail

setQwertyMode

public void setQwertyMode(boolean isQwerty)
Description copied from interface: Menu
Control whether the menu should be running in qwerty mode (alphabetic shortcuts) or 12-key mode (numeric shortcuts).

Specified by:
setQwertyMode in interface Menu
Overrides:
setQwertyMode in class MenuBuilder
Parameters:
isQwerty - If true the menu will use alphabetic shortcuts; else it will use numeric shortcuts.

isQwertyMode

public boolean isQwertyMode()
Returns:
whether the menu shortcuts are in qwerty mode or not

setShortcutsVisible

public void setShortcutsVisible(boolean shortcutsVisible)
Description copied from class: MenuBuilder
Sets whether the shortcuts should be visible on menus. Devices without hardware key input will never make shortcuts visible even if this method is passed 'true'.

Overrides:
setShortcutsVisible in class MenuBuilder
Parameters:
shortcutsVisible - Whether shortcuts should be visible (if true and a menu item does not have a shortcut defined, that item will still NOT show a shortcut)

isShortcutsVisible

public boolean isShortcutsVisible()
Overrides:
isShortcutsVisible in class MenuBuilder
Returns:
Whether shortcuts should be visible on menus.

getParentMenu

public Menu getParentMenu()

getItem

public MenuItem getItem()
Description copied from interface: SubMenu
Gets the MenuItem that represents this submenu in the parent menu. Use this for setting additional item attributes.

Specified by:
getItem in interface SubMenu
Returns:
The MenuItem that launches the submenu when invoked.

setCallback

public void setCallback(MenuBuilder.Callback callback)
Overrides:
setCallback in class MenuBuilder

getRootMenu

public MenuBuilder getRootMenu()
Description copied from class: MenuBuilder
Gets the root menu (if this is a submenu, find its root menu).

Overrides:
getRootMenu in class MenuBuilder
Returns:
The root menu.

setIcon

public SubMenu setIcon(android.graphics.drawable.Drawable icon)
Description copied from interface: SubMenu
Change the icon associated with this submenu's item in its parent menu.

Specified by:
setIcon in interface SubMenu
Parameters:
icon - The new icon (as a Drawable) to be displayed.
Returns:
This SubMenu so additional setters can be called.
See Also:
MenuItem.setIcon(Drawable)

setIcon

public SubMenu setIcon(int iconRes)
Description copied from interface: SubMenu
Change the icon associated with this submenu's item in its parent menu.

Specified by:
setIcon in interface SubMenu
Parameters:
iconRes - The new icon (as a resource ID) to be displayed.
Returns:
This SubMenu so additional setters can be called.
See Also:
MenuItem.setIcon(int)

setHeaderIcon

public SubMenu setHeaderIcon(android.graphics.drawable.Drawable icon)
Description copied from interface: SubMenu
Sets the submenu header's icon to the icon given in icon Drawable.

Specified by:
setHeaderIcon in interface SubMenu
Parameters:
icon - The Drawable used for the icon.
Returns:
This SubMenu so additional setters can be called.

setHeaderIcon

public SubMenu setHeaderIcon(int iconRes)
Description copied from interface: SubMenu
Sets the submenu header's icon to the icon given in iconRes resource id.

Specified by:
setHeaderIcon in interface SubMenu
Parameters:
iconRes - The resource identifier used for the icon.
Returns:
This SubMenu so additional setters can be called.

setHeaderTitle

public SubMenu setHeaderTitle(CharSequence title)
Description copied from interface: SubMenu
Sets the submenu header's title to the title given in title.

Specified by:
setHeaderTitle in interface SubMenu
Parameters:
title - The character sequence used for the title.
Returns:
This SubMenu so additional setters can be called.

setHeaderTitle

public SubMenu setHeaderTitle(int titleRes)
Description copied from interface: SubMenu
Sets the submenu header's title to the title given in titleRes resource identifier.

Specified by:
setHeaderTitle in interface SubMenu
Parameters:
titleRes - The string resource identifier used for the title.
Returns:
This SubMenu so additional setters can be called.

setHeaderView

public SubMenu setHeaderView(android.view.View view)
Description copied from interface: SubMenu
Sets the header of the submenu to the View given in view. This replaces the header title and icon (and those replace this).

Specified by:
setHeaderView in interface SubMenu
Parameters:
view - The View used for the header.
Returns:
This SubMenu so additional setters can be called.

expandItemActionView

public boolean expandItemActionView(MenuItemImpl item)
Overrides:
expandItemActionView in class MenuBuilder

collapseItemActionView

public boolean collapseItemActionView(MenuItemImpl item)
Overrides:
collapseItemActionView in class MenuBuilder

getActionViewStatesKey

public String getActionViewStatesKey()
Overrides:
getActionViewStatesKey in class MenuBuilder


Copyright © 2012-2013. All Rights Reserved.