java.lang.Object | |
↳ | com.pspdfkit.ui.PopupToolbar |
![]() |
A class used for displaying a toolbar as a popup. It's a remake of a default Android text selection toolbar, where the items are displayed horizontally, with overflow button if there are items that don't fit the screen. Then once the overflow button is pressed, the toolbar displays other items vertically, with back button on the bottom to return to the main items.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
interface | PopupToolbar.OnPopupToolbarItemClickedListener | Listener for menu item clicks. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
protected PopupToolbar.OnPopupToolbarItemClickedListener | onPopupToolbarItemClickedListener | Currently assigned popup toolbar menu item click listener (if any). | |||||||||
protected final PdfFragment | pdfFragment | Fragment on which the popup toolbar will be displayed. | |||||||||
protected final PopupWindow | popupWindow | Popup window in which the content will be displayed. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
PopupToolbar(PdfFragment pdfFragment)
Creates a popup toolbar on the given
PdfFragment . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
dismiss()
Hides/dismisses the popup toolbar.
| ||||||||||
List<PopupToolbarMenuItem> |
getMenuItems()
Gets menu items currently displayed in this popup toolbar.
| ||||||||||
int |
getViewId()
Returns the id of the content view for this toolbar.
| ||||||||||
boolean |
isShowing()
Gets whether the popup toolbar is currently showing or not.
| ||||||||||
boolean |
onItemClicked(PopupToolbarMenuItem popupToolbarMenuItem)
Called when the menu item has been clicked.
| ||||||||||
void |
setMenuItems(List<PopupToolbarMenuItem> popupToolbarMenuItems)
Sets menu items to be displayed in this popup toolbar.
| ||||||||||
void |
setOnPopupToolbarItemClickedListener(PopupToolbar.OnPopupToolbarItemClickedListener onPopupToolbarItemClickedListener)
Sets the listener for popup toolbar menu item clicks.
| ||||||||||
void |
show(int pageIndex, float x, float y)
Show the popup toolbar at the specified page index with possible X and Y offsets.
| ||||||||||
void |
showAgain()
Show the popup toolbar with the parameters that were last used when calling
show(int, float, float) . |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Currently assigned popup toolbar menu item click listener (if any).
Creates a popup toolbar on the given PdfFragment
. Use show(int, float, float)
to display the toolbar.
pdfFragment | PDF fragment for which to create the popup toolbar. |
---|
Hides/dismisses the popup toolbar.
Gets menu items currently displayed in this popup toolbar.
Returns the id of the content view for this toolbar.
Gets whether the popup toolbar is currently showing or not.
true
if the toolbar is showing, false
otherwise.
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.
popupToolbarMenuItem | Item that was clicked. |
---|
true
to interrupt the callback, false
to let it go through and allow
the default menu item click handling.
Sets menu items to be displayed in this popup toolbar.
popupToolbarMenuItems | List of menu items to display in the toolbar. The items will be displayed as ordered in the list. |
---|
Sets the listener for popup toolbar menu item clicks.
onPopupToolbarItemClickedListener | Listener to be set. |
---|
Show the popup toolbar at the specified page index with possible X and Y offsets. Leaving offset parameters at 0, the toolbar will be displayed so that its center matched the given coordinate horizontally, and that bottom of the toolbar matches the coordinate vertically. Noticeably, all offsets are represented in PDF values.
pageIndex | Index of the page on which to show the toolbar. |
---|---|
x | X offset for the toolbar position (in PDF points). |
y | Y offset for the toolbar position (in PDF points). |
Show the popup toolbar with the parameters that were last used when calling show(int, float, float)
. This is useful after dismiss()
was called to temporarily hide the
toolbar. If show(int, float, float)
was never used before, this defaults to pageIndex
0
and coordinates 0,0
.