java.lang.Object | |||||||||
↳ | android.content.Context | ||||||||
↳ | android.content.ContextWrapper | ||||||||
↳ | android.view.ContextThemeWrapper | ||||||||
↳ | android.app.Activity | ||||||||
↳ | androidx.core.app.ComponentActivity | ||||||||
↳ | androidx.activity.ComponentActivity | ||||||||
↳ | androidx.fragment.app.FragmentActivity | ||||||||
↳ | androidx.appcompat.app.AppCompatActivity | ||||||||
↳ | com.pspdfkit.ui.PdfActivity |
![]() |
Activity with fully integrated views and behaviour. Can be invoked by the simple helper methods showDocument(Context, Uri, PdfActivityConfiguration)
and showDocument(Context, Uri, String, PdfActivityConfiguration)
. For more advanced customization use PdfActivityIntentBuilder
to generate
an Intent
with proper parameters.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
public static final int | MENU_OPTION_EDIT_ANNOTATIONS | Id of the thumbnail grid menu item. | |||||||||
public static final int | MENU_OPTION_OUTLINE | Id of the thumbnail grid menu item. | |||||||||
public static final int | MENU_OPTION_READER_VIEW | Id of the reader view menu item. | |||||||||
public static final int | MENU_OPTION_SEARCH | Id of the thumbnail grid menu item. | |||||||||
public static final int | MENU_OPTION_SETTINGS | Id of the settings menu item. | |||||||||
public static final int | MENU_OPTION_SHARE | Id of the thumbnail grid menu item. | |||||||||
public static final int | MENU_OPTION_THUMBNAIL_GRID | Id of the thumbnail grid menu item. | |||||||||
protected final PdfActivity.InternalPdfUiImpl | internalPdfUi |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
PdfActivity() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract void |
addPropertyInspectorLifecycleListener(PropertyInspectorCoordinatorLayoutController.PropertyInspectorLifecycleListener lifecycleListener)
Adds the listener for lifecycle changes of the PropertyInspector as it goes through the
PropertyInspectorCoordinatorLayout - preparing, displaying, removing.
| ||||||||||
boolean | dispatchKeyEvent(KeyEvent event) | ||||||||||
PdfActivityConfiguration |
getConfiguration()
Returns the
PdfActivityConfiguration that was provided while launching this activity. | ||||||||||
AppCompatActivity |
getHostingActivity()
This method is deprecated.
This method has been deprecated as it was never meant for public usage. Please
note that this method will be removed in next major version (i.e. 7.0). If you are still
using it, please contact our support with your specific use case.
| ||||||||||
Bundle |
getPdfParameters()
This method is deprecated.
This method has been deprecated as it was never meant for public usage. Please
note that this method will be removed in next major version (i.e. 7.0). If you are still
using it, please contact our support with your specific use case.
| ||||||||||
abstract PropertyInspectorCoordinatorLayout |
getPropertyInspectorCoordinator()
Returns property inspector coordinator layout.
| ||||||||||
void | onActivityResult(int requestCode, int resultCode, Intent data) | ||||||||||
void | onBackPressed() | ||||||||||
boolean | onCreateOptionsMenu(Menu menu) | ||||||||||
boolean |
onDocumentClick()
Called when the user taps / clicks on the document, not the page itself but on the side (if visible).
| ||||||||||
void |
onDocumentLoadFailed(Throwable exception)
Called if document loading has failed.
| ||||||||||
void |
onDocumentLoaded(PdfDocument document)
Called when document is successfully loaded and the document view has been laid out.
| ||||||||||
boolean |
onDocumentSave(PdfDocument document, DocumentSaveOptions saveOptions)
Called before document will be saved.
| ||||||||||
void |
onDocumentSaveCancelled(PdfDocument document)
Called if document saving has been cancelled.
| ||||||||||
void |
onDocumentSaveFailed(PdfDocument document, Throwable exception)
Called if document saving has failed.
| ||||||||||
void |
onDocumentSaved(PdfDocument document)
Called after the document has been saved.
| ||||||||||
void |
onDocumentZoomed(PdfDocument document, int pageIndex, float scaleFactor)
Called when a user zooms a document.
| ||||||||||
List<Integer> |
onGenerateMenuItemIds(List<Integer> menuItems)
Called before the main menu items are set to be ordered.
| ||||||||||
boolean | onOptionsItemSelected(MenuItem item) | ||||||||||
void |
onPageChanged(PdfDocument document, int pageIndex)
Called when user scrolled to a new page.
| ||||||||||
boolean |
onPageClick(PdfDocument document, int pageIndex, MotionEvent event, PointF pagePosition, Annotation clickedAnnotation)
Called when user taps / clicks on the page.
| ||||||||||
void |
onPageUpdated(PdfDocument document, int pageIndex)
Called when content of page with pageIndex has changed (for example due to annotation or form field being
updated).
| ||||||||||
boolean | onPrepareOptionsMenu(Menu menu) | ||||||||||
void |
onSetActivityTitle(PdfActivityConfiguration configuration, PdfDocument document)
Called when activity title must be set - before and after document was loaded.
| ||||||||||
void | onTrimMemory(int level) | ||||||||||
void | onUserInteraction() | ||||||||||
void |
onUserInterfaceVisibilityChanged(boolean visible)
Called when user interface visibility have changed.
| ||||||||||
void | onWindowFocusChanged(boolean hasFocus) | ||||||||||
void |
performApplyConfiguration(PdfActivityConfiguration configuration)
This method is deprecated.
This method has been deprecated as it was never meant for public usage. Please
note that this method will be removed in next major version (i.e. 7.0). If you are still
using it, please contact our support with your specific use case.
| ||||||||||
abstract void |
removePropertyInspectorLifecycleListener(PropertyInspectorCoordinatorLayoutController.PropertyInspectorLifecycleListener lifecycleListener)
Removes previously registered listener for lifecycle changes of the PropertyInspector as it goes through the
PropertyInspectorCoordinatorLayout - preparing, displaying, removing.
| ||||||||||
abstract void |
setAnnotationCreationInspectorController(AnnotationCreationInspectorController annotationCreationInspectorController)
Sets controller of the annotation inspector used when creating annotations.
| ||||||||||
abstract void |
setAnnotationEditingInspectorController(AnnotationEditingInspectorController annotationEditingInspectorController)
Sets controller of the annotation inspector used when editing annotations.
| ||||||||||
void |
setConfiguration(PdfActivityConfiguration configuration)
Replaces activity configuration.
| ||||||||||
abstract void |
setDocumentPrintDialogFactory(DocumentPrintDialogFactory factory)
Sets the creator for document print dialogs.
| ||||||||||
abstract void |
setDocumentSharingDialogFactory(DocumentSharingDialogFactory factory)
Sets the creator for document sharing dialogs.
| ||||||||||
abstract void |
setOnContextualToolbarLifecycleListener(ToolbarCoordinatorLayout.OnContextualToolbarLifecycleListener lifecycleListener)
Sets the listener for lifecycle changes of the ContextualToolbar as it goes through the
ToolbarCoordinatorLayout - preparing, displaying, removing.
| ||||||||||
abstract void |
setOnContextualToolbarMovementListener(ToolbarCoordinatorLayout.OnContextualToolbarMovementListener movementListener)
Sets the listener for ContextualToolbar movements within the layout.
| ||||||||||
abstract void |
setOnContextualToolbarPositionListener(ToolbarCoordinatorLayout.OnContextualToolbarPositionListener positionListener)
Sets the listener for ContextualToolbar position changes within the layout.
| ||||||||||
void |
setPdfView(View pdfView)
This method is deprecated.
This method has been deprecated as it was never meant for public usage. Please
note that this method will be removed in next major version (i.e. 7.0). If you are still
using it, please contact our support with your specific use case.
| ||||||||||
abstract void |
setPrintOptionsProvider(PrintOptionsProvider provider)
Sets the provider for print options.
| ||||||||||
abstract void |
setSharingActionMenuListener(ActionMenuListener listener)
Sets the listener for sharing menu lifecycle and click events.
| ||||||||||
abstract void |
setSharingOptionsProvider(SharingOptionsProvider provider)
Sets the provider for sharing options.
| ||||||||||
static void |
showDocument(Context context, Uri documentUri, String password, PdfActivityConfiguration configuration)
Opens a new
PdfActivity displaying a passed document. | ||||||||||
static void |
showDocument(Context context, Uri documentUri, PdfActivityConfiguration configuration)
Opens a new
PdfActivity displaying a passed document. | ||||||||||
static void |
showImage(Context context, Uri imageUri, PdfActivityConfiguration configuration)
Opens a new
PdfActivity displaying a passed image document. |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void | onCreate(Bundle savedInstanceState) | ||||||||||
void | onDestroy() | ||||||||||
void | onPause() | ||||||||||
void | onPostCreate(Bundle savedInstanceState) | ||||||||||
void | onResume() | ||||||||||
void | onSaveInstanceState(Bundle outState) | ||||||||||
void | onStart() | ||||||||||
void | onStop() |
Id of the thumbnail grid menu item.
Id of the thumbnail grid menu item.
Id of the reader view menu item.
Id of the thumbnail grid menu item.
Id of the settings menu item.
Id of the thumbnail grid menu item.
Id of the thumbnail grid menu item.
Adds the listener for lifecycle changes of the PropertyInspector as it goes through the
PropertyInspectorCoordinatorLayout - preparing, displaying, removing.
If the listener has already been added previously, this method will be a no-op.
Adding null
is not allowed, and will result in an exception.
lifecycleListener | PropertyInspectorLifecycleListener that should be notified. Must be non-null. |
---|
Returns the PdfActivityConfiguration
that was provided while launching this activity.
This method is deprecated.
This method has been deprecated as it was never meant for public usage. Please
note that this method will be removed in next major version (i.e. 7.0). If you are still
using it, please contact our support with your specific use case.
This method is deprecated.
This method has been deprecated as it was never meant for public usage. Please
note that this method will be removed in next major version (i.e. 7.0). If you are still
using it, please contact our support with your specific use case.
Returns property inspector coordinator layout.
Called when the user taps / clicks on the document, not the page itself but on the side (if visible).
true
if tap is handled or false
if PSPDFKit should execute it's default action.
Called if document loading has failed.
exception | Cause of the loading failure. |
---|
Called when document is successfully loaded and the document view has been laid out. This has to be called on the main thread.
document | Loaded document instance. |
---|
Called before document will be saved. This callback allows cancellation of the save process.
document | Instance of document to be saved. |
---|---|
saveOptions | Save options to be applied to the document. You may change parameters on this object to control how document is saved. |
true
if the document should be saved, false
if saving should be cancelled.
Called if document saving has been cancelled.
document | Instance of document that was saved. |
---|
Called if document saving has failed.
exception | Cause of the saving failure if applicable. |
---|
Called after the document has been saved.
document | Instance of document that was saved. |
---|
Called when a user zooms a document.
document | Current document. |
---|---|
pageIndex | The number of the page that the was zoomed. |
scaleFactor | The current scale factor. |
Called before the main menu items are set to be ordered. Override this method
to add your custom items to the list. You add just the ids and then in
onCreateOptionsMenu(Menu)
and onPrepareOptionsMenu(Menu)
you can find your items by id and edit them accordingly.
menuItems | A list of menu item ids, ordered by how they're gonna appear in the main toolbar. |
---|
Called when user scrolled to a new page.
document | Currently opened document. |
---|---|
pageIndex | Page number of new page. |
Called when user taps / clicks on the page.
document | Currently opened document. |
---|---|
pageIndex | Page number of the page being tapped. |
event | MotionEvent that triggered this page click. May be null if this page click was triggered from keyboard or
accessibility event. |
pagePosition | Tapped page position (in PDF page coordinates with origin on bottom left). Coordinates passed here may exceed the page size
(which is returned by getPageSize(int) ) and can also be negative. If the click was triggered by the
keyboard, pagePosition will be null . |
clickedAnnotation | Annotation that was tapped, or null if no annotation was tapped. |
true
if tap was handled by this DocumentListener
and should not be handled by PSPDFKit anymore. If returning
false
PSPDFKit will continue executing it's default action.
Called when content of page with pageIndex has changed (for example due to annotation or form field being updated). All views displaying this page need to refresh.
pageIndex | Page index of the updated page. Page index is 0-based. |
---|
Called when activity title must be set - before and after document was loaded.
configuration | Passed activity configuration instance. |
---|---|
document | Loaded document. If document hasn't been loaded yet, this parameter will be null .
|
Called when user interface visibility have changed.
visible | true when UI interface is visible, false when it is hidden.
|
---|
This method is deprecated.
This method has been deprecated as it was never meant for public usage. Please
note that this method will be removed in next major version (i.e. 7.0). If you are still
using it, please contact our support with your specific use case.
Removes previously registered listener for lifecycle changes of the PropertyInspector as it goes through the
PropertyInspectorCoordinatorLayout - preparing, displaying, removing.
Upon calling this method the listener
will no longer be notified of any changes.
If the listener has not been added, this method will be a no-op.
Adding null
is not allowed,and will result in an exception.
lifecycleListener | PropertyInspectorLifecycleListener that should be removed. Must be non-null. |
---|
Sets controller of the annotation inspector used when creating annotations. This replaces default annotation inspector.
annotationCreationInspectorController | Controller instance to use. |
---|
Sets controller of the annotation inspector used when editing annotations. This replaces default annotation inspector.
annotationEditingInspectorController | Controller instance to use. |
---|
Replaces activity configuration. This method restarts activity to apply new configuration.
Note: This is a no-op when configuration has not changed.
configuration | The configuration to restart activity with. |
---|
Sets the creator for document print dialogs.
factory | Creator to set or null to clear registered creator.
|
---|
Sets the creator for document sharing dialogs.
factory | Creator to set or null to clear registered creator.
|
---|
Sets the listener for lifecycle changes of the ContextualToolbar as it goes through the
ToolbarCoordinatorLayout - preparing, displaying, removing.
Calling this method will replace any previously set listener.
You may provide null
to clear the listener.
lifecycleListener | OnContextualToolbarLifecycleListener that should be notified, or null to clear the listener.
|
---|
Sets the listener for ContextualToolbar movements within the layout.
Calling this method will replace any previously set listener.
You may provide null
to clear the listener.
movementListener | OnContextualToolbarMovementListener that should be notified, or null to clear the listener.
|
---|
Sets the listener for ContextualToolbar position changes within the layout.
Calling this method will replace any previously set listener.
You may provide null
to clear the listener.
positionListener | OnContextualToolbarPositionListener that should be notified, or null to clear the listener.
|
---|
This method is deprecated.
This method has been deprecated as it was never meant for public usage. Please
note that this method will be removed in next major version (i.e. 7.0). If you are still
using it, please contact our support with your specific use case.
Sets the provider for print options.
provider | Provider to set or null to clear registered provider.
|
---|
Sets the listener for sharing menu lifecycle and click events.
listener | Listener to set or null to clear registered listener.
|
---|
Sets the provider for sharing options.
provider | Provider to set or null to clear registered provider.
|
---|
Opens a new PdfActivity
displaying a passed document. If the document is password
protected PSPDFKit will prompt the user to enter the password.
context | Calling context. |
---|---|
documentUri | Uri pointing to the document file. |
password | Document password, can be null . |
configuration | Desired activity configuration generated with PdfActivityConfiguration.Builder .
|
Opens a new PdfActivity
displaying a passed document. If the document is password
protected PSPDFKit will prompt the user to enter the password.
context | Calling context |
---|---|
documentUri | Uri pointing to the document file |
configuration | Desired activity configuration generated with PdfActivityConfiguration.Builder
|
Opens a new PdfActivity
displaying a passed image document.
context | Calling context |
---|---|
imageUri | Uri pointing to the image document with a supported format (JPG or PNG). |
configuration | Desired activity configuration generated with PdfActivityConfiguration.Builder ,
getDefaultImageDocumentActivityConfiguration(PdfActivityConfiguration)
or getDefaultImageDocumentActivityConfiguration(Context) .
|