public class

InstantPdfActivity

extends PdfActivity
implements InstantPdfActivityListener
java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.view.ContextThemeWrapper
         ↳ android.app.Activity
           ↳ androidx.core.app.ComponentActivity
             ↳ androidx.fragment.app.FragmentActivity
               ↳ androidx.appcompat.app.AppCompatActivity
                 ↳ com.pspdfkit.ui.PdfActivity
                   ↳ com.pspdfkit.instant.ui.InstantPdfActivity

Class Overview

Activity with fully integrated views and behaviour. Can be invoked by the simple helper method showInstantDocument(Context, String, String, PdfActivityConfiguration).

For more advanced customization use InstantPdfActivityIntentBuilder to generate an Intent with proper parameters.

Summary

[Expand]
Inherited Constants
From class com.pspdfkit.ui.PdfActivity
From class android.app.Activity
From class android.content.Context
From interface android.content.ComponentCallbacks2
[Expand]
Inherited Fields
From class com.pspdfkit.ui.PdfActivity
From class android.app.Activity
Public Constructors
InstantPdfActivity()
Public Methods
InstantPdfDocument getDocument()
Returns the PdfDocument that is loaded into this activity, or null if no document has been loaded yet.
DocumentCoordinator getDocumentCoordinator()
Returns the coordinator responsible for displaying documents and switching between multiple loaded documents.
InstantPdfFragment getPdfFragment()
Returns the PdfFragment that is used to show the document.
void onAuthenticationFailed(InstantPdfDocument instantDocument, InstantException error)
Called when authentication with Instant server has failed.
void onAuthenticationFinished(InstantPdfDocument instantDocument, String validJwt)
Called when authentication with Instant server has successfully finished.
void onDocumentCorrupted(InstantPdfDocument instantDocument)
Called when InstantPdfDocument has detected data corruption.
void onDocumentInvalidated(InstantPdfDocument instantDocument)
Called when InstantPdfDocument becomes invalid.
void onDocumentStateChanged(InstantPdfDocument instantDocument, InstantDocumentState state)
Called when the document changes its state.
void onSyncError(InstantPdfDocument instantDocument, InstantException error)
Called when annotation sync has been finished with an error.
void onSyncFinished(InstantPdfDocument instantDocument)
Called when annotation sync has been finished successfully.
void onSyncStarted(InstantPdfDocument instantDocument)
Called when annotation sync has been started.
void setDocument(String serverUrl, String jwt)
Loads a new Instant document in this activity and replaces the existing one.
void setDocumentFromDataProvider(DataProvider dataProvider, String password)
Loads a new document in this activity and replaces the existing one.
void setDocumentFromDataProviders(List<DataProvider> dataProviders, List<String> passwords)
Loads a new document in this activity and replaces the existing one.
void setDocumentFromUri(Uri documentUri, String password)
Loads a new document in this activity and replaces the existing one.
void setDocumentFromUris(List<Uri> documentUris, List<String> passwords)
Loads a new document in this activity and replaces the existing one.
static void showInstantDocument(Context context, String serverUrl, String jwt, PdfActivityConfiguration configuration)
Opens a new InstantPdfActivity displaying server document.
[Expand]
Inherited Methods
From class com.pspdfkit.ui.PdfActivity
From class androidx.appcompat.app.AppCompatActivity
From class androidx.fragment.app.FragmentActivity
From class androidx.core.app.ComponentActivity
From class android.app.Activity
From class android.view.ContextThemeWrapper
From class android.content.ContextWrapper
From class android.content.Context
From class java.lang.Object
From interface android.content.ComponentCallbacks
From interface android.content.ComponentCallbacks2
From interface android.view.KeyEvent.Callback
From interface android.view.LayoutInflater.Factory
From interface android.view.LayoutInflater.Factory2
From interface android.view.View.OnCreateContextMenuListener
From interface android.view.Window.Callback
From interface androidx.appcompat.app.ActionBarDrawerToggle.DelegateProvider
From interface androidx.appcompat.app.AppCompatCallback
From interface androidx.core.app.ActivityCompat.OnRequestPermissionsResultCallback
From interface androidx.core.app.ActivityCompat.RequestPermissionsRequestCodeValidator
From interface androidx.core.app.TaskStackBuilder.SupportParentable
From interface androidx.core.view.KeyEventDispatcher.Component
From interface androidx.lifecycle.LifecycleOwner
From interface androidx.lifecycle.ViewModelStoreOwner
From interface com.pspdfkit.framework.ui.menu.PdfActivityMenu.OnMenuItemsGenerateListener
From interface com.pspdfkit.instant.listeners.InstantDocumentListener
From interface com.pspdfkit.listeners.DocumentListener
From interface com.pspdfkit.listeners.PdfActivityListener

