Class InstantPdfActivity

  • All Implemented Interfaces:
    android.content.ComponentCallbacks , android.content.ComponentCallbacks2 , android.view.KeyEvent.Callback , android.view.LayoutInflater.Factory , android.view.LayoutInflater.Factory2 , android.view.View.OnCreateContextMenuListener , android.view.Window.Callback , androidx.activity.FullyDrawnReporterOwner , androidx.activity.OnBackPressedDispatcherOwner , androidx.activity.contextaware.ContextAware , androidx.activity.result.ActivityResultCaller , androidx.activity.result.ActivityResultRegistryOwner , androidx.appcompat.app.ActionBarDrawerToggle.DelegateProvider , androidx.appcompat.app.AppCompatCallback , androidx.core.app.ActivityCompat.OnRequestPermissionsResultCallback , androidx.core.app.ActivityCompat.RequestPermissionsRequestCodeValidator , androidx.core.app.OnMultiWindowModeChangedProvider , androidx.core.app.OnNewIntentProvider , androidx.core.app.OnPictureInPictureModeChangedProvider , androidx.core.app.OnUserLeaveHintProvider , androidx.core.app.TaskStackBuilder.SupportParentable , androidx.core.content.OnConfigurationChangedProvider , androidx.core.content.OnTrimMemoryProvider , androidx.core.view.KeyEventDispatcher.Component , androidx.core.view.MenuHost , androidx.lifecycle.HasDefaultViewModelProviderFactory , androidx.lifecycle.LifecycleOwner , androidx.lifecycle.ViewModelStoreOwner , androidx.savedstate.SavedStateRegistryOwner , com.pspdfkit.instant.listeners.InstantDocumentListener , com.pspdfkit.instant.listeners.InstantPdfActivityListener , com.pspdfkit.internal.ui.menu.PdfActivityMenu.OnPrepareDefaultMenuItemListener , com.pspdfkit.listeners.DocumentListener , com.pspdfkit.listeners.OnMenuItemsGenerateListener , com.pspdfkit.listeners.PdfActivityListener , com.pspdfkit.ui.PdfActivityComponentsApi , com.pspdfkit.ui.PdfUi

    
    public class InstantPdfActivity
    extends PdfActivity implements InstantPdfActivityListener
                        

    Activity with fully integrated views and behaviour. Can be invoked by the simple helper method showInstantDocument.

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

    • Constructor Detail

      • InstantPdfActivity

        InstantPdfActivity()
    • Method Detail

      • onAuthenticationFinished

         void onAuthenticationFinished(@NonNull() InstantPdfDocument instantDocument, @NonNull() String validJwt)

        Called when authentication with Instant Server (PSPDFKit Document Engine) has successfully finished.

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

         void onSyncStarted(@NonNull() InstantPdfDocument instantDocument)

        Called when annotation sync has been started.

        Parameters:
        instantDocument - Document that is syncing the annotations.
      • onSyncFinished

         void onSyncFinished(@NonNull() InstantPdfDocument instantDocument)

        Called when annotation sync has been finished successfully.

        Parameters:
        instantDocument - Document that was syncing the annotations.
      • onDocumentCorrupted

         void onDocumentCorrupted(@NonNull() 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.
      • setDocument

         void setDocument(@NonNull() String serverUrl, @NonNull() String jwt)

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

        Parameters:
        serverUrl - Instant Server (PSPDFKit Document Engine) url.
        jwt - JWT used to authenticate access to the document.
      • setDocumentFromUri

         void setDocumentFromUri(@NonNull() Uri documentUri, @Nullable() String password)

        Loads a new document in this activity and replaces the existing one. This method may only be called if onSaveInstanceState 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.
      • setDocumentFromUris

         void setDocumentFromUris(@NonNull() List<Uri> documentUris, @Nullable() List<String> passwords)

        Loads a new document in this activity and replaces the existing one. This method may only be called if onSaveInstanceState 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.
      • setDocumentFromDataProvider

         void setDocumentFromDataProvider(@NonNull() DataProvider dataProvider, @Nullable() String password)

        Loads a new document in this activity and replaces the existing one. This method may only be called if onSaveInstanceState 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.
      • setDocumentFromDataProviders

         void setDocumentFromDataProviders(@NonNull() List<DataProvider> dataProviders, @Nullable() List<String> passwords)

        Loads a new document in this pdf UI and replaces the existing one. This method may only be called if onSaveInstanceState 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.