public interface

PdfUi

implements PdfActivityMenu.OnMenuItemsGenerateListener PdfActivityMenu.OnPrepareDefaultMenuItemListener PdfActivityListener
com.pspdfkit.ui.PdfUi
Known Indirect Subclasses

Class Overview

The API that is shared between PdfActivity and PdfUiFragment.

Summary

Constants
long TIMEOUT_DEFAULT Parameter for setScreenTimeout(long) used for restoring screen timeout to its default system value.
long TIMEOUT_INFINITE Parameter for setScreenTimeout(long) used for disabling screen timeout.
Public Methods
abstract void addPropertyInspectorLifecycleListener(PropertyInspectorCoordinatorLayoutController.PropertyInspectorLifecycleListener lifecycleListener)
abstract PdfActivityConfiguration getConfiguration()
Returns the PdfActivityConfiguration that was provided while launching this pdf UI.
abstract PdfDocument getDocument()
Returns the PdfDocument that is loaded into this pdf UI, or null if no document has been loaded yet.
abstract DocumentCoordinator getDocumentCoordinator()
Returns the coordinator responsible for displaying documents and switching between multiple loaded documents.
abstract PSPDFKitViews getPSPDFKitViews()
Returns object with inflated PSPDFKit views.
abstract int getPageIndex()
Returns current page index set on the document.
abstract PdfFragment getPdfFragment()
Returns the PdfFragment that is used to show the document.
abstract PropertyInspectorCoordinatorLayout getPropertyInspectorCoordinator()
abstract long getScreenTimeout()
Gets screen timeout in milliseconds that has been added to the predefined system timeout, TIMEOUT_DEFAULT or TIMEOUT_INFINITE.
abstract int getSiblingPageIndex(int pageIndex)
Gets page sibling index (usable in double page mode).
abstract UserInterfaceViewMode getUserInterfaceViewMode()
Return current user interface view mode that activity is using.
abstract void hideUserInterface()
Animates user interface controls out of view.
abstract boolean isDocumentInteractionEnabled()
Indicates whether interaction with the document is enabled right now.
abstract boolean isImageDocument()
Indicates whether the displayed document is an image or not.
abstract boolean isUserInterfaceEnabled()
Indicates whether UI is enabled right now.
abstract boolean isUserInterfaceVisible()
Checks whether user interface controls are currently visible.
abstract void removePropertyInspectorLifecycleListener(PropertyInspectorCoordinatorLayoutController.PropertyInspectorLifecycleListener lifecycleListener)
abstract PdfFragment requirePdfFragment()
Returns the PdfFragment that is used to show the document.
abstract void setAnnotationCreationInspectorController(AnnotationCreationInspectorController annotationCreationInspectorController)
abstract void setAnnotationEditingInspectorController(AnnotationEditingInspectorController annotationEditingInspectorController)
abstract void setConfiguration(PdfActivityConfiguration configuration)
Replaces activity configuration.
abstract void setDocumentFromDataProvider(DataProvider dataProvider, String password)
Loads a new document in this activity and replaces the existing one.
abstract void setDocumentFromDataProviders(List<DataProvider> dataProviders, List<String> passwords)
Loads a new document in this pdf UI and replaces the existing one.
abstract void setDocumentFromUri(Uri documentUri, String password)
Loads a new document in this activity and replaces the existing one.
abstract void setDocumentFromUris(List<Uri> documentUris, List<String> passwords)
Loads a new document in this activity and replaces the existing one.
abstract void setDocumentInteractionEnabled(boolean documentInteractionEnabled)
Enables or disables interaction with the document.
abstract void setDocumentPrintDialogFactory(DocumentPrintDialogFactory factory)
abstract void setDocumentSharingDialogFactory(DocumentSharingDialogFactory factory)
abstract void setOnContextualToolbarLifecycleListener(ToolbarCoordinatorLayout.OnContextualToolbarLifecycleListener lifecycleListener)
abstract void setOnContextualToolbarMovementListener(ToolbarCoordinatorLayout.OnContextualToolbarMovementListener movementListener)
abstract void setOnContextualToolbarPositionListener(ToolbarCoordinatorLayout.OnContextualToolbarPositionListener positionListener)
abstract void setPageIndex(int pageIndex)
Sets page to be displayed in the current document.
abstract void setPageIndex(int pageIndex, boolean animate)
Sets page to be displayed in the current document.
abstract void setPrintOptionsProvider(PrintOptionsProvider provider)
abstract void setScreenTimeout(long screenTimeoutMillis)
Sets screen timeout in milliseconds that will be added to the predefined system timeout (that is usually 1 minute).
abstract void setSharingActionMenuListener(ActionMenuListener listener)
abstract void setSharingOptionsProvider(SharingOptionsProvider provider)
abstract void setUserInterfaceEnabled(boolean userInterfaceEnabled)
Enables or disables the user interface.
abstract void setUserInterfaceViewMode(UserInterfaceViewMode userInterfaceViewMode)
Sets the activity user interface view mode at a runtime.
abstract void setUserInterfaceVisible(boolean show, boolean animate)
Show or hide user interface controls.
abstract void showUserInterface()
Animates user interface controls into view.
abstract void toggleUserInterface()
Toggles the visibility of user interface controls.
[Expand]
Inherited Methods
From interface com.pspdfkit.internal.ui.menu.PdfActivityMenu.OnMenuItemsGenerateListener
From interface com.pspdfkit.internal.ui.menu.PdfActivityMenu.OnPrepareDefaultMenuItemListener
From interface com.pspdfkit.listeners.DocumentListener
From interface com.pspdfkit.listeners.PdfActivityListener

