public interface

BookmarkProvider

com.pspdfkit.bookmarks.BookmarkProvider

Class Overview

Handles all bookmark related operations on the owning document. Retrieve it with getBookmarkProvider()

Summary

Nested Classes
interface BookmarkProvider.BookmarkListener Listener for notifying other components when bookmarks change. 
Public Methods
abstract boolean addBookmark(Bookmark bookmark)
Adds a new bookmark to the document.
abstract Completable addBookmarkAsync(Bookmark bookmark)
Adds bookmark to the document.
abstract void addBookmarkListener(BookmarkProvider.BookmarkListener listener)
Adds a BookmarkProvider.BookmarkListener for being notified when bookmarks have been changed.
abstract List<Bookmark> getBookmarks()

Returns the list of bookmarks in the document.

abstract Observable<List<Bookmark>> getBookmarksAsync()
Returns the list of bookmarks in the document.
abstract boolean hasUnsavedChanges()
Returns true if there were any changes to the bookmarks without save.
abstract boolean removeBookmark(Bookmark bookmark)
Removes bookmark from the document.
abstract Completable removeBookmarkAsync(Bookmark bookmark)
Remove bookmark from the document.
abstract void removeBookmarkListener(BookmarkProvider.BookmarkListener listener)
Removes a previously registered BookmarkProvider.BookmarkListener.

Public Methods

public abstract boolean addBookmark (Bookmark bookmark)

Adds a new bookmark to the document.

Parameters
bookmark Bookmark to be added to the document.
Returns
  • true if bookmark was actually added, false otherwise.
Throws
IllegalStateException If an error occurred while adding the bookmark.

public abstract Completable addBookmarkAsync (Bookmark bookmark)

Adds bookmark to the document.

Parameters
bookmark Bookmark to be added.
Returns
  • Completable which notifies when addition was successful.

public abstract void addBookmarkListener (BookmarkProvider.BookmarkListener listener)

Adds a BookmarkProvider.BookmarkListener for being notified when bookmarks have been changed. If the listener has already been added previously, this method will be a no-op. Passing null is not allowed, and will result in an exception.

Parameters
listener BookmarkProvider.BookmarkListener that should be notified. Must be non-null.

public abstract List<Bookmark> getBookmarks ()

Returns the list of bookmarks in the document.


Note: this call may block for a while and should not be called on the main thread.

Returns
  • List of bookmarks or empty list if this document contains no bookmarks.

public abstract Observable<List<Bookmark>> getBookmarksAsync ()

Returns the list of bookmarks in the document.

Returns
  • Observable stream of bookmarks in the document.

public abstract boolean hasUnsavedChanges ()

Returns true if there were any changes to the bookmarks without save.

Returns
  • true if bookmarks were changed, false otherwise.

public abstract boolean removeBookmark (Bookmark bookmark)

Removes bookmark from the document.

Parameters
bookmark Bookmark to be removed.
Returns
  • true if bookmark was actually removed, false otherwise.
Throws
IllegalStateException If an error occurred while removing the bookmark.

public abstract Completable removeBookmarkAsync (Bookmark bookmark)

Remove bookmark from the document.

Parameters
bookmark Bookmark to be added.
Returns
  • Completable which notifies when removal was successful.

public abstract void removeBookmarkListener (BookmarkProvider.BookmarkListener listener)

Removes a previously registered BookmarkProvider.BookmarkListener. 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. Passing null is not allowed, and will result in an exception.

Parameters
listener BookmarkProvider.BookmarkListener that should be removed. Must be non-null.