open

abstract fun open(activity: Activity, issueId: IssueId, page: Int = 1, theme: OneReaderTheme = OneReaderTheme())

Opens an issue, downloading it first if it is not on the device.

Returns immediately whatever the issue's download state, and the reader takes it from there, behind its own loading state:

  • Downloaded: opens offline. In the background, the catalogue is asked whether the publisher has released a newer edition since; if it has, the issue is downloaded again once the reader closes.

  • Downloading: opens on the pages already there; the rest render as they land.

  • NotDownloaded or Queued: the download is started, or moved to the front of the queue — Download.Item.startImmediate, the call a user waiting on this issue warrants — and the pages render as they land.

  • Paused: the download is resumed, and the pages render as they land.

  • Failed: the reader's own error screen, whose retry button asks for the download again. The reader never retries one on its own.

This holds for as long as the reader is open: a download paused or removed meanwhile is picked back up. A download that fails, or a downloaded issue that cannot be read, is the reader's own error screen — never a blank one. Whatever came in stays on the device and is listed by Download.trackedIssues, exactly as if the download had been started through Download.

Parameters

activity

the Activity to launch the reader from.

issueId

the issue to open.

page

the page to open on, 1-indexed. Defaults to the first page, which is also where a page outside the issue opens. To resume where the user left off, pass the farthest page the reader reached, which the ui module's screens hand you with their open events.

theme

the colors the reader draws with. Defaults to the engine's own palette.


abstract fun open(activity: Activity, articleId: ArticleId, theme: OneReaderTheme = OneReaderTheme())

Opens one article in the native article reader — text and images, reflowable, without the issue it came from.

Takes an identifier rather than a resolved article, so it can be called straight from a tap: it returns immediately and the reader resolves the article behind its own loading state. It is served from the content cache, so re-opening the same article shortly after costs nothing; otherwise it needs a connection. One that cannot be resolved surfaces as the reader's own articles-loading error.

Nothing is downloaded: images fall back to their remote URL when no local copy exists.

Parameters

activity

the Activity to launch the reader from.

articleId

the article to render.

theme

the colors the reader draws with. Defaults to the engine's own palette.


abstract fun open(activity: Activity, articleIds: List<ArticleId>, index: Int = 0, theme: OneReaderTheme = OneReaderTheme())

Opens a list of articles at index, letting the reader swipe from one to the next without coming back out.

Takes identifiers rather than resolved articles, so it can be called straight from a tap: it returns immediately and the reader resolves them behind its own loading state. They are fetched in parallel and served from the content cache, so re-opening the same list shortly after costs nothing; otherwise it needs a connection.

The whole list has to resolve before the reader shows any of it. It addresses articles by position, so a partial list would land on a different article than the one that was tapped; one that cannot be resolved surfaces as the reader's own articles-loading error.

Parameters

activity

the Activity to launch the reader from.

articleIds

the articles to page through, in the order they should be paged through.

index

which of articleIds to open on. Clamped to the list.

theme

the colors the reader draws with. Defaults to the engine's own palette.