Constants

public static final long TIMEOUT_DEFAULT

Parameter for setScreenTimeout(long) used for restoring screen timeout to its default system value.

Constant Value: 0 (0x0000000000000000)

public static final long TIMEOUT_INFINITE

Parameter for setScreenTimeout(long) used for disabling screen timeout.

Constant Value: 9223372036854775807 (0x7fffffffffffffff)

Public Methods

public abstract void addPropertyInspectorLifecycleListener (PropertyInspectorCoordinatorLayoutController.PropertyInspectorLifecycleListener lifecycleListener)

public abstract PdfActivityConfiguration getConfiguration ()

Returns the PdfActivityConfiguration that was provided while launching this pdf UI.

Returns
  • Currently set activity configuration.

public abstract PdfDocument getDocument ()

Returns the PdfDocument that is loaded into this pdf UI, or null if no document has been loaded yet.

Returns
  • Document loaded into the pdf UI.

public abstract DocumentCoordinator getDocumentCoordinator ()

Returns the coordinator responsible for displaying documents and switching between multiple loaded documents.

Returns

public abstract PSPDFKitViews getPSPDFKitViews ()

Returns object with inflated PSPDFKit views. This is meant to be used when extending this class for easier customization.

Returns

public abstract int getPageIndex ()

Returns current page index set on the document.

Returns
  • Index of the page currently displayed in the document (-1 if document is null).

public abstract PdfFragment getPdfFragment ()

Returns the PdfFragment that is used to show the document.

Returns
  • Current fragment for displaying the document, or null if no document is being displayed.

public abstract PropertyInspectorCoordinatorLayout getPropertyInspectorCoordinator ()

public abstract long getScreenTimeout ()

Gets screen timeout in milliseconds that has been added to the predefined system timeout, TIMEOUT_DEFAULT or TIMEOUT_INFINITE.

Returns

public abstract int getSiblingPageIndex (int pageIndex)

Gets page sibling index (usable in double page mode).

Parameters
pageIndex Index of the page for which we look for the sibling.
Returns
  • Provided page sibling, or -1 if there is none.

public abstract UserInterfaceViewMode getUserInterfaceViewMode ()

Return current user interface view mode that activity is using.

public abstract void hideUserInterface ()

Animates user interface controls out of view. Does nothing if already hidden, USER_INTERFACE_VIEW_MODE_VISIBLE is set or when user interface is sticky - inline search is active, toolbar forces user interface to be visible etc.

public abstract boolean isDocumentInteractionEnabled ()

Indicates whether interaction with the document is enabled right now.

Returns
  • true when the user can interact with the document, false otherwise.

public abstract boolean isImageDocument ()

Indicates whether the displayed document is an image or not.

Returns
  • true if the displayed document is image, false otherwise.

public abstract boolean isUserInterfaceEnabled ()

Indicates whether UI is enabled right now. UI is disabled when document is being saved/loaded, or when manually disabled.

Returns
  • true when UI is enabled right now.

public abstract boolean isUserInterfaceVisible ()

Checks whether user interface controls are currently visible.

Returns
  • true if visible, false otherwise.

public abstract void removePropertyInspectorLifecycleListener (PropertyInspectorCoordinatorLayoutController.PropertyInspectorLifecycleListener lifecycleListener)

public abstract PdfFragment requirePdfFragment ()

Returns the PdfFragment that is used to show the document. Throws an exception when PdfFragment is not yet initialized.

Returns
  • Current fragment for displaying the document.

public abstract void setAnnotationCreationInspectorController (AnnotationCreationInspectorController annotationCreationInspectorController)

public abstract void setAnnotationEditingInspectorController (AnnotationEditingInspectorController annotationEditingInspectorController)

