ReaderView

interface ReaderView

Functions

Link copied to clipboard
abstract fun addCustomCss(css: String)

Adds custom CSS to the WebView.

Link copied to clipboard

Adds an instance of OnActiveRendererChangedListener to the ReaderView.

Link copied to clipboard
Link copied to clipboard

Adds an instance of OnKeyboardEventListener to the ReaderView.

Link copied to clipboard

Adds an instance of OnMediaElementEventListener to the ReaderView.

Link copied to clipboard

Adds an instance of OnMouseEventListener to the ReaderView.

Link copied to clipboard

Adds an instance of OnNavigationIntentEventListener to the ReaderView.

Link copied to clipboard

Adds an instance of OnPageProgressionTimelineEventListener to the ReaderView. Its according method will be called when views PageProgressionTimelineImpl is either recalculated, recalculating or its visible range would change.

Link copied to clipboard

Adds an instance of OnPointerEventListener to the ReaderView.

Link copied to clipboard
Link copied to clipboard

Adds an instance of OnRendererScrollEventListener to the ReaderView.

Link copied to clipboard

Adds an instance of OnRenderingStateChangedListener to the ReaderView.

Link copied to clipboard

Adds an instance of OnSelectionChangedListener to the ReaderView.

Link copied to clipboard

Adds an instance of OnVisibleContentChangedListener to the ReaderView.

Link copied to clipboard
abstract fun addRenderer(renderer: Renderer, mediaQueryRule: String? = null)

Adds a renderer to this ReaderView and optionally a mediaQueryRule (CSS media query rule).

Link copied to clipboard
abstract fun clearContentSelection()

Clears any selection made in content documents.

Link copied to clipboard
abstract fun destroyAnnotationLayer(readerViewAnnotationLayer: ReaderViewAnnotationLayer)

Destroys the readerViewAnnotationLayer and removes it from ReaderView.annotationLayers.

Link copied to clipboard
abstract suspend fun fetchRectsForVisibleContent(visiblePage: VisiblePageData, locator: SimpleLocatorData? = null, options: VisibleContentRectsOptions = VisibleContentRectsOptions()): ColibrioResult<VisibleContentRectsResultData>
abstract fun fetchRectsForVisibleContent(visiblePage: VisiblePageData, locator: SimpleLocatorData? = null, options: VisibleContentRectsOptions = VisibleContentRectsOptions(), onSuccess: (VisibleContentRectsResultData) -> Unit, onError: (ColibrioException) -> Unit = {})

Fetch rectangles and locators for line boxes and replaced elements such as <img> elements from the specified visible page. If a locator is specified, it will be used to filter the result.

Link copied to clipboard
abstract fun focusOnReadingPosition(options: FocusOnReadingPositionOptions, onSuccess: () -> Unit = {}, onError: (ColibrioException) -> Unit = {})

Focus on the page and/or element best matching the reading position inside the WebView.

Link copied to clipboard
abstract suspend fun goTo(locator: SimpleLocatorData): ColibrioResult<Unit>
abstract suspend fun goTo(locator: SimpleLocatorData, options: ReaderViewGotoOptions): ColibrioResult<Unit>
abstract fun goTo(locator: SimpleLocatorData, onSuccess: () -> Unit = {}, onError: (ColibrioException) -> Unit = {})
abstract fun goTo(locator: SimpleLocatorData, options: ReaderViewGotoOptions, onSuccess: () -> Unit = {}, onError: (ColibrioException) -> Unit = {})

Go to a specific location in a ReaderDocument that has been added to this ReaderView.

Link copied to clipboard
abstract suspend fun goToStart(): ColibrioResult<Unit>
abstract fun goToStart(onSuccess: () -> Unit = {}, onError: (ColibrioException) -> Unit = {})

Go to the start of the first ReaderDocument in this ReaderView.

