readerDocuments

Gets/sets the ReaderDocuments this ReaderView should render.

When setting this value, the list of ReaderDocuments is validated according to the following rules:

  • All ReaderDocuments must be renderable.

  • All ReaderDocuments must belong to one publication.

  • All ReaderDocuments must be ordered as in the publication spine.

If the passed list of readerDocuments fails validation, a ColibrioException will be thrown.

Some examples:

val spine = readerPublication.spine
readerView.readerDocuments = spine // OK!
readerView.readerDocuments = spine.slice(1..4) // OK!
readerView.readerDocuments = spine.filter { item -> item.reflowable } // OK!
readerView.readerDocuments = spine.reversed() // ERROR, items are not ordered correctly!

You need to call goTo or goToStart after setting new ReaderDocuments to start rendering the new content. There is one exception where you don't need to call goTo or goToStart and that is when updating this value to add additional ReaderDocuments from the same publication:

readerView.readerDocuments = spine.slice(0..4): // Initially, only render first 4 documents.
readerView.goToStart() // We need goTo() or goToStart() so ReaderView knows what to render initially.
...
// Later:
readerView.readerDocuments = spine.slice(0..6) // Add 2 more ReaderDocuments,
// No need to call [goTo] or [goToStart]