public class

QuickMenuItem

extends Object
implements MenuItem View.OnClickListener
java.lang.Object
   ↳ com.pdftron.pdf.tools.QuickMenuItem

Class Overview

the MenuItem inside QuickMenu

Summary

Nested Classes
@interface QuickMenuItem.MenuDisplayMode Menu display mode indicates where the menu item should be shown. 
Constants
int FIRST_ROW_MENU Menu display mode: display in first row
int ORDER_START Specifies menu item position in menu, if it is -1, then it is placed in front of the menu list.
int OVERFLOW_ROW_MENU Menu display mode: display in overflow list
int SECOND_ROW_MENU Menu display mode: display in second row
[Expand]
Inherited Constants
From interface android.view.MenuItem
Public Constructors
QuickMenuItem(Context context, String text, int displayMode, int color, float opacity)
Class Constructor
QuickMenuItem(Context context, int itemId, int displayMode)
Class Constructor
QuickMenuItem(Context context, String text, int displayMode)
Class Constructor
QuickMenuItem(Context context, int id)
Class Constructor
QuickMenuItem(Context context, String text)
Class Constructor
Public Methods
AppCompatImageButton createImageButton()
Creates image button that contains with corresponding icon, color, opacity
View createSubMenuView()
Creates a submenu view containing text and an arrow
Button createTextButton()
Creates text button that contains with corresponding icon, color, opacity
boolean equals(Object obj)
int getDisplayMode()
get where the menu item is displayed in quick menu
Drawable getIcon()
Returns the icon for this item as a Drawable (getting it from resources if it hasn't been loaded before).
int getIconColor()
get menu icon color
ColorStateList getIconTintList()
PorterDuff.Mode getIconTintMode()
Returns the blending mode used to apply the tint to this item's icon, if specified.
int getItemId()
get item id
float getOpacity()
get menu item icon opacity
int getOrder()
get order in quick menu list.
SubMenu getSubMenu()
Gets the sub-menu to be invoked when this item is selected, if it has one.
String getText()
get displayed text of menu item.
CharSequence getTitle()
Gets text of current quick menu item
CharSequence getTitleCondensed()
Retrieve the current condensed title of the item.
boolean hasColor()
check if menu has icon color
boolean hasIcon()
Check if this menu item has icon resource id
boolean hasOpacity()
Check if menu item has set opacity
boolean hasSubMenu()
Check whether this item has an associated sub-menu.
QuickMenuItem initSubMenu(ToolManager toolManager, boolean annotationPermission)
Initialize sub menu
boolean isEnabled()
boolean isVisible()
Return the visibility of the menu item.
void onClick(View v)
Called when button is clicked
MenuItem setActionProvider(ActionProvider actionProvider)
void setColor(int iconColor)
set menu icon color
MenuItem setEnabled(boolean enabled)
Return the enabled state of the menu item.
MenuItem setIcon(Drawable icon)
Change the icon associated with this item.
MenuItem setIcon(int iconRes)
Change the icon associated with this item.
MenuItem setIconTintList(ColorStateList tint)
Applies a tint to this item's icon.
MenuItem setIconTintMode(PorterDuff.Mode tintMode)
Specifies the blending mode used to apply the tint specified by setIconTintList(ColorStateList) to this item's icon.
MenuItem setItemId(int id)
Sets menu item id
MenuItem setOnMenuItemClickListener(MenuItem.OnMenuItemClickListener menuItemClickListener)
Sets a custom listener for invocation of this menu item.
void setOpacity(float opacity)
set menu item icon opacity
MenuItem setOrder(int order)
Sets order to show in quick menu
MenuItem setTitle(CharSequence title)
Sets text of current quick menu item
MenuItem setTitle(int title)
Sets text of current quick menu item
MenuItem setTitleCondensed(CharSequence title)
Change the condensed title associated with this item.
MenuItem setVisible(boolean visible)
Sets the visibility of the menu item.
String toString()
Returns title of quick menu item
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.view.MenuItem
From interface android.view.View.OnClickListener

Constants

public static final int FIRST_ROW_MENU

Menu display mode: display in first row

Constant Value: 0 (0x00000000)

public static final int ORDER_START

Specifies menu item position in menu, if it is -1, then it is placed in front of the menu list.

Constant Value: -1 (0xffffffff)

public static final int OVERFLOW_ROW_MENU

Menu display mode: display in overflow list

Constant Value: 2 (0x00000002)

public static final int SECOND_ROW_MENU

Menu display mode: display in second row

Constant Value: 1 (0x00000001)

Public Constructors

public QuickMenuItem (Context context, String text, int displayMode, int color, float opacity)

Class Constructor

Parameters
text : Menu display text
displayMode : whether menu displayed in first row, second row, or hide in overflow
color : menu icon color
opacity : menu icon opacity

public QuickMenuItem (Context context, int itemId, int displayMode)

Class Constructor

public QuickMenuItem (Context context, String text, int displayMode)

Class Constructor

public QuickMenuItem (Context context, int id)

Class Constructor

public QuickMenuItem (Context context, String text)

Class Constructor

Public Methods

public AppCompatImageButton createImageButton ()

Creates image button that contains with corresponding icon, color, opacity

Returns
  • image button

public View createSubMenuView ()

Creates a submenu view containing text and an arrow

Returns
  • submenu view

public Button createTextButton ()

Creates text button that contains with corresponding icon, color, opacity

Returns
  • text button

public boolean equals (Object obj)

public int getDisplayMode ()

get where the menu item is displayed in quick menu

Returns
  • display mode

public Drawable getIcon ()

Returns the icon for this item as a Drawable (getting it from resources if it hasn't been loaded before). Note that if you call setIconTintList(ColorStateList) or setIconTintMode(PorterDuff.Mode) on this item, and you use a custom menu presenter in your application, you have to apply the tinting explicitly on the Drawable returned by this method.

Returns
  • The icon as a Drawable.

public int getIconColor ()

get menu icon color

Returns
  • menu icon color

public ColorStateList getIconTintList ()

Returns
  • the tint applied to this item's icon

public PorterDuff.Mode getIconTintMode ()

Returns the blending mode used to apply the tint to this item's icon, if specified.

Returns
  • the blending mode used to apply the tint to this item's icon

public int getItemId ()

get item id

Returns
  • menu item id

public float getOpacity ()

get menu item icon opacity

Returns
  • menu item icon opacity

public int getOrder ()

get order in quick menu list.

Returns
  • quick menu order

public SubMenu getSubMenu ()

Gets the sub-menu to be invoked when this item is selected, if it has one. See hasSubMenu().

Returns
  • The associated menu if there is one, else null

public String getText ()

get displayed text of menu item. long pressing menu item will show text.

Returns
  • menu item text

public CharSequence getTitle ()

Gets text of current quick menu item

Returns
  • quick menu item display text

public CharSequence getTitleCondensed ()

Retrieve the current condensed title of the item. If a condensed title was never set, it will return the normal title.

Returns
  • The condensed title, if it exists. Otherwise the normal title.

public boolean hasColor ()

check if menu has icon color

Returns
  • true if menu item has icon color, false otherwise

public boolean hasIcon ()

Check if this menu item has icon resource id

Returns
  • true if menu item has icon resource id

public boolean hasOpacity ()

Check if menu item has set opacity

Returns
  • true if menu item has opacity, false otherwise

public boolean hasSubMenu ()

Check whether this item has an associated sub-menu. I.e. it is a sub-menu of another menu.

Returns
  • If true this item has a menu; else it is a normal item.

public QuickMenuItem initSubMenu (ToolManager toolManager, boolean annotationPermission)

Initialize sub menu

Parameters
toolManager tool manager
annotationPermission whether annotation has permission
Returns
  • this quick menu item

public boolean isEnabled ()

public boolean isVisible ()

Return the visibility of the menu item.

Returns
  • If true the item is visible; else it is hidden.

public void onClick (View v)

Called when button is clicked

Parameters
v view

public MenuItem setActionProvider (ActionProvider actionProvider)

public void setColor (int iconColor)

set menu icon color

Parameters
iconColor menu icon color

public MenuItem setEnabled (boolean enabled)

Return the enabled state of the menu item.

Returns
  • If true the item is enabled and hence invokable; else it is not.

public MenuItem setIcon (Drawable icon)

Change the icon associated with this item. This icon will not always be shown, so the title should be sufficient in describing this item. See Menu for the menu types that support icons.

Parameters
icon The new icon (as a Drawable) to be displayed.
Returns
  • This Item so additional setters can be called.

public MenuItem setIcon (int iconRes)

Change the icon associated with this item. This icon will not always be shown, so the title should be sufficient in describing this item. See Menu for the menu types that support icons.

This method will set the resource ID of the icon which will be used to lazily get the Drawable when this item is being shown.

Parameters
iconRes The new icon (as a resource ID) to be displayed.
Returns
  • This Item so additional setters can be called.

public MenuItem setIconTintList (ColorStateList tint)

Applies a tint to this item's icon. Does not modify the current tint mode, which is PorterDuff.Mode.SRC_IN by default.

Subsequent calls to setIcon(Drawable) or setIcon(int) will automatically mutate the icon and apply the specified tint and tint mode using Drawable.setTintList(ColorStateList).

Parameters
tint the tint to apply, may be null to clear tint

public MenuItem setIconTintMode (PorterDuff.Mode tintMode)

Specifies the blending mode used to apply the tint specified by setIconTintList(ColorStateList) to this item's icon. The default mode is PorterDuff.Mode.SRC_IN.

Parameters
tintMode the blending mode used to apply the tint, may be null to clear tint

public MenuItem setItemId (int id)

Sets menu item id

Parameters
id menu item id
Returns
  • menu item

public MenuItem setOnMenuItemClickListener (MenuItem.OnMenuItemClickListener menuItemClickListener)

Sets a custom listener for invocation of this menu item. In most situations, it is more efficient and easier to use

Parameters
menuItemClickListener The object to receive invokations.
Returns
  • This Item so additional setters can be called.

public void setOpacity (float opacity)

set menu item icon opacity

Parameters
opacity menu item icon opacity

public MenuItem setOrder (int order)

Sets order to show in quick menu

Parameters
order order

public MenuItem setTitle (CharSequence title)

Sets text of current quick menu item

Parameters
title quick menu item display text
Returns
  • quick menu item

public MenuItem setTitle (int title)

Sets text of current quick menu item

Parameters
title quick menu item display text resource
Returns
  • quick menu item

public MenuItem setTitleCondensed (CharSequence title)

Change the condensed title associated with this item. The condensed title is used in situations where the normal title may be too long to be displayed.

Parameters
title The new text to be displayed as the condensed title.
Returns
  • This Item so additional setters can be called.

public MenuItem setVisible (boolean visible)

Sets the visibility of the menu item. Even if a menu item is not visible, it may still be invoked via its shortcut (to completely disable an item, set it to invisible and disabled).

Parameters
visible If true then the item will be visible; if false it is hidden.
Returns
  • This Item so additional setters can be called.

public String toString ()

Returns title of quick menu item

Returns
  • title