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.activity.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 android.app.Activity
From class android.content.Context
From interface android.content.ComponentCallbacks2
From interface com.pspdfkit.ui.PdfUi
[Expand]
Inherited Fields
From class com.pspdfkit.ui.PdfActivity
From class android.app.Activity
Public Constructors
InstantPdfActivity()
Public Methods
InstantPdfDocument getDocument()
DocumentCoordinator getDocumentCoordinator()
InstantPdfFragment getPdfFragment()
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.
InstantPdfFragment requirePdfFragment()
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)
void setDocumentFromDataProviders(List<DataProvider> dataProviders, List<String> passwords)
void setDocumentFromUri(Uri documentUri, String password)
void setDocumentFromUris(List<Uri> documentUris, List<String> passwords)
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.activity.ComponentActivity
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.activity.OnBackPressedDispatcherOwner
From interface androidx.activity.contextaware.ContextAware
From interface androidx.activity.result.ActivityResultCaller
From interface androidx.activity.result.ActivityResultRegistryOwner
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.OnMultiWindowModeChangedProvider
From interface androidx.core.app.OnNewIntentProvider
From interface androidx.core.app.OnPictureInPictureModeChangedProvider
From interface androidx.core.app.TaskStackBuilder.SupportParentable
From interface androidx.core.content.OnConfigurationChangedProvider
From interface androidx.core.content.OnTrimMemoryProvider
From interface androidx.core.view.KeyEventDispatcher.Component
From interface androidx.core.view.MenuHost
From interface androidx.lifecycle.HasDefaultViewModelProviderFactory
From interface androidx.lifecycle.LifecycleOwner
From interface androidx.lifecycle.ViewModelStoreOwner
From interface androidx.savedstate.SavedStateRegistryOwner
From interface com.pspdfkit.instant.listeners.InstantDocumentListener
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
From interface com.pspdfkit.ui.PdfUi

Public Constructors

public InstantPdfActivity ()

Public Methods

public InstantPdfDocument getDocument ()

public DocumentCoordinator getDocumentCoordinator ()

public InstantPdfFragment getPdfFragment ()

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 InstantPdfFragment requirePdfFragment ()

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)

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

public void setDocumentFromUri (Uri documentUri, String password)

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

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