Class DefaultBookmarkAdapter

    • Constructor Detail

      • DefaultBookmarkAdapter

        DefaultBookmarkAdapter(PdfFragment fragment)
        Creates a new adapter bound to the passed fragment.
        fragment - Fragment with which to interact.
    • Method Detail

      • getBookmarks

         List<Bookmark> getBookmarks()

        Called to retrieve the list of bookmarks to display.


        List of bookmarks to be shown in this view.

      • onBookmarkAdd

         void onBookmarkAdd()

        Called when add button has been clicked in this view.

      • onBookmarkPositionSet

         void onBookmarkPositionSet(@NonNull() Bookmark bookmark, int position)

        Called when bookmark has been reordered in this view.

        bookmark - Bookmark that has been reordered.
        position - New bookmark position.
      • onBookmarkNameSet

         void onBookmarkNameSet(@NonNull() Bookmark bookmark, @Nullable() String name)

        Called when bookmark should be renamed.

        bookmark - Bookmark that has been selected for rename.
        name - New bookmark name.
      • onBookmarkClicked

         void onBookmarkClicked(@NonNull() Bookmark bookmark)

        Called when user taps on a bookmark outside editing mode.

        bookmark - Bookmark that was tapped.
      • onBookmarkRemove

         boolean onBookmarkRemove(@NonNull() Bookmark bookmark)

        Called when user deleted the bookmark from list.

        bookmark - Bookmark that was deleted.

        true if the bookmark should be actually deleted, false if it should be left on the list.

      • isBookmarkAddButtonEnabled

         boolean isBookmarkAddButtonEnabled()

        Called to determine bookmark add button enabled state.


        true if add button should be enabled, false if it should be disabled.

      • onBookmarksChanged

         void onBookmarksChanged(@NonNull() List<Bookmark> bookmarks)

        Called when bookmark list has been changed in some way. Called on the UI thread. It is also called if any property of any bookmark in the list changes.

        bookmarks - List of bookmarks after change.
      • onBookmarkAdded

         void onBookmarkAdded(@NonNull() Bookmark bookmark)

        Called when a new bookmark was added. Called on the UI thread.

        bookmark - The recently added bookmark.
      • onDocumentLoaded

        @UiThread() void onDocumentLoaded(@NonNull() PdfDocument document)

        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.
      • onDocumentSave

         boolean onDocumentSave(@NonNull() PdfDocument document, @NonNull() DocumentSaveOptions saveOptions)

        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.

        true if the document should be saved, false if saving should be cancelled.

      • onDocumentSaved

         void onDocumentSaved(@NonNull() PdfDocument document)

        Called after the document has been saved.

        document - Instance of document that was saved.
      • onDocumentSaveCancelled

         void onDocumentSaveCancelled(PdfDocument document)

        Called if document saving has been cancelled.

        document - Instance of document that was saved.
      • onPageClick

         boolean onPageClick(@NonNull() PdfDocument document, @IntRange(from = 0) int pageIndex, @Nullable() MotionEvent event, @Nullable() PointF pagePosition, @Nullable() Annotation clickedAnnotation)

        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.
        pagePosition - Tapped page position (in PDF page coordinates with origin on bottom left).
        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.

      • onDocumentClick

         boolean onDocumentClick()

        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.

      • onPageChanged

         void onPageChanged(@NonNull() PdfDocument document, @IntRange(from = 0) int pageIndex)

        Called when user scrolled to a new page.

        document - Currently opened document.
        pageIndex - Page number of new page.
      • onDocumentZoomed

         void onDocumentZoomed(@NonNull() PdfDocument document, @IntRange(from = 0) int pageIndex, float scaleFactor)

        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.
      • onPageUpdated

         void onPageUpdated(@NonNull() PdfDocument document, @IntRange(from = 0) int pageIndex)

        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.