Link copied to clipboard
abstract suspend fun next(): ColibrioResult<Unit>
abstract fun next(onSuccess: () -> Unit = {}, onError: (ColibrioException) -> Unit = {})

Tell the activeRenderer to navigate to and display next content fragment (i.e. page, spread, or content-document, depending on the renderer implementation). The navigation will be ignored if there is an ongoing navigation started with next(), previous(), goTo() or goToStart().

Link copied to clipboard
abstract suspend fun previous(): ColibrioResult<Unit>
abstract fun previous(onSuccess: () -> Unit = {}, onError: (ColibrioException) -> Unit = {})

Tell the activeRenderer to navigate to and display previous content fragment (i.e. page, spread, or content-document, depending on the renderer implementation). The navigation will be ignored if there is an ongoing navigation started with next(), previous(), goTo() or goToStart().

Link copied to clipboard
abstract fun refresh(force: Boolean = false)

Re-render contents if view element dimensions have changed. If the force parameter is set to true, the content is re-rendered regardless if the view element dimensions changed.

Link copied to clipboard

Removes an instance of OnActiveRendererChangedListener from the ReaderView.

Link copied to clipboard

Removes an instance of OnActiveTransformChangedListener from the ReaderView.

Link copied to clipboard

Removes an instance of OnKeyboardEventListener from the ReaderView.

Link copied to clipboard

Removes an instance of OnMediaElementEventListener from the ReaderView.

Link copied to clipboard

Removes an instance of OnMouseEventListener from the ReaderView.

Link copied to clipboard

Removes an instance of OnNavigationIntentEventListener to the ReaderView.

Link copied to clipboard

Removes an instance of OnNavigationStateChangedListener from the ReaderView.

Link copied to clipboard

Removes an instance of OnPointerEventListener from the ReaderView.

Link copied to clipboard

Removes an instance of OnReadingPositionChangedListener from the ReaderView.

Link copied to clipboard

Removes an instance of OnRendererScrollEventListener from the ReaderView.

Link copied to clipboard

Removes an instance of OnRenderingStateChangedListener from the ReaderView.

Link copied to clipboard

Removes an instance of OnSelectionChangedListener from the ReaderView.

Link copied to clipboard

Removes an instance of OnVisibleContentChangedListener from the ReaderView.

Link copied to clipboard
abstract fun removeRenderer(renderer: Renderer)

Remove a renderer previously added with addRenderer

Link copied to clipboard
abstract suspend fun scrollBy(length: Length): ColibrioResult<Boolean>
abstract fun scrollBy(length: Length, onSuccess: (Boolean) -> Unit = {}, onError: (ColibrioException) -> Unit = {})

Scrolls a scrolling renderer's content by the specified amount. Relative values such as PERCENTAGE will be based on the renderer element's clientHeight.

Link copied to clipboard

Sets the HTML content to be displayed in the ReaderView when there is no activeRenderer. If html is null, no content will be shown.

Link copied to clipboard
abstract fun setContentOnEmptyPage(html: String?)

Sets the HTML content to be displayed in the ReaderView for empty pages. This can typically happen in spread renderers when pages have a preferred PageSpreadSlot. If html is null, a blank page will be shown.

Link copied to clipboard

Sets the HTML to use when no license has been validated on the device for the duration of the grace period (defaults to 30 days). See OnLicenseEventListener.onLicenseReadingSessionBlocked for more information.

Link copied to clipboard
abstract fun setContentOnLoadError(html: String?, retryButtonText: String?)

Sets the HTML content to be displayed in the ReaderView when a loading error occurs. A retry button will also be displayed. When clicked it will perform a ReaderView.refresh with force = true.

Link copied to clipboard
abstract fun setContentOnLoading(html: String?)

Sets the HTML content to show when loading publication content. Use this method to change the default loading animation.

Link copied to clipboard
abstract fun setMargins(left: Int = 0, top: Int = 0, right: Int = 0, bottom: Int = 0)

