OnToolbarMenuChangedListener

Listener for toolbar menu changes in com.pspdfkit.ui.PdfUiFragment.

This listener allows customizing the main toolbar menu when using com.pspdfkit.ui.PdfUiFragment inside a plain androidx.appcompat.app.AppCompatActivity (i.e. not com.pspdfkit.ui.PdfActivity). It provides callbacks for menu creation, preparation, and item click handling.

The listener can be set either by having the hosting Activity implement this interface (it will be auto-discovered in com.pspdfkit.ui.PdfUiFragment.onAttach) or by calling com.pspdfkit.ui.PdfUiFragment.setOnToolbarMenuChangedListener.

Functions

Link copied to clipboard
abstract fun onCreateToolbarMenu(menu: Menu)

Called after the SDK builds the toolbar menu. Add custom menu items here.

Link copied to clipboard
abstract fun onPrepareToolbarMenu(menu: Menu)

Called after the SDK prepares the toolbar menu. Update menu item state (visibility, enabled state, etc.) here.

Link copied to clipboard

Called when a toolbar menu item is clicked. Return true if the click was handled.