public class

ActionMenu

extends Object
java.lang.Object
   ↳ com.pspdfkit.ui.actionmenu.ActionMenu
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Bottom sheet menu showing a list of actions. The menu consists of two sections: Fixed menu items and dynamic menu items. You can set menu items by calling setMenuItems(List) which will a list of ActionMenuItem objects independent of their ActionMenuItem.MenuItemType (you set both fixed and dynamic menu items in one call). To show the configured ActionMenu call show().

Summary

Public Constructors
ActionMenu(FragmentActivity activity)
Creates a new ActionMenu and attaches it to the parent activity.
Public Methods
void addActionMenuListener(ActionMenuListener listener)
Adds new listener for action menu lifecycle and events.
void addMenuItem(ActionMenuItem menuItem)
Add menu item to action menu.
void addMenuItems(List<ActionMenuItem> menuItems)
Add all menu items to action menu.
void clearFixedMenuItems()
Clear all fixed menu items.
void clearMenuItems()
Clear all menu items.
void clearStandardMenuItems()
Clear all standard menu items.
static Drawable createActionMenuIcon(Context context, int drawableResId)
Get icon from drawable resource styled properly so it can be used in action menu.
void dismiss()
Dismiss action menu if shown.
List<ActionMenuItem> getMenuItems()
Retrieve list of action menu items.
boolean isShowing()
Check if action menu is currently visible.
void onAttach(FragmentActivity activity)
Called when menu is attached to the activity.
void onDetach()
Called when menu is being detached from activity.
void removeActionMenuListener(ActionMenuListener listener)
Removes a previously added listener.
void setMenuItems(List<ActionMenuItem> menuItems)
Replaces menu items with a new set.
void setTitle(int titleResId)
Sets text displayed in dialog title.
void setTitle(String dialogTitle)
Sets text displayed in dialog title.
boolean show()
Shows action menu.
Protected Methods
ActionMenuDialog getDialog()
void onDisplayActionMenu()
Called when action menu is displayed.
boolean onMenuItemClicked(ActionMenuItem menuItem)
Called when item inside action menu is clicked.
boolean onMenuItemLongClicked(ActionMenuItem menuItem)
Called when item inside action menu is long clicked.
void onNoActionsVisible()
Called when there are no actions in the menu.
void onRemoveActionMenu()
Called when action menu is hidden.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ActionMenu (FragmentActivity activity)

Creates a new ActionMenu and attaches it to the parent activity.

Parameters
activity The parent activity to which the menu will be attached.

Public Methods

public void addActionMenuListener (ActionMenuListener listener)

Adds new listener for action menu lifecycle and events. If the listener has already been added previously, this method will be a no-op. Adding null is not allowed, and will result in an exception.

Parameters
listener ActionMenuListener that should be notified of action menu lifecycle and events. Must be non-null.

public void addMenuItem (ActionMenuItem menuItem)

Add menu item to action menu.

public void addMenuItems (List<ActionMenuItem> menuItems)

Add all menu items to action menu.

public void clearFixedMenuItems ()

Clear all fixed menu items.

public void clearMenuItems ()

Clear all menu items.

public void clearStandardMenuItems ()

Clear all standard menu items.

public static Drawable createActionMenuIcon (Context context, int drawableResId)

Get icon from drawable resource styled properly so it can be used in action menu.

Parameters
context The context to retrieve resource from.
drawableResId Drawable resource representing menu icon.

public void dismiss ()

Dismiss action menu if shown.

public List<ActionMenuItem> getMenuItems ()

Retrieve list of action menu items.

Returns
  • List of all menu items.

public boolean isShowing ()

Check if action menu is currently visible.

Returns
  • True when action menu is currently visible.

public void onAttach (FragmentActivity activity)

Called when menu is attached to the activity. This is called when creating the ActionMenu, and when the parent activity has moved to the foreground.

Parameters
activity The parent activity of this ActionMenu.

public void onDetach ()

Called when menu is being detached from activity. This means that activity is in the background or is getting destroyed.

public void removeActionMenuListener (ActionMenuListener listener)

Removes a previously added listener. Upon calling this method the listener will no longer be notified of action menu lifecycle and events. If the listener has not been added, this method will be a no-op. Passing null is not allowed and will result in an exception.

Parameters
listener ActionMenuListener that should be removed. Must be non-null.

public void setMenuItems (List<ActionMenuItem> menuItems)

Replaces menu items with a new set.

public void setTitle (int titleResId)

Sets text displayed in dialog title.

public void setTitle (String dialogTitle)

Sets text displayed in dialog title.

public boolean show ()

Shows action menu.

Returns
  • True is going to be shown.

Protected Methods

protected ActionMenuDialog getDialog ()

protected void onDisplayActionMenu ()

Called when action menu is displayed.

protected boolean onMenuItemClicked (ActionMenuItem menuItem)

Called when item inside action menu is clicked.

Returns
  • True if you want to consume this event.

protected boolean onMenuItemLongClicked (ActionMenuItem menuItem)

Called when item inside action menu is long clicked.

Returns
  • True if you want to consume this event.

protected void onNoActionsVisible ()

Called when there are no actions in the menu.

protected void onRemoveActionMenu ()

Called when action menu is hidden.