Customize quick menu in Android

QuickMenu is a convenient annotation popup menu that appears when a user long-presses on a blank space or on text contained in a PDFViewCtrl. It extends RelativeLayout and is a child view of PDFViewCtrl.

Action

Menu

Long-press on blank space

Apryse Docs Image

Long-press on text

Apryse Docs Image

To learn more about each icon, see the icon cheat sheet .

To learn how to customize the quick menu, see the customize quick menu guide .

Quick menu events

A number of events may be raised when a user interacts with the quick menu. For example, events will be raised when the quick menu is shown, dismissed, or when a quick menu item is clicked. You can register a QuickMenuListener to listen to such events and implement custom behavior accordingly.

If your activity is using PdfViewCtrlTabHostFragment2 for viewing PDF files, you can set your listener by calling:

1mPdfViewCtrlTabHostFragment.getCurrentPDFViewCtrlFragment()
2 .addQuickMenuListener(new ToolManager.QuickMenuListener() {
3 @Override
4 public boolean onQuickMenuClicked(QuickMenuItem menuItem) {
5 int which = menuItem.getItemId();
6 // Handle click event...
7 // Return true to stop executing internal logic
8 return true;
9 }
10
11 @Override
12 public void onQuickMenuShown() {
13 // Called when the quick menu is shown
14 }
15
16 @Override
17 public void onQuickMenuDismissed() {
18 // Called when the quick menu is dismissed
19 }
20 });

Or you can register the listener using the ToolManager by calling ToolManager.setQuickMenuListener:

1mToolManager.setQuickMenuListener(new ToolManager.QuickMenuListener() {
2 @Override
3 public boolean onQuickMenuClicked(QuickMenuItem menuItem) {
4 int which = menuItem.getItemId();
5 // Handle click event...
6 // Return true to stop executing internal logic
7 return true;
8 }
9
10 @Override
11 public void onQuickMenuShown() {
12 // Called when the quick menu is shown
13 }
14
15 @Override
16 public void onQuickMenuDismissed() {
17 // Called when the quick menu is dismissed
18 }
19});

Hide quick menu items

If there are tools that you would like to remove from the quick menu, you can hide them by calling ToolManager.disableToolMode:

1// Disable TextSquigglyCreate tool, TextStrikeoutCreate tool
2mToolManager.disableToolMode(new ToolMode[]{
3 ToolManager.ToolMode.TEXT_SQUIGGLY,
4 ToolManager.ToolMode.TEXT_STRIKEOUT}
5);

Then, when you long-press on text you will see:

Apryse Docs Image

ToolMode icon mapping table

Icon

ToolMode

Apryse Docs Image

RECT_CREATE

Apryse Docs Image

OVAL_CREATE

Apryse Docs Image

POLYLINE_CREATE

Apryse Docs Image

POLYGON_CREATE

Apryse Docs Image

CLOUD_CREATE

Apryse Docs Image

LINE_CREATE

Apryse Docs Image

ARROW_CREATE

Apryse Docs Image

RULER_CREATE

Apryse Docs Image

TEXT_CREATE

Apryse Docs Image

CALLOUT_CREATE

Apryse Docs Image

TEXT_ANNOT_CREATE

Apryse Docs Image

INK_CREATE

Apryse Docs Image

INK_ERASER

Apryse Docs Image

SIGNATURE

Apryse Docs Image

STAMPER

Apryse Docs Image

RUBBER_STAMPER

Apryse Docs Image

FREE_HIGHLIGHTER

Apryse Docs Image

TEXT_HIGHLIGHT

Apryse Docs Image

TEXT_UNDERLINE

Apryse Docs Image

TEXT_SQUIGGLY

Apryse Docs Image

TEXT_STRIKEOUT

Apryse Docs Image

ANNOT_EDIT_RECT_GROUP

Disable quick menu

If you would like to hide the long press quick menu entirely, you can do so by calling ToolManager.setDisableQuickMenu. For example:

1mToolManager.setDisableQuickMenu(true);

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales