User Interface Visibility

When using PdfActivity you might want to tweak how PSPDFKit handles its user interface visibility (toolbars, thumbnail bar etc.). This can be easily configured by setting setUserInterfaceViewMode in PdfActivityConfiguration.Builder.

PSPDFKit supports the following user interface view modes:

  • USER_INTERFACE_VIEW_MODE_AUTOMATIC toggles UI when clicking on the empty page and hides UI when changing pages. This is the default.
  • USER_INTERFACE_VIEW_MODE_AUTOMATIC_BORDER_PAGES works same as above, but automatically shows UI when scrolling to first and the last page of the document.
  • USER_INTERFACE_VIEW_MODE_VISIBLE makes UI always visible.
  • USER_INTERFACE_VIEW_MODE_HIDDEN makes UI always invisible.
  • USER_INTERFACE_VIEW_MODE_MANUAL disables any automatic UI controls.

Note: User interface view mode can also be changed while PdfActivity is active by calling PdfActivity#setUserInterfaceViewMode.

Manual User Interface View Mode

If no user interface view mode matches your desired use-case, you can control UI visibility completely manually by using USER_INTERFACE_VIEW_MODE_MANUAL and calling setUserInterfaceVisible to show/hide user interface when required.

For more details, take a look at the UserInterfaceViewModesExample in the catalog app.

Reacting to User Interface Visibility Changes

If you are providing custom user interface components, you'll probably want to coordinate visibility of these components with PdfActivity user interface visibility. You can easily achieve this by overriding onUserInterfaceVisibilityChanged that is called when user interface visibility changes either through setUserInterfaceVisible or via user interaction.