Quick menu

In this document
chevron_rightQuick menu events
chevron_rightDisable quick menu

QuickMenu extends RelativeLayout and is a child of PDFViewCtrl. By default, it shows up when a user long presses on a blank space or on text of PDFViewCtrl. It has a maximum of two rows of icons, and an overflow text list.

ScenarioMenu
Long press on blank space
Long press on blank space overflow
Long press on text
Long press on text overflow
To learn about each icon, see the icon cheat sheet.
To learn about how to customize the quick menu, see the customize quick menu guide.

Quick menu events

The quick menu has a number of built-in events. For example events will be raised when the quick menu is shown, dismissed or an item is clicked. Thus, you can have custom behavior when a quick menu item is clicked.

If your activity is using PdfViewCtrlTabHostFragment for showing pdf:

mPdfViewCtrlTabHostFragment.getCurrentPDFViewCtrlFragment()
    .addQuickMenuListener(new ToolManager.QuickMenuListener() {
        @Override
        public boolean onQuickMenuClicked(QuickMenuItem menuItem) {
            int which = menuItem.getItemId();
            // handle click event here
            // return true to stop executing internal logic
            return false;
        }

        @Override
        public void onQuickMenuShown() {

        }

        @Override
        public void onQuickMenuDismissed() {

        }
    });

Otherwise you can register the ToolManager.QuickMenuListener:

mToolManager.setQuickMenuListener(new ToolManager.QuickMenuListener() {
    @Override
    public boolean onQuickMenuClicked(QuickMenuItem menuItem) {
        int which = menuItem.getItemId();
        // handle click event here
        // return true to stop executing internal logic
        return false;
    }
    
    @Override
    public void onQuickMenuShown() {

    }
    
    @Override
    public void onQuickMenuDismissed() {

    }
});

Hide quick menu items

If there are tools that you would like to remove from the quick menu, you can disable them via the ToolManager.disableToolMode API. For example:

// disable TextSquigglyCreate tool, TextStrikeoutCreate tool
mToolManager.disableToolMode(new ToolMode[]{
    ToolManager.ToolMode.TEXT_SQUIGGLY,
    ToolManager.ToolMode.TEXT_STRIKEOUT}
);

Then, when long pressing on text, you will see:

Disable quick menu

If you would like to disable the long press quick menu, you can do so via the ToolManager.setDisableQuickMenu API. For example:

mToolManager.setDisableQuickMenu(true);