public class

PdfTextSelectionPopupToolbar

extends PopupToolbar
java.lang.Object
   ↳ com.pspdfkit.ui.PopupToolbar
     ↳ com.pspdfkit.ui.toolbar.popup.PdfTextSelectionPopupToolbar

Class Overview

Text selection implementation of the PopupToolbar. It will show right above the selected text if the toolbar has been successfully bound with a respective TextSelectionController.

Summary

[Expand]
Inherited Fields
From class com.pspdfkit.ui.PopupToolbar
Public Constructors
PdfTextSelectionPopupToolbar(PdfFragment pdfFragment)
Creates a new text selection popup toolbar that will be displayed in the specified fragment.
Public Methods
void bindController(TextSelectionController textSelectionController)
Bind text selection controller to the toolbar.
void dismiss()
Hides/dismisses the popup toolbar.
TextSelectionController getController()
Gets the text selection controller that is currently set on the toolbar (if any).
int getViewId()
Returns the id of the content view for this toolbar.
boolean onItemClicked(PopupToolbarMenuItem popupToolbarMenuItem)
Called when the menu item has been clicked.
void showForSelectedText()
Displays the text selection toolbar over the selected text.
void unbindController()
Unbinds a currently bound controller (if any).
[Expand]
Inherited Methods
From class com.pspdfkit.ui.PopupToolbar
From class java.lang.Object

Public Constructors

public PdfTextSelectionPopupToolbar (PdfFragment pdfFragment)

Creates a new text selection popup toolbar that will be displayed in the specified fragment.

Parameters
pdfFragment Fragment on which the toolbar will be displayed.

Public Methods

public void bindController (TextSelectionController textSelectionController)

Bind text selection controller to the toolbar. Text selection controller can be obtained via TextSelectionManager.OnTextSelectionModeChangeListener. When bound to the toolbar, the toolbar will automatically show items that are enabled or disabled, and introduce the business logic for handling each of the clicked menu item actions.

Parameters
textSelectionController Controller to be bound to the toolbar.

public void dismiss ()

Hides/dismisses the popup toolbar.

public TextSelectionController getController ()

Gets the text selection controller that is currently set on the toolbar (if any).

Returns
  • Currently set text selection controller, or null if it doesn't exist.

public int getViewId ()

Returns the id of the content view for this toolbar.

Returns
  • Toolbar's content view ID.

public boolean onItemClicked (PopupToolbarMenuItem popupToolbarMenuItem)

Called when the menu item has been clicked. When overriding this method, make sure you call `super()` so that the PopupToolbar.OnPopupToolbarItemClickedListener is invoked correctly.

Parameters
popupToolbarMenuItem Item that was clicked.
Returns
  • true to interrupt the callback, false to let it go through and allow the default menu item click handling.

public void showForSelectedText ()

Displays the text selection toolbar over the selected text. This method is no-op if called before the text controller had been set via bindController(TextSelectionController).

public void unbindController ()

Unbinds a currently bound controller (if any).