Class ActionMenu

  • All Implemented Interfaces:

    
    public class ActionMenu
    
                        

    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 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 call show.

    • Constructor Detail

      • ActionMenu

        ActionMenu(FragmentActivity activity)
        Creates a new instance and attaches it to the parent activity.
        Parameters:
        activity - The parent activity to which the menu will be attached.
    • Method Detail

      • isShowing

         boolean isShowing()

        Check if action menu is currently visible.

        Returns:

        True when action menu is currently visible.

      • createActionMenuIcon

        @NonNull() static Drawable createActionMenuIcon(@NonNull() Context context, @DrawableRes() int drawableResId)

        Gets 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.
      • onAttach

         void onAttach(@NonNull() 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.
      • onDetach

         void onDetach()

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

      • addActionMenuListener

         void addActionMenuListener(@NonNull() 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.
      • removeActionMenuListener

         void removeActionMenuListener(@NonNull() 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.
      • show

         boolean show()

        Shows action menu.

        Returns:

        True is going to be shown.

      • dismiss

         void dismiss()

        Dismiss action menu if shown.

      • setTitle

         void setTitle(@StringRes() int titleResId)

        Sets text displayed in dialog title.