public abstract void setConfiguration (PdfActivityConfiguration configuration)

Replaces activity configuration. This method restarts the pdf UI to apply new configuration.

Note: This is a no-op when configuration has not changed.

Parameters
configuration The configuration to restart pdf UI with.

public abstract void setDocumentFromDataProvider (DataProvider dataProvider, String password)

Loads a new document in this activity and replaces the existing one. This method may only be called if onSaveInstanceState(Bundle) has not been called or an exception will be thrown, since after that call state loss could occur.

Parameters
dataProvider Data provider for the document.
password Document password. May be null.

public abstract void setDocumentFromDataProviders (List<DataProvider> dataProviders, List<String> passwords)

Loads a new document in this pdf UI and replaces the existing one. This method may only be called if onSaveInstanceState(Bundle) has not been called or an exception will be thrown, since after that call state loss could occur.

Parameters
dataProviders List of data providers for compound document.
passwords List of passwords for compound document, may be null.

public abstract void setDocumentFromUri (Uri documentUri, String password)

Loads a new document in this activity and replaces the existing one. This method may only be called if onSaveInstanceState(Bundle) has not been called or an exception will be thrown, since after that call state loss could occur.

Parameters
documentUri Document URI.
password Document password. May be null.

public abstract void setDocumentFromUris (List<Uri> documentUris, List<String> passwords)

Loads a new document in this activity and replaces the existing one. This method may only be called if onSaveInstanceState(Bundle) has not been called or an exception will be thrown, since after that call state loss could occur.

Parameters
documentUris List of document URIs for compound document.
passwords List of passwords for compound document, may be null.

public abstract void setDocumentInteractionEnabled (boolean documentInteractionEnabled)

Enables or disables interaction with the document. When the interaction is disabled you can no longer scroll or zoom the document in any way, any other UI like the thumbnail bar is still enabled.

Parameters
documentInteractionEnabled true to enable interacting with the document, false to disable it.

public abstract void setDocumentPrintDialogFactory (DocumentPrintDialogFactory factory)

public abstract void setDocumentSharingDialogFactory (DocumentSharingDialogFactory factory)

public abstract void setOnContextualToolbarLifecycleListener (ToolbarCoordinatorLayout.OnContextualToolbarLifecycleListener lifecycleListener)

public abstract void setOnContextualToolbarMovementListener (ToolbarCoordinatorLayout.OnContextualToolbarMovementListener movementListener)

public abstract void setOnContextualToolbarPositionListener (ToolbarCoordinatorLayout.OnContextualToolbarPositionListener positionListener)

public abstract void setPageIndex (int pageIndex)

Sets page to be displayed in the current document.

Parameters
pageIndex Index of the target page (starting at 0).

public abstract void setPageIndex (int pageIndex, boolean animate)

Sets page to be displayed in the current document.

Parameters
pageIndex Index of the target page (starting at 0).
animate true if the transition to the specified page should be animated, false otherwise.

public abstract void setPrintOptionsProvider (PrintOptionsProvider provider)

public abstract void setScreenTimeout (long screenTimeoutMillis)

Sets screen timeout in milliseconds that will be added to the predefined system timeout (that is usually 1 minute). I.e. setScreenTimeout(30 * 1000) will turn off the device screen in 90 seconds.

Parameters
screenTimeoutMillis can be a positive number, TIMEOUT_DEFAULT or TIMEOUT_INFINITE.

public abstract void setSharingActionMenuListener (ActionMenuListener listener)

public abstract void setSharingOptionsProvider (SharingOptionsProvider provider)

public abstract void setUserInterfaceEnabled (boolean userInterfaceEnabled)

Enables or disables the user interface. When the user interface is disabled all temporary UI elements (navigation buttons, redaction UI) are hidden, and all user interaction is disabled (no scrolling, no clicking on the thumbnail bar, no annotation editing).

Parameters
userInterfaceEnabled true to enable the UI, false to disable the UI.

public abstract void setUserInterfaceViewMode (UserInterfaceViewMode userInterfaceViewMode)

Sets the activity user interface view mode at a runtime. Overriding PdfActivityConfiguration.

public abstract void setUserInterfaceVisible (boolean show, boolean animate)

Show or hide user interface controls. This does not respect currently configured UserInterfaceViewMode.

Parameters
show true to show user interface, false to hide it.
animate true to animate the change.

public abstract void showUserInterface ()

Animates user interface controls into view. Does nothing if already showing, USER_INTERFACE_VIEW_MODE_HIDDEN is set or when user interface is forced to be hidden - for example when creating annotations and using vertical toolbar.

public abstract void toggleUserInterface ()

Toggles the visibility of user interface controls.