Class PdfTextSelectionPopupToolbar
-
- All Implemented Interfaces:
public class PdfTextSelectionPopupToolbar extends PopupToolbar
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.
-
-
Field Summary
Fields Modifier and Type Field Description public TextSelectionController
controller
-
Constructor Summary
Constructors Constructor Description PdfTextSelectionPopupToolbar(PdfFragment pdfFragment)
Creates a new text selection popup toolbar that will be displayed in the specified fragment.
-
Method Summary
Modifier and Type Method Description TextSelectionController
getController()
Gets the text selection controller that is currently set on the toolbar (if any). void
bindController(@NonNull() TextSelectionController textSelectionController)
Bind text selection controller to the toolbar. int
getViewId()
Returns the id of the content view for this toolbar. void
unbindController()
Unbinds a currently bound controller (if any). void
showForSelectedText()
Displays the text selection toolbar over the selected text. void
dismiss()
Hides/dismisses the popup toolbar. boolean
onItemClicked(@NonNull() PopupToolbarMenuItem popupToolbarMenuItem)
Called when the menu item has been clicked. -
-
Constructor Detail
-
PdfTextSelectionPopupToolbar
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.
-
-
Method Detail
-
getController
@Nullable() 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.
-
bindController
void bindController(@NonNull() TextSelectionController textSelectionController)
Bind text selection controller to the toolbar. Text selection controller can be obtained via . 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.
-
getViewId
int getViewId()
Returns the id of the content view for this toolbar.
- Returns:
Toolbar's content view ID.
-
unbindController
void unbindController()
Unbinds a currently bound controller (if any).
-
showForSelectedText
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.
-
dismiss
void dismiss()
Hides/dismisses the popup toolbar.
-
onItemClicked
boolean onItemClicked(@NonNull() PopupToolbarMenuItem popupToolbarMenuItem)
Called when the menu item has been clicked. When overriding this method, make sure you call `super()` so that the 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.
-
-
-
-