Sets margins on the view element inside the WebView. Values should be passed as device pixels.

Link copied to clipboard
abstract fun setSyncMediaPlayer(syncMediaPlayer: SyncMediaPlayer?, initialSyncMethod: SyncMediaReaderViewSynchronizationMethod = SyncMediaReaderViewSynchronizationMethod.SYNC_MEDIA_SEEK)

Attach a SyncMediaPlayer to the ReaderView.

Properties

Link copied to clipboard

The current active gesture type being performed by the user if any.

Link copied to clipboard

The current navigation action being performed, if any.

Link copied to clipboard
abstract var activeRenderer: Renderer?

Gets/sets the active Renderer used by this ReaderView.

Link copied to clipboard

Gets/sets which gesture types the user is allowed to perform on the ReaderView.

Link copied to clipboard

The list of ReaderViewAnnotationLayer in this ReaderView.

Link copied to clipboard
abstract val atEnd: Boolean

Check if this ReaderView is currently showing the last content in the last reader document added to the ReaderView. Check this value after a call to OnVisibleContentChangedListener.onVisibleRangeChanged to detect when this value is changed.

Link copied to clipboard
abstract val atStart: Boolean

Check if this ReaderView is currently showing the first content in the first reader document added to the ReaderView. Check this value after a call to OnVisibleContentChangedListener.onVisibleRangeChanged to detect when this value is changed.

Link copied to clipboard
abstract val canPerformGoTo: Boolean

Check if it possible to call goTo or goToStart at this moment.

Link copied to clipboard
abstract val canPerformNext: Boolean

Check if it possible to call next at this moment.

Link copied to clipboard

Check if it possible to call previous at this moment.

Link copied to clipboard

Get/sets if the user can select content in the ReaderView. Initially true.

Link copied to clipboard

If offscreen content is currently rendering. Use addOnRenderingStateChangedListener to detect when this value changes.

Link copied to clipboard

Gets/sets the ReaderViewOptions used for this instance.

Link copied to clipboard

Get the page progression direction used by this ReaderView. Will give the actual runtime value after OnVisibleContentChangedListener.onVisiblePagesChanged has been called.

Link copied to clipboard

The page progression timeline of this ReaderView if available. Use OnPageProgressionTimelineEventListener.onPageProgressionTimelineRecalculated to detect when a new instance is available.

Link copied to clipboard

Gets/sets the ReaderDocuments this ReaderView should render.

Link copied to clipboard

The current reading position, or null if this ReaderView is not rendering any publication content. Use addOnReadingPositionChangedListener to detect when this value changes.

Link copied to clipboard

Gets/sets if the ReaderView should automatically refresh when the width or height of the ReaderView changes. True by default

Link copied to clipboard
abstract val renderers: List<Renderer>

List of Renderer's added to the ReaderView.

Link copied to clipboard

If the ReaderView will choose the activeRenderer based on the CSS media query rule associated with each added renderer. See addRenderer for more details.

Sets if the scripted content document event handlers are allowed to receive events. This is the only way to prevent scripted content document from receiving user generated events, such as "pointerdown" or "click".

Link copied to clipboard

Get information about the activeRenderer's current scroll state, if the renderer is a scrolling renderer. Note that the scrollTop value is not up-to-date while scrolling is true.

Link copied to clipboard

Gets the SyncMediaPlayer attached to this ReaderView.

Link copied to clipboard

The ReaderViewTransformManager used for applying transformations such as scaling and translations.

Link copied to clipboard

If visible content is currently rendering. Use addOnRenderingStateChangedListener to detect when this value changes.

Link copied to clipboard

The current list of visible pages. Use addOnVisibleContentChangedListener to detect when this value changes.

Link copied to clipboard

The locator describing the range of the visible content, or null if this ReaderView is not rendering any publication content. Use addOnVisibleContentChangedListener to detect when this value changes.