Navigator

class Navigator(var book: Book? = null)(source)

A helper class for EPUB browser applications.

Tracks the user's position within a Book, supports moving between resources, and notifies registered NavigationEventListeners.

Not thread-safe; protect external access if you call this from multiple coroutines.

Constructors

Link copied to clipboard
constructor(book: Book? = null)

Properties

Link copied to clipboard
var book: Book?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

The current position within the spine, or < 0 if the current position is not within the spine.

Link copied to clipboard
fun gotoBook(book: Book, source: Any?)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun gotoPreviousSpineSection(pagePos: Int, source: Any?): Int
Link copied to clipboard
fun gotoResource(resource: Resource, source: Any?): Int
fun gotoResource(resourceHref: String, source: Any): Int
fun gotoResource(resource: Resource, pagePos: Int, source: Any?): Int
fun gotoResource(resource: Resource, fragmentId: String, source: Any?): Int
fun gotoResource(resource: Resource, pagePos: Int, fragmentId: String?, source: Any?): Int
Link copied to clipboard
fun gotoResourceId(resourceId: String?, source: Any?): Int
Link copied to clipboard
fun gotoSpineSection(newSpinePos: Int, source: Any?): Int

fun gotoSpineSection(newSpinePos: Int, newPagePos: Int, source: Any?): Int

Go to a specific section. Illegal spine positions are silently ignored.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun setCurrentResource(currentResource: Resource): Int

Sets the current index and resource without calling the event listeners.

Link copied to clipboard
fun setCurrentSpinePos(currentIndex: Int)

Sets the current index and resource without calling the event listeners.