Public Constructors

public InstantPdfActivity ()

Public Methods

public InstantPdfDocument getDocument ()

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

Returns
  • Document loaded into the activity.

public DocumentCoordinator getDocumentCoordinator ()

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

Returns

public InstantPdfFragment 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 void onAuthenticationFailed (InstantPdfDocument instantDocument, InstantException error)

Called when authentication with Instant server has failed.

Parameters
instantDocument Document that we were authenticating for.
error Authentication error.

public void onAuthenticationFinished (InstantPdfDocument instantDocument, String validJwt)

Called when authentication with Instant server has successfully finished.

Parameters
instantDocument Document that we were authenticating for.
validJwt JWT that was used for this authentication request.

public void onDocumentCorrupted (InstantPdfDocument instantDocument)

Called when InstantPdfDocument has detected data corruption.

Receiving this callback means any further interaction with the sender’s document are destined to fail. You can copy the document package aside for forensic purposes, but you will — eventually — have to purge its storage, and download it anew.

Because this situation means the document has become unusable, it will invalidate itself immediately after this method returns.

Parameters
instantDocument Document that has detected data corruption.

public void onDocumentInvalidated (InstantPdfDocument instantDocument)

Called when InstantPdfDocument becomes invalid. Any future instant operations on this document will fail.

Parameters
instantDocument Document that is becoming invalid.

public void onDocumentStateChanged (InstantPdfDocument instantDocument, InstantDocumentState state)

Called when the document changes its state.

Note: After onSyncStarted(InstantPdfDocument), this method may be called multiple times during the sync process.

Parameters
instantDocument Document which state has changed.
state New document state.

public void onSyncError (InstantPdfDocument instantDocument, InstantException error)

Called when annotation sync has been finished with an error.

The most likely reason is network failure REQUEST_FAILED. Other common reasons are expiration of your authentication token AUTHENTICATION_FAILED, and cancellation USER_CANCELLED.

Parameters
instantDocument Document that was syncing the annotations.
error Error thrown while syncing annotations.

public void onSyncFinished (InstantPdfDocument instantDocument)

Called when annotation sync has been finished successfully.

Parameters
instantDocument Document that was syncing the annotations.

public void onSyncStarted (InstantPdfDocument instantDocument)

Called when annotation sync has been started.

Parameters
instantDocument Document that is syncing the annotations.

public void setDocument (String serverUrl, String jwt)

Loads a new Instant 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
serverUrl Instant server url.
jwt JWT used to authenticate access to the document.

public 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 void setDocumentFromDataProviders (List<DataProvider> dataProviders, 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
dataProviders List of data providers for compound document.
passwords List of passwords for compound document, may be null.

public 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 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 static void showInstantDocument (Context context, String serverUrl, String jwt, PdfActivityConfiguration configuration)

Opens a new InstantPdfActivity displaying server document.

Parameters
context Calling context
serverUrl Url of the Instant server - used to initialize InstantClient.
jwt Authentication token used to authenticate access to the document.
configuration Desired activity configuration generated with PdfActivityConfiguration.Builder