Some test text!
Android / Guides / Quick menu
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 | |
Long-press on text |
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:
mPdfViewCtrlTabHostFragment.getCurrentPDFViewCtrlFragment()
.addQuickMenuListener(new ToolManager.QuickMenuListener() {
@Override
public boolean onQuickMenuClicked(QuickMenuItem menuItem) {
int which = menuItem.getItemId();
// Handle click event...
// Return true to stop executing internal logic
return true;
}
@Override
public void onQuickMenuShown() {
// Called when the quick menu is shown
}
@Override
public void onQuickMenuDismissed() {
// Called when the quick menu is dismissed
}
});
Or you can register the listener using the ToolManager
by calling ToolManager.setQuickMenuListener
:
mToolManager.setQuickMenuListener(new ToolManager.QuickMenuListener() {
@Override
public boolean onQuickMenuClicked(QuickMenuItem menuItem) {
int which = menuItem.getItemId();
// Handle click event...
// Return true to stop executing internal logic
return true;
}
@Override
public void onQuickMenuShown() {
// Called when the quick menu is shown
}
@Override
public void onQuickMenuDismissed() {
// Called when the quick menu is dismissed
}
});
If there are tools that you would like to remove from the quick menu, you can hide them by calling ToolManager.disableToolMode
:
// Disable TextSquigglyCreate tool, TextStrikeoutCreate tool
mToolManager.disableToolMode(new ToolMode[]{
ToolManager.ToolMode.TEXT_SQUIGGLY,
ToolManager.ToolMode.TEXT_STRIKEOUT}
);
Then, when you long-press on text you will see:
Icon | ToolMode |
---|---|
RECT_CREATE | |
OVAL_CREATE | |
POLYLINE_CREATE | |
POLYGON_CREATE | |
CLOUD_CREATE | |
LINE_CREATE | |
ARROW_CREATE | |
RULER_CREATE | |
TEXT_CREATE | |
CALLOUT_CREATE | |
TEXT_ANNOT_CREATE | |
INK_CREATE | |
INK_ERASER | |
SIGNATURE | |
STAMPER | |
RUBBER_STAMPER | |
FREE_HIGHLIGHTER | |
TEXT_HIGHLIGHT | |
TEXT_UNDERLINE | |
TEXT_SQUIGGLY | |
TEXT_STRIKEOUT | |
ANNOT_EDIT_RECT_GROUP |
If you would like to hide the long press quick menu entirely, you can do so by calling ToolManager.setDisableQuickMenu
. For example:
mToolManager.setDisableQuickMenu(true);
Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales