public class

ContextualToolbarMenuBar

extends ViewGroup
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ com.pspdfkit.ui.toolbar.ContextualToolbarMenuBar

Class Overview

This view is a component of contextual toolbar. It is a bar holding ContextualToolbarMenuItems. If the item has a submenu, the contextual toolbar will display those items in a separate ContextualToolbarMenuBar below the main one.

Summary

Nested Classes
enum ContextualToolbarMenuBar.MenuItemPosition Possible positions for toolbar menu items. 
Constants
int MENU_BAR_ITEM_MARGIN_DP Margin between menu items.
int MENU_BAR_ROW_SIZE_DP Width (if vertical) or height (if horizontal) of the toolbar, includes item padding
int MENU_BAR_SIDE_PADDING_DP Padding on the sides of the menu bar (all 4 sides
int MENU_BAR_TEXT_ITEM_END_PADDING_DP Padding to be used for a text item at the very end of the toolbar
int TOOLBAR_ITEM_SIZE_DP Height/width of the contextual toolbar items in dps.
[Expand]
Inherited Constants
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
ContextualToolbarMenuBar(Context context)
ContextualToolbarMenuBar(Context context, AttributeSet attrs)
ContextualToolbarMenuBar(Context context, AttributeSet attrs, int defStyleAttr)
Public Methods
static int estimateItemCapacity(Context context, int availableSpaceInPx)
int getCornerRadiusPx()
List<ContextualToolbarMenuItem> getMenuItems()
Returns a copy of currently set menu items.
int getToolbarRowSize()
Completable hideMenuItems(boolean animate)
boolean onTouchEvent(MotionEvent event)
void setAlternateBackgroundColor(int color)
void setBackgroundColor(int color)
void setBorderAndBackgroundColor(int borderColor, int backgroundColor)
void setBorderColor(int color)
void setIsSubmenu(boolean isSubmenu)
Sets whether this toolbar menu bar is used for displaying submenu or not.
void setMenuItems(List<ContextualToolbarMenuItem> newItems)
Sets menu items to the toolbar.
Completable showMenuItems(boolean animate)
Protected Methods
Size getTotalChildrenSize()
Returns Size of the menu bar items and any additional padding.
void onLayout(boolean changed, int l, int t, int r, int b)
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
[Expand]
Inherited Methods
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.ViewManager
From interface android.view.ViewParent
From interface android.view.accessibility.AccessibilityEventSource

Constants

public static final int MENU_BAR_ITEM_MARGIN_DP

Margin between menu items.

Constant Value: 5 (0x00000005)

public static final int MENU_BAR_ROW_SIZE_DP

Width (if vertical) or height (if horizontal) of the toolbar, includes item padding

Constant Value: 58 (0x0000003a)

public static final int MENU_BAR_SIDE_PADDING_DP

Padding on the sides of the menu bar (all 4 sides

Constant Value: 5 (0x00000005)

public static final int MENU_BAR_TEXT_ITEM_END_PADDING_DP

Padding to be used for a text item at the very end of the toolbar

Constant Value: 16 (0x00000010)

public static final int TOOLBAR_ITEM_SIZE_DP

Height/width of the contextual toolbar items in dps.

Constant Value: 48 (0x00000030)

Public Constructors

public ContextualToolbarMenuBar (Context context)

public ContextualToolbarMenuBar (Context context, AttributeSet attrs)

public ContextualToolbarMenuBar (Context context, AttributeSet attrs, int defStyleAttr)

Public Methods

public static int estimateItemCapacity (Context context, int availableSpaceInPx)

public int getCornerRadiusPx ()

public List<ContextualToolbarMenuItem> getMenuItems ()

Returns a copy of currently set menu items.

public int getToolbarRowSize ()

public Completable hideMenuItems (boolean animate)

public boolean onTouchEvent (MotionEvent event)

public void setAlternateBackgroundColor (int color)

public void setBackgroundColor (int color)

public void setBorderAndBackgroundColor (int borderColor, int backgroundColor)

public void setBorderColor (int color)

public void setIsSubmenu (boolean isSubmenu)

Sets whether this toolbar menu bar is used for displaying submenu or not.

Parameters
isSubmenu true if displaying submenu, false if displaying the main menu.

public void setMenuItems (List<ContextualToolbarMenuItem> newItems)

Sets menu items to the toolbar. If the specified position is START, the items will be added to the far left or bottom if vertical, otherwise to the far right or top if vertical. This only prepares the items (they're scaled to 0f). Once you need to display them, call showMenuItems(boolean).

Parameters
newItems Items to be added to this toolbar menu bar.

public Completable showMenuItems (boolean animate)

Protected Methods

protected Size getTotalChildrenSize ()

Returns Size of the menu bar items and any additional padding. The menubar consists of two groups, the left/top items, and the right/bottom items, depending if the toolbar is layouted verticaly or horizontally. Each group has a sidepadding at the beginning and the end, so if the toolbar is fully populated there is a slightly bigger gap between the two groups.

protected void onLayout (boolean changed, int l, int t, int r, int b